dom0/core: set *_img to None for HVM instead of removing attr
There are many places that assume existence of this attributes.
This commit is contained in:
parent
a54115f73c
commit
cec197ac8b
@ -1333,7 +1333,7 @@ class QubesVm(object):
|
||||
attrs["dir_path"] = self.dir_path
|
||||
# Simple paths
|
||||
for prop in ['conf_file', 'root_img', 'volatile_img', 'private_img']:
|
||||
if hasattr(self, prop):
|
||||
if hasattr(self, prop) and self.__getattribute__(prop) is not None:
|
||||
attrs[prop] = self.relative_path(self.__getattribute__(prop))
|
||||
# Simple string attrs
|
||||
for prop in ['memory', 'maxmem', 'pcidevs', 'vcpus', 'internal',\
|
||||
@ -2053,13 +2053,13 @@ class QubesHVm(QubesVm):
|
||||
super(QubesHVm, self).__init__(**kwargs)
|
||||
self.updateable = True
|
||||
self.config_file_template = config_template_hvm
|
||||
self.private_img = None
|
||||
self.volatile_img = None
|
||||
# remove settings not used by HVM (at least for now)
|
||||
self.__delattr__('kernel')
|
||||
self.__delattr__('kernelopts')
|
||||
self.__delattr__('uses_default_kernel')
|
||||
self.__delattr__('uses_default_kernelopts')
|
||||
self.__delattr__('private_img')
|
||||
self.__delattr__('volatile_img')
|
||||
# HVM doesn't support dynamic memory management
|
||||
self.maxmem = self.memory
|
||||
|
||||
|
@ -51,10 +51,10 @@ def do_list(vm):
|
||||
print fmt.format ("root COW img", vm.rootcow_img)
|
||||
if vm.template_vm is not None:
|
||||
print fmt.format ("root img", vm.template_vm.root_img)
|
||||
if hasattr(vm, 'volatile_img'):
|
||||
if hasattr(vm, 'volatile_img') and vm.volatile_img is not None:
|
||||
print fmt.format ("root volatile img", vm.volatile_img)
|
||||
|
||||
if hasattr(vm, 'private_img'):
|
||||
if hasattr(vm, 'private_img') and vm.private_img is not None:
|
||||
print fmt.format ("private img", vm.private_img)
|
||||
print fmt.format ("vcpus", str(vm.vcpus))
|
||||
print fmt.format ("memory", vm.memory)
|
||||
|
Loading…
Reference in New Issue
Block a user