vm: init vm.storage and vm.volumes in BaseVM

This way also AdminVM will have (empty) properties there. It is much
cleaner than adding `if hasattr` or catching AttributeError everywhere.
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-13 13:17:09 +02:00
parent 160ab964bc
commit 5209bc370d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 6 additions and 2 deletions

View File

@ -283,6 +283,12 @@ class BaseVM(qubes.PropertyHolder):
#: 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()

View File

@ -631,8 +631,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
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 = {}