Fix tests broken by the new assignment api

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2017-04-15 18:00:46 +02:00
parent 827ca283f3
commit b1b005964f
No known key found for this signature in database
GPG Key ID: 07799AE179ED4FD4
2 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,7 @@ import xml.parsers.expat
import lxml.etree
import qubes
import qubes.devices
import qubes.vm.appvm
import qubes.vm.standalonevm
import qubes.vm.templatevm
@ -219,8 +220,9 @@ class Core2Qubes(qubes.Qubes):
pcidevs = ast.literal_eval(pcidevs)
for pcidev in pcidevs:
try:
vm.devices["pci"].attach(
self.domains[0].devices['pci'][pcidev])
dev = self.domains[0].devices['pci'][pcidev]
assignment = qubes.devices.DeviceAssignment(backend_domain=dev.backend_domain, ident=dev.ident)
vm.devices["pci"].attach(assignment)
except qubes.exc.QubesException as e:
self.log.error("VM {}: {}".format(vm.name, str(e)))
except (ValueError, LookupError) as err:

View File

@ -108,7 +108,7 @@ class TC_10_BaseVM(qubes.tests.QubesTestCase):
})
self.assertCountEqual(vm.devices.keys(), ('pci',))
self.assertCountEqual(list(vm.devices['pci'].attached(persistent=True)),
self.assertCountEqual(list(vm.devices['pci'].persistent()),
[qubes.ext.pci.PCIDevice(vm, '00:11.22')])
self.assertXMLIsValid(vm.__xml__(), 'domain.rng')