Skip to content

Commit

Permalink
storage: fallback kernels_dir path if there is no 'kernel' volume
Browse files Browse the repository at this point in the history
Return meaningful value for kernels_dir if VM has no 'kernel' volume.
Right now it's mostly useful for tests, but could be also used for new
VM classes which doesn't have modules.img, but still use dom0-provided
kernel.
  • Loading branch information
marmarek committed Feb 27, 2019
1 parent 723b33a commit e110cbe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions qubes/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,14 @@ def kernels_dir(self):
If :py:attr:`self.vm.kernel` is :py:obj:`None`, the this points inside
:py:attr:`self.vm.dir_path`
'''
assert 'kernel' in self.vm.volumes, "VM has no kernel volume"
return self.vm.volumes['kernel'].kernels_dir
if not self.vm.kernel:
return None
if 'kernel' in self.vm.volumes:
return self.vm.volumes['kernel'].kernels_dir
return os.path.join(
qubes.config.qubes_base_dir,
qubes.config.system_path['qubes_kernels_base_dir'],
self.vm.kernel)

def get_disk_utilization(self):
''' Returns summed up disk utilization for all domain volumes '''
Expand Down

0 comments on commit e110cbe

Please sign in to comment.