summaryrefslogtreecommitdiff
path: root/nova/tests/unit/objects/test_image_meta.py
diff options
context:
space:
mode:
authorGary Kotton <gkotton@vmware.com>2015-06-07 01:35:08 -0700
committerGary Kotton <gkotton@vmware.com>2015-06-09 01:35:51 -0700
commitb927c42eaffc12294da9e365bfaa587ca180fcb8 (patch)
tree8e10a2fd12088e0ed2a5553e00c9a269aa57c07c /nova/tests/unit/objects/test_image_meta.py
parent084b8c79f2be1f5f3e242ceadb1ceb1537cc0ff9 (diff)
downloadnova-b927c42eaffc12294da9e365bfaa587ca180fcb8.tar.gz
Objects: update missing adapter types
The vmware_adaptertype does not map 1:1 to either the hw_disk_bus or hw_scsi_model. So we need a combination of both. The vmware_adaptertype will drive which flags are set. The settings are as follows: +-----------------------------------------------+ |vmware_apdaptertype|hw_disk_bus|hw_scsi_model | +-----------------------------------------------+ | ide | ide | | | lsiLogic | scsi | lsilogic | | busLogic | scsi | buslogic | | lsiLogicsas | scsi | lsisas1068 | | paraVirtual | scsi | vmpvscsi | +-------------------+-----------+---------------+ Change-Id: Ibb93636d767862470ebd704e3e23ec04e8a1f1ff
Diffstat (limited to 'nova/tests/unit/objects/test_image_meta.py')
-rw-r--r--nova/tests/unit/objects/test_image_meta.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/nova/tests/unit/objects/test_image_meta.py b/nova/tests/unit/objects/test_image_meta.py
index 82853e3dcc..c0293fe11a 100644
--- a/nova/tests/unit/objects/test_image_meta.py
+++ b/nova/tests/unit/objects/test_image_meta.py
@@ -151,6 +151,28 @@ class TestImageMetaProps(test.NoDBTestCase):
self.assertTrue(image_meta.img_bdm_v2)
self.assertEqual("/dev/vda", image_meta.img_root_device_name)
+ def test_legacy_compat_vmware_adapter_types(self):
+ legacy_types = ['lsiLogic', 'busLogic', 'ide', 'lsiLogicsas',
+ 'paraVirtual']
+
+ for legacy_type in legacy_types:
+ legacy_props = {
+ 'vmware_adaptertype': legacy_type,
+ }
+
+ image_meta = objects.ImageMetaProps.from_dict(legacy_props)
+ if legacy_type == 'ide':
+ self.assertEqual('ide', image_meta.hw_disk_bus)
+ else:
+ self.assertEqual('scsi', image_meta.hw_disk_bus)
+ if legacy_type == 'lsiLogicsas':
+ expected = 'lsisas1068'
+ elif legacy_type == 'paraVirtual':
+ expected = 'vmpvscsi'
+ else:
+ expected = legacy_type.lower()
+ self.assertEqual(expected, image_meta.hw_scsi_model)
+
def test_duplicate_legacy_and_normal_props(self):
# Both keys are referring to the same object field
props = {'hw_scsi_model': 'virtio-scsi',