def testCreatePCIHostDeviceWithAddress(self, device_name): dev_spec = {'type': 'hostdev', 'device': device_name, 'address': self._PCI_ADDRESS} device = hostdevice.HostDevice(self.conf, self.log, **dev_spec) self.assertXMLEqual( device.getXML().toxml(), _DEVICE_XML[device_name] % (self._PCI_ADDRESS_XML))
def testNumaTuneXMLMultiNode(self): domxml = vmxml.Domain(self.conf, self.log, cpuarch.X86_64) devices = [ hostdevice.HostDevice(self.conf, self.log, **{ 'type': 'hostdev', 'device': device }) for device in [_SRIOV_PF, _SRIOV_VF, 'pci_0000_00_02_0'] ] domxml.appendHostdevNumaTune(devices) xml = vmxml.format_xml(domxml.dom) self.assertRaises(AssertionError, lambda: find_xml_element(xml, './numatune'))
def testNumaTuneXMLSingleNode(self, devices, numa_node): numatuneXML = """ <numatune> <memory mode="preferred" nodeset="{}" /> </numatune> """.format(numa_node) domxml = vmxml.Domain(self.conf, self.log, cpuarch.X86_64) devices = [ hostdevice.HostDevice(self.conf, self.log, **{ 'type': 'hostdev', 'device': device }) for device in devices ] domxml.appendHostdevNumaTune(devices) xml = vmxml.format_xml(domxml.dom) self.assertXMLEqual(find_xml_element(xml, './numatune'), numatuneXML)
def testCreateHostDevice(self, device_name): dev_spec = {'type': 'hostdev', 'device': device_name} device = hostdevice.HostDevice(self.conf, self.log, **dev_spec) self.assertXMLEqual(vmxml.format_xml(device.getXML()), _DEVICE_XML[device_name] % ('', ))