[openstack-dev] Booting Nova VMs with custom swap/ephemeral devices ?

Daniel P. Berrange berrange at redhat.com
Wed Jan 23 12:14:43 UTC 2013


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 ?

Regards,
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