Skip to content

Commit

Permalink
vm: init vm.storage and vm.volumes in BaseVM
Browse files Browse the repository at this point in the history
This way also AdminVM will have (empty) properties there. It is much
cleaner than adding `if hasattr` or catching AttributeError everywhere.
  • Loading branch information
marmarek committed Jun 14, 2017
1 parent 160ab96 commit 5209bc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions qubes/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ def __init__(self, app, xml, features=None, devices=None, tags=None,
#: logger instance for logging messages related to this VM
self.log = None

#: storage volumes
self.volumes = {}

#: storage manager
self.storage = None

if hasattr(self, 'name'):
self.init_log()

Expand Down
2 changes: 0 additions & 2 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,6 @@ def conf_file(self):

def __init__(self, app, xml, volume_config=None, **kwargs):
super(QubesVM, self).__init__(app, xml, **kwargs)
self.volumes = {}
self.storage = None

if volume_config is None:
volume_config = {}
Expand Down

0 comments on commit 5209bc3

Please sign in to comment.