Fix core2migration and tests for new devices API

QubesOS/qubes-issues#2257
This commit is contained in:
Marek Marczykowski-Górecki 2016-09-04 20:55:07 +02:00
parent e536bcca30
commit 11191ea694
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 4 deletions

View File

@ -187,12 +187,12 @@ class Core2Qubes(qubes.Qubes):
services = ast.literal_eval(services) services = ast.literal_eval(services)
else: else:
services = {} services = {}
for service, value in services.iteritems(): for service, value in services.items():
feature = service feature = service
for repl_feature, repl_service in \ for repl_feature, repl_service in \
qubes.ext.r3compatibility.\ qubes.ext.r3compatibility.\
R3Compatibility.features_to_services.\ R3Compatibility.features_to_services.\
iteritems(): items():
if repl_service == service: if repl_service == service:
feature = repl_feature feature = repl_feature
vm.features[feature] = value vm.features[feature] = value
@ -205,7 +205,8 @@ class Core2Qubes(qubes.Qubes):
pcidevs = ast.literal_eval(pcidevs) pcidevs = ast.literal_eval(pcidevs)
for pcidev in pcidevs: for pcidev in pcidevs:
try: try:
vm.devices["pci"].attach(pcidev) vm.devices["pci"].attach(
self.domains[0].devices['pci'][pcidev])
except qubes.exc.QubesException as e: except qubes.exc.QubesException as e:
self.log.error("VM {}: {}".format(vm.name, str(e))) self.log.error("VM {}: {}".format(vm.name, str(e)))
except (ValueError, LookupError) as err: except (ValueError, LookupError) as err:

View File

@ -67,7 +67,7 @@ class TC_00_Backup(qubes.tests.BackupTestsMixin, qubes.tests.QubesTestCase):
self.assertEquals(orig_value, restored_value, self.assertEquals(orig_value, restored_value,
"VM {} - property {} not properly restored".format( "VM {} - property {} not properly restored".format(
vm.name, prop)) vm.name, prop))
for dev_class in ["pci", "usb"]: for dev_class in vm.devices.keys():
for dev in vm.devices[dev_class]: for dev in vm.devices[dev_class]:
self.assertIn(dev, restored_vm.devices[dev_class]) self.assertIn(dev, restored_vm.devices[dev_class])