From f2d9d628c47f54eb1a8e8a417f5a99e7cf37a70e Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Wed, 24 Jun 2015 12:10:12 +0200 Subject: [PATCH] qubes/vm/qubesvm: Fix loading/instantiating --- qubes/vm/qubesvm.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index d5418d82..1ba0ba32 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -448,11 +448,17 @@ class QubesVM(qubes.vm.BaseVM): def __init__(self, app, xml, **kwargs): super(QubesVM, self).__init__(app, xml, **kwargs) + import qubes.vm.adminvm + #Init private attrs self._libvirt_domain = 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.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: 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: + # Force meminfo-writer disabled when VM have PCI devices 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 self.storage = qubes.storage.get_storage(self)