From 5209bc370de7c2f0cb5d66ec2728dbc22499d187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 13 Jun 2017 13:17:09 +0200 Subject: [PATCH] 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. --- qubes/vm/__init__.py | 6 ++++++ qubes/vm/qubesvm.py | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qubes/vm/__init__.py b/qubes/vm/__init__.py index c5882bf4f..87da2485d 100644 --- a/qubes/vm/__init__.py +++ b/qubes/vm/__init__.py @@ -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() diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 176f4b635..1fbe1d3e3 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -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 = {}