diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2013-02-25 15:47:35 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2013-02-27 13:12:49 +0000 |
commit | 2c9eba280a78e4159267d4a56a09df9076c844d3 (patch) | |
tree | 19e692dce6875fc29852d1e2c0ae1f029d0c454f | |
parent | 907594ec28193a1ba9fdaf7420b153433e7ea47b (diff) | |
download | nova-2c9eba280a78e4159267d4a56a09df9076c844d3.tar.gz nova-2c9eba280a78e4159267d4a56a09df9076c844d3.tar.xz nova-2c9eba280a78e4159267d4a56a09df9076c844d3.zip |
Add a 'hw_' namespace to glance hardware config properties
This updates the libvirt driver to use a 'hw_' prefix on
the names of hardware config properties it looks up for
glance images. Thus the new syntax for setting custom
hardware properties is
# glance image-update \
--property hw_disk_bus=ide \
--property hw_cdrom_bus=ide \
--property hw_vif_model=e1000 \
f16-x86_64-openstack-sda
There is no back-compat support for the previous 'disk_bus',
'cdrom_bus' and 'vif_model' names, since they were never
made available in any formal release, only development
snapshots.
DocImpact
Blueprint: libvirt-custom-hardware
Fixes bug 1132739
Change-Id: Ic15ef0eba065113b35bbb2713be2532c858c3534
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r-- | nova/tests/test_libvirt_blockinfo.py | 8 | ||||
-rw-r--r-- | nova/tests/test_libvirt_vif.py | 4 | ||||
-rw-r--r-- | nova/virt/libvirt/blockinfo.py | 2 | ||||
-rw-r--r-- | nova/virt/libvirt/vif.py | 3 |
4 files changed, 9 insertions, 8 deletions
diff --git a/nova/tests/test_libvirt_blockinfo.py b/nova/tests/test_libvirt_blockinfo.py index 5560e63fd..87a76ccac 100644 --- a/nova/tests/test_libvirt_blockinfo.py +++ b/nova/tests/test_libvirt_blockinfo.py @@ -419,13 +419,13 @@ class LibvirtBlockInfoTest(test.TestCase): device_type='cdrom') self.assertEqual(bus, 'ide') - image_meta = {'properties': {'disk_bus': 'scsi'}} + image_meta = {'properties': {'hw_disk_bus': 'scsi'}} bus = blockinfo.get_disk_bus_for_device_type('kvm', image_meta) self.assertEqual(bus, 'scsi') - image_meta = {'properties': {'disk_bus': 'usb', - 'cdrom_bus': 'scsi'}} + image_meta = {'properties': {'hw_disk_bus': 'usb', + 'hw_cdrom_bus': 'scsi'}} bus = blockinfo.get_disk_bus_for_device_type('kvm', image_meta, device_type='cdrom') @@ -435,7 +435,7 @@ class LibvirtBlockInfoTest(test.TestCase): image_meta) self.assertEqual(bus, 'usb') - image_meta = {'properties': {'disk_bus': 'xen'}} + image_meta = {'properties': {'hw_disk_bus': 'xen'}} self.assertRaises(exception.UnsupportedHardware, blockinfo.get_disk_bus_for_device_type, 'kvm', diff --git a/nova/tests/test_libvirt_vif.py b/nova/tests/test_libvirt_vif.py index 026e55e9c..6160105ce 100644 --- a/nova/tests/test_libvirt_vif.py +++ b/nova/tests/test_libvirt_vif.py @@ -277,7 +277,7 @@ class LibvirtVifTestCase(test.TestCase): return fakelibvirt.Connection("qemu:///session", False) d = vif.LibvirtGenericVIFDriver(get_connection) - image_meta = {'properties': {'vif_model': 'e1000'}} + image_meta = {'properties': {'hw_vif_model': 'e1000'}} xml = self._get_instance_xml(d, self.net_bridge, self.mapping_bridge, @@ -301,7 +301,7 @@ class LibvirtVifTestCase(test.TestCase): return fakelibvirt.Connection("qemu:///session", False) d = vif.LibvirtGenericVIFDriver(get_connection) - image_meta = {'properties': {'vif_model': 'acme'}} + image_meta = {'properties': {'hw_vif_model': 'acme'}} self.assertRaises(exception.UnsupportedHardware, self._get_instance_xml, d, diff --git a/nova/virt/libvirt/blockinfo.py b/nova/virt/libvirt/blockinfo.py index 09e3809d9..3e4b3995c 100644 --- a/nova/virt/libvirt/blockinfo.py +++ b/nova/virt/libvirt/blockinfo.py @@ -201,7 +201,7 @@ def get_disk_bus_for_device_type(virt_type, # Prefer a disk bus set against the image first of all if image_meta: - key = device_type + "_bus" + key = "hw_" + device_type + "_bus" disk_bus = image_meta.get('properties', {}).get(key) if disk_bus is not None: if not is_disk_bus_valid_for_virt(virt_type, disk_bus): diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 8d9664751..fde45b4a7 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -101,7 +101,8 @@ class LibvirtBaseVIFDriver(object): # If the user has specified a 'vif_model' against the # image then honour that model if image_meta: - vif_model = image_meta.get('properties', {}).get('vif_model') + vif_model = image_meta.get('properties', + {}).get('hw_vif_model') if vif_model is not None: model = vif_model |