[openstack-dev] Booting Nova VMs with custom swap/ephemeral devices ?
Daniel P. Berrange
berrange at redhat.com
Wed Jan 23 15:03:14 UTC 2013
On Wed, Jan 23, 2013 at 03:38:00PM +0100, Nikola Đipanov wrote:
> On 23/01/13 13:14, Daniel P. Berrange wrote:
> > When booting a VM in Nova one of the parameters passed to the 'spawn'
> > method in the virt driver API is 'block_device_info'. From reading
> > the code I can see that this is a dict that has the following kind of
> > structure:
> >
> > block_device_info = {
> > 'root_device_name': "/dev/sda",
> > 'swap': {
> > 'device_name': "/dev/sdb",
> > 'swap_size': 5,
> > }
> > 'ephemerals': [
> > {'num': 0,
> > 'virtual_name': 'eph0',
> > 'device_name': "/dev/sdc",
> > 'size': 5 },
> > {'num': 1,
> > 'virtual_name': 'eph1',
> > 'device_name': "/dev/sdd",
> > 'size': 5 },
> > {'num': 2,
> > 'virtual_name': 'eph2',
> > 'device_name': "/dev/sde",
> > 'size': 5 },
> > ...
> > ],
> > 'block_device_mapping': [
> > {'cinfo': {....some cinder volume data....},
> > 'mount_device': "/dev/sdf",
> > 'delete_on_termination': True },
> > {'cinfo': {....some cinder volume data....},
> > 'mount_device': "/dev/sdg",
> > 'delete_on_termination': True },
> > {'cinfo': {....some cinder volume data....},
> > 'mount_device': "/dev/sdh",
> > 'delete_on_termination': True },
> > ...
> > ],
> > }
> >
> >
> > I'm doing some work in this area of the libvirt driver, so trying to
> > figure out just how to test this.
> >
> > I can populate the 'block_device_mapping' field with cinder volumes
> > during 'nova boot' thus:
> >
> > # nova boot \
> > --image f16-x86_64-openstack-sda \
> > --key-name mykey \
> > --flavor m1.small f16demo3 \
> > --block-device-mapping /dev/vdf=404d2b8e-a174-4d4c-9bfb-6091dc480a01:::0
> >
> > Despite looking all over the code I still can't figure out how on earth
> > a user can cause the 'root_device_name', 'swap' or 'ephemeral' fields in
> > 'block_device_info' to be populated with anything other than None.
> >
> > Can anyone enlighten me, and/or point to the documentation on this ?
>
> Hey Daniel,
>
> So currently root_device_name is populated form the image properties see
> nova.compute.api.API._validate_and_provision_instance mostly this line:
>
> root_device_name = block_device.properties_root_device_name(
> image.get('properties', {}))
>
> and then nova.compute.manager._setup_block_device_mapping just gets it
> from the instance. So - it can be set on the image but not passed from
> the command line to boot.
>
> swap and ephemeral are taken in a similar way, but for details see
> nova.compute.api.API._populate_instance_for_bdm and
> _update_image_block_device_mapping methods.
>
> Please do correct me if I'm wrong.
>
> I am working on enabling ephemerals and swap from the command line as
> well as part of
> https://blueprints.launchpad.net/nova/+spec/improve-block-device-handling targeted
> for grizzly-3.
Hmm, this seems to imply it is not currently possible to use the
features with nova CLI ? If so, then I wonder why/how did this
functionality come to exist & be used in the first place ? Perhaps
there's a way to use it from the EC2 compatible CLI ?
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the OpenStack-dev
mailing list