qubes/vm/qubesvm: Fix loading/instantiating

This commit is contained in:
Wojtek Porczyk 2015-06-24 12:10:12 +02:00
parent fd0107f11a
commit f2d9d628c4

View File

@ -448,11 +448,17 @@ class QubesVM(qubes.vm.BaseVM):
def __init__(self, app, xml, **kwargs): def __init__(self, app, xml, **kwargs):
super(QubesVM, self).__init__(app, xml, **kwargs) super(QubesVM, self).__init__(app, xml, **kwargs)
import qubes.vm.adminvm
#Init private attrs #Init private attrs
self._libvirt_domain = None self._libvirt_domain = None
self._qdb_connection = None self._qdb_connection = None
if xml is not None:
return
# else: we are creating new VM and attributes came through kwargs
assert self.qid < qubes.config.max_qid, "VM id out of bounds!" assert self.qid < qubes.config.max_qid, "VM id out of bounds!"
assert self.name is not None assert self.name is not None
@ -471,13 +477,13 @@ class QubesVM(qubes.vm.BaseVM):
if not hasattr(self, 'vcpus') and not self.app.vmm.offline_mode: if not hasattr(self, 'vcpus') and not self.app.vmm.offline_mode:
self.vcpus = self.app.host.no_cpus self.vcpus = self.app.host.no_cpus
# Always set if meminfo-writer should be active or not
if 'meminfo-writer' not in self.services:
self.services['meminfo-writer'] = not len(self.devices['pci']) > 0
# Additionally force meminfo-writer disabled when VM have PCI devices
if len(self.devices['pci']) > 0: if len(self.devices['pci']) > 0:
# Force meminfo-writer disabled when VM have PCI devices
self.services['meminfo-writer'] = False self.services['meminfo-writer'] = False
elif not isinstance(self, qubes.vm.adminvm.AdminVM) \
and 'meminfo-writer' not in self.services:
# Always set if meminfo-writer should be active or not
self.services['meminfo-writer'] = True
# Initialize VM image storage class # Initialize VM image storage class
self.storage = qubes.storage.get_storage(self) self.storage = qubes.storage.get_storage(self)