Xenapi: Fix tempest for xenserver device tagging
This patch is for tempest modification to fit xenserver device
tagging implementation about block-device tagging.
There are two reasons that multiple paths will exist for a tagged
disk:
1) HVM guests may not have the PV drivers installed, in which
case the disk will be accessible on the IDE bus. When the PV
drivers are installed the disk will be accessible on the Xen bus.
2) Windows guests with PV drivers installed expose devices in a
different way to Linux guests with PV drivers. Linux systems will
see disk paths under /sys/devices/, but Windows guests will see
them in the registry (e.g.
HKLM\System\ControlSet001\Enum\SCSIDisk). These two disks are both
on the "xen" bus.
Check below URL for more details,
http://xenbits.xen.org/docs/4.2-testing/misc/vbd-interface.txt
Change-Id: I9fe520bc9b68d0bc7f879617f2cd27dd1029e4de
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 9ab508d..7ee1b02 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -84,10 +84,14 @@
if d['mac'] == self.net_2_200_mac:
self.assertEqual(d['tags'], ['net-2-200'])
- found_devices = [d['tags'][0] for d in md_dict['devices']]
- self.assertItemsEqual(found_devices, ['port-1', 'port-2', 'net-1',
- 'net-2-100', 'net-2-200',
- 'boot', 'other'])
+ # A hypervisor may present multiple paths to a tagged disk, so
+ # there may be duplicated tags in the metadata, use set() to
+ # remove duplicated tags.
+ found_devices = [d['tags'][0] for d in md_dict['devices']]
+ self.assertEqual(set(found_devices), set(['port-1', 'port-2',
+ 'net-1', 'net-2-100',
+ 'net-2-200', 'boot',
+ 'other']))
@decorators.idempotent_id('a2e65a6c-66f1-4442-aaa8-498c31778d96')
@test.services('network', 'volume', 'image')