Cinder back-end support for containers

Registered by LiangChen

Currently the Nova Docker Driver doesn't support the --block-device-mapping when boot container.
At the same time, docker doesn't support attach volume when containers are running.

Due to this, the containers not support persistence the user date in the IPSAN etc.

This Blueprint is to provide this missing functionality when boot containers in Nova Docker Driver.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
LiangChen
Direction:
Needs approval
Assignee:
LiangChen
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Cinder back-end support for containers (with IPSAN)
====================================================

Requirement Description:
===================

1.Presently the Nova Docker Driver doesn't support persistence the user date (use cinder back-end)when boot containers.

 Below is a proposed solution.

Design:

======

1. With this fix, the nova-docker supports --block-device-mapping and uses docker --device to mapping the host devices to the containers devices.

Code fix Description :
===============

This Fix contains one additional method and modifies the exist method.

# This method is used for connecting the bdms, and return the mapping the devices.

    def _get_guest_storage_config(self, context, block_device_info,
                                  reboot=False):

At the same time, it adds volume_drivers for the docker.
docker_volume_drivers = [
    'iscsi=novadocker.virt.docker.volume.DockerISCSIVolumeDriver',
]

# This method add support for the devices

    self._start_container(container_id, instance, network_info, devices)

Test Description:
============

Apart from the Unit test execution, below is a manual way to verify the working functionality by the tester.

1. Create a cinder volume using openstack
    #cinder create --display-name vol-test 1

/etc/cinder/cinder.conf
[lvmdriver-1]
iscsi_helper = tgtadm
volume_group = stack-volumes-lvmdriver-1
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_backend_name = lvmdriver-1

2. Create containers useing the above VOL-ID

nova boot test-vol --flavor 2 --image cirros:latest --nic net-id=7754392d-f56e-4240-9a64-9ee5710251be --block-device-mapping vdx=$VOL-ID:::0

Note:
There is a bug in the kilo, must fix bug with two patches: one is already in kilo, another patch client is not fix yet.

https://bugs.launchpad.net/nova/+bug/1433609

The python-novaclient patch

https://review.openstack.org/#/c/165932/1

3. Verify the container device mapping

     #docker inspect CONTAINER-ID
        "Devices": [
            {
                "CgroupPermissions": "rwm",
                "PathInContainer": "/dev/vdx",
                "PathOnHost": "/dev/sdd"
            }
        ]

4. Verify the iscsi mession

    #iscsiadm -m session |grep $VOL-ID

5. Verify that the device can be used and the attach info in cinder is right.

    #dd if=/dev/vdx of=/home/c.file bs=512 count=1

[root@localhost iscsi]# cinder list
+--------------------------------------+--------+----------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+----------+------+-------------+----------+--------------------------------------+
| 79c9c916-583b-4e45-b73d-42be60012f23 | in-use | vol-006 | 1 | lvmdriver-1 | false | 954fb01c-8d0e-46cc-bad7-85728dc1a4df |
| c2e42831-d730-496c-8bb7-1255349baa2f | in-use | vol-test | 1 | lvmdriver-1 | false | 009ed2a5-41a7-4877-94bb-3dbc73126236 |
+--------------------------------------+--------+----------+------+-------------+----------+--------------------------------------+

Gerrit topic: https://review.openstack.org/#q,topic:bp/container-cinder-support,n,z

Addressed by: https://review.openstack.org/178500
    Cinder back-end support for containers

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.