LXC volume attachment code does not work

Bug #1009701 reported by David Kang
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Chuck Short

Bug Description

 We are using Essex version.
(And we found out that the current nova still uses the same method to attach a volume to an LXC instance.)
We are testing volume attachment to an LXC instance.
From the code, the volume is mounted by the host machine to the file system of the LXC instance.

# nova/virt/disk/api.py
utils.execute('mount', '-o', 'bind', src, target,
                run_as_root=True)

From the host machine, it is visible.
But, inside of the LXC instance, it is not visible.
Does this method work?

 Before Essex, we used "lxc-attach" command to run "mknod" command inside of the LXC instance
instead of "mount" it by the host outside of the LXC instance.
It did work.

 As I know, dynamic changes in 'devices' done by the host outside of the LXC instance is not shown inside of the LXC instance.
(Dynamic changes in 'files' in the LXC file system done by the host outside of the LXC instance can be seen inside of the LXC instance.)
As I understand, the current way of attaching volume to an LXC instance does not work.

 Here are the content of the dev directory shown inside of the LXC instance, and at the host side.
Both are different.

1. Inside the LXC instance
$ ls /dev
console full null nvidia0 nvidia1 nvidia2 nvidia3 nvidiactl ptmx pts random tty tty1 urandom zero

2. At the host
$ ls /usr/local/nova/instances/instance-0000004f/rootfs/dev/
block crash full kmsg loop5 mapper nbd13 nbd7 oldmem ram11 ram5 rtc sg2 shm tty0 tty16 tty23 tty30 tty38 tty45 tty52 tty6 ttyS0 usbmon3 vcs2 vcsa3 zero
bsg disk fuse kvm loop6 mcelog nbd14 nbd8 port ram12 ram6 rtc0 sg3 snapshot tty1 tty17 tty24 tty31 tty39 tty46 tty53 tty60 ttyS1 usbmon4 vcs3 vcsa4
bus dm-0 fw0 log loop7 mem nbd15 nbd9 ppp ram13 ram7 sda sg4 snd tty10 tty18 tty25 tty32 tty4 tty47 tty54 tty61 ttyS2 usbmon5 vcs4 vcsa5
char dm-1 hidraw0 loop0 lp0 nbd0 nbd2 net ptmx ram14 ram8 sda1 sg5 stderr tty11 tty19 tty26 tty33 tty40 tty48 tty55 tty62 ttyS3 usbmon6 vcs5 vcsa6
console dm-2 hidraw1 loop1 lp1 nbd1 nbd3 network_latency pts ram15 ram9 sdb sg6 stdin tty12 tty2 tty27 tty34 tty41 tty49 tty56 tty63 urandom usbmon7 vcs6 vdc
core fb hugepages loop2 lp2 nbd10 nbd4 network_throughput ram0 ram2 random sdb1 sg7 stdout tty13 tty20 tty28 tty35 tty42 tty5 tty57 tty7 usbmon0 usbmon8 vcsa vga_arbiter
cpu fb0 hvc0 loop3 lp3 nbd11 nbd5 null ram1 ram3 raw sg0 sg8 systty tty14 tty21 tty29 tty36 tty43 tty50 tty58 tty8 usbmon1 vcs vcsa1 vhost-net
cpu_dma_latency fd input loop4 MAKEDEV nbd12 nbd6 nvram ram10 ram4 root sg1 sg9 tty tty15 tty22 tty3 tty37 tty44 tty51 tty59 tty9 usbmon2 vcs1 vcsa2 VolGroup

 Thanks,
 David

Tags: lxc
Tom Fifield (fifieldt)
tags: added: lxc
Lorin Hochstein (lorinh)
summary: - weather volume attachment for LXC instance works
+ Whether volume attachment for LXC instance works
Revision history for this message
Daniel Berrange (berrange) wrote : Re: Whether volume attachment for LXC instance works

This openstack code is just plain broken. The /dev inside the container is a custom tmpfs instance. Since containers have a private filesystem namespace, the is not visible to the host filesystem in any way.

This broken code should just be removed, since there is no reasonable way to make this work without kernel support for /proc/self/ns/mount, and once that exists, libvirt will be able to provide proper APIs for this operation.

Changed in nova:
status: New → Confirmed
summary: - Whether volume attachment for LXC instance works
+ LXC volume attachment code does not work
Changed in nova:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in nova:
importance: Medium → High
Chuck Short (zulcss)
Changed in nova:
assignee: nobody → Chuck Short (zulcss)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/13046

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/17861
Committed: http://github.com/openstack/nova/commit/b8831091a8d097bb55a0e65c3af254a8bfa88811
Submitter: Jenkins
Branch: master

commit b8831091a8d097bb55a0e65c3af254a8bfa88811
Author: Chuck Short <email address hidden>
Date: Tue Dec 11 10:02:28 2012 -0600

    Remove lxc attaching/detaching of volumes

    Remove lxc attach and detach of volumes since this
    will be handled by libvirt in upcoming versions of
    libvirt.

    This is expected to be in libvirt 1.0.1 or 1.0.2.
    This resolves (LP: #1067638) and (LP: #1009701)

    This removes a non-functional feature of the
    lxc driver with functionalilty that is coming
    with newer versions of libvirt.

    Change-Id: Iaf4bc2769632ba2e7dcfc67892dded7b4dfbb3ae
    Signed-off-by: Chuck Short <email address hidden>

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-2 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.