Fix initialization of storage class

Move it earlier - before first access to *_img attrs.
This commit is contained in:
Marek Marczykowski-Górecki 2013-08-02 20:31:50 +02:00
parent 7b5dd67b58
commit 396011e227

View File

@ -327,6 +327,13 @@ class QubesVm(object):
if len(self.pcidevs) > 0:
self.services['meminfo-writer'] = False
# Initialize VM image storage class
self.storage = defaults["storage_class"](self)
if hasattr(self, 'kernels_dir'):
self.storage.modules_img = os.path.join(self.kernels_dir,
"modules.img")
self.storage.modules_img_rw = self.kernel is None
# Some additional checks for template based VM
if self.template is not None:
if not self.template.is_template():
@ -337,12 +344,6 @@ class QubesVm(object):
else:
assert self.root_img is not None, "Missing root_img for standalone VM!"
self.storage = defaults["storage_class"](self)
if hasattr(self, 'kernels_dir'):
self.storage.modules_img = os.path.join(self.kernels_dir,
"modules.img")
self.storage.modules_img_rw = self.kernel is None
# fire hooks
for hook in self.hooks_init:
hook(self)