[Openstack] Libvirt LXC with volume-attach broken ?

Eric W. Biederman ebiederm at xmission.com
Fri Jul 6 10:40:18 UTC 2012


"Daniel P. Berrange" <berrange at redhat.com> writes:

> On Fri, Jul 06, 2012 at 02:35:14AM -0700, Eric W. Biederman wrote:
>> "Daniel P. Berrange" <berrange at redhat.com> writes:
>> > The part of the problem is that I have a /dev/sdf, or even a
>> > /dev/volgroup00/logvol3 in the host (with whatever major:minor
>> > number that implies), and I want to be able to make it always
>> > appear as /dev/sda  in the container (with the correspondingly
>> > different major:minor number).  I'm guessing this is what Serge
>> > was refering to as the 'device' namespace problem
>> 
>> Getting the device to always appear with the name /dev/sda is easy.
>> 
>> Where does the need to have a specific device come from?  I would have
>> thought by now that hotplug had been around long enough that in general
>> user space would not care.
>> 
>> The only case that I know of where keeping the same device number seems
>> reasonable is in the case of live migration an application, in order to
>> avoid issues with stat changing for the same file over the transition,
>> and I think a synthesized hotplug event could probably handle that case.
>> 
>> Is there another case besides buggy applications that have hard
>> coded device numbers that need specific device numbers?
>
> There isn't any particular buggy application we're trying to avoid
> here. We're just trying to provide an piece of OpenStack functionality
> to LXC in the same way as its provided to KVM.
>
> With a basic OpenStack instance, you just get the root filesystem
> from the image you booted, whose contents are transient (ie thrown
> away on shutdown). It is possible to tell OpenStack to attach one
> or more block devices to a running instance, which give you some
> persistent storage.
>
> The end user API for this lets the host admin specify the device
> name that the block device will appear as inside the instance.
>
> eg, with KVM you'd invoke:
>
>  # nova volume-attach myguest  mystoragevol1 /dev/vdb
>  # nova volume-attach myguest  mystoragevol2 /dev/vdc
>
> Obviously with KVM this just works, because you have a level of
> indirection between host & guest device names via virtio-blk.
>
> The desire is to be able to wire up LXC in a similar way
>
>  # nova volume-attach myguest  mystoragevol1 /dev/sdb
>  # nova volume-attach myguest  mystoragevol2 /dev/sdc
>
> So it is really the host admin specifying that they want to provide
> the container with a '/dev/sdb' device, regardless of what the actual
> device node on the host is (it could be an iSCSI LUN, multipath LUN,
> LVM volume, or whatever). So I'm really looking to have the container
> visible device name be independent of host name.

And there is a level of inderection in more linux, between the
device and the device name.  That level of indirection is the
device number. 

So you should have no trouble specifying the device name.

Regardless it looks like setns is enough for this problem.

There is a challege to be with some of the more advanced
parts of this.  Things like creating loopback block devices
from files, etc.  But I think I just need to get my setns
patch for the mount namespace merged and you should have
what you need for libvirt and lxc.

Eric




More information about the Openstack mailing list