Browse Source

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.
Marek Marczykowski-Górecki 7 years ago
parent
commit
5209bc370d
2 changed files with 6 additions and 2 deletions
  1. 6 0
      qubes/vm/__init__.py
  2. 0 2
      qubes/vm/qubesvm.py

+ 6 - 0
qubes/vm/__init__.py

@@ -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()
 

+ 0 - 2
qubes/vm/qubesvm.py

@@ -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 = {}