diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index ccf56a4f..1cc8d212 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -376,8 +376,13 @@ class QubesVm(object): def absolute_path(self, arg, default): if arg is not None and os.path.isabs(arg): return arg - else: + elif self.dir_path is not None: return os.path.join(self.dir_path, (arg if arg is not None else default)) + else: + # cannot provide any meaningful value without dir_path; this is + # only to import some older format of `qubes.xml` (for example + # during migration from older release) + return None def _absolute_path_gen(self, default): return lambda value: self.absolute_path(value, default) diff --git a/core/storage/__init__.py b/core/storage/__init__.py index 41f3e73f..3a12dbe6 100644 --- a/core/storage/__init__.py +++ b/core/storage/__init__.py @@ -55,12 +55,12 @@ class QubesVmStorage(object): else: self.root_img_size = defaults['root_img_size'] - self.private_img = os.path.join(self.vmdir, vm_files["private_img"]) + self.private_img = vm.absolute_path(vm_files["private_img"], None) if self.vm.template: self.root_img = self.vm.template.root_img else: - self.root_img = os.path.join(self.vmdir, vm_files["root_img"]) - self.volatile_img = os.path.join(self.vmdir, vm_files["volatile_img"]) + self.root_img = vm.absolute_path(vm_files["root_img"], None) + self.volatile_img = vm.absolute_path(vm_files["volatile_img"], None) # For now compute this path still in QubesVm self.modules_img = modules_img