Martin Polednik has uploaded a new change for review.
Change subject: hostdev: add tests for guest addressing
......................................................................
hostdev: add tests for guest addressing
PCI host devices have two addresses: first one of them being the address
as seen on the host, the second one is how the device is seen in the
guest. We have to make sure that these aren't mixed - these tests are
here to catch possible address inconsistence.
Change-Id: I7bd20e1a2cb9846b5dc6d35315a89855b63a6ff4
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M tests/hostdevTests.py
1 file changed, 23 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/43093/1
diff --git a/tests/hostdevTests.py b/tests/hostdevTests.py
index 23048bc..4e198a7 100644
--- a/tests/hostdevTests.py
+++ b/tests/hostdevTests.py
@@ -47,6 +47,7 @@
<address bus="0" domain="0"
function="0" slot="2"
type="pci"/>
</source>
+ %s
</hostdev>
''',
'pci_0000_00_19_0':
@@ -56,6 +57,7 @@
<address bus="0" domain="0"
function="0" slot="25"
type="pci"/>
</source>
+ %s
</hostdev>
''',
'pci_0000_00_1a_0':
@@ -65,6 +67,7 @@
<address bus="0" domain="0"
function="0" slot="26"
type="pci"/>
</source>
+ %s
</hostdev>
''',
'pci_0000_00_1b_0':
@@ -74,6 +77,7 @@
<address bus="0" domain="0"
function="0" slot="27"
type="pci"/>
</source>
+ %s
</hostdev>
''',
'pci_0000_00_1f_2':
@@ -83,6 +87,7 @@
<address bus="0" domain="0"
function="2" slot="31"
type="pci"/>
</source>
+ %s
</hostdev>
''',
'usb_1_1':
@@ -91,6 +96,7 @@
<source>
<address bus="1" device="2"
type="usb"/>
</source>
+ %s
</hostdev>
''',
'usb_1_1_4':
@@ -99,6 +105,7 @@
<source>
<address bus="1" device="10"
type="usb"/>
</source>
+ %s
</hostdev>
''',
'usb_usb1':
@@ -107,6 +114,7 @@
<source>
<address bus="1" device="1"
type="usb"/>
</source>
+ %s
</hostdev>
'''}
@@ -369,4 +377,18 @@
def testCreateHostDevice(self, device_name):
dev_spec = {'type': 'hostdev', 'device': device_name}
device = hostdevice.HostDevice(self.conf, self.log, **dev_spec)
- self.assertXMLEqual(device.getXML().toxml(), _DEVICE_XML[device_name])
+ self.assertXMLEqual(device.getXML().toxml(),
+ _DEVICE_XML[device_name] % ('',))
+
+ @permutations(map(lambda device_name: [device_name],
+ _PCI_DEVICES))
+ def testCreatePCIHostDeviceWithAddress(self, device_name):
+ dev_spec = {'type': 'hostdev', 'device': device_name,
'address':
+ {'slot': '0x02', 'bus': '0x01',
'domain': '0x0000',
+ 'function': '0x0', 'type': 'pci'}}
+ device = hostdevice.HostDevice(self.conf, self.log, **dev_spec)
+ self.assertXMLEqual(
+ device.getXML().toxml(),
+ _DEVICE_XML[device_name] %
+ ('<address bus="0x01" domain="0x0000"
function="0x0" slot="0x02" \
+ type="pci"/>'))
--
To view, visit
https://gerrit.ovirt.org/43093
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bd20e1a2cb9846b5dc6d35315a89855b63a6ff4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>