From 73c38d8d1cdee300667cbb6820e2ba5100cc9006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 13 Dec 2013 22:47:20 +0100 Subject: [PATCH] hvm: propagate qrexec/guiagent setting from template Do it only in one way - i.e. support the situation where template doesn't have tools installed, but child VM does. --- core-modules/01QubesHVm.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/core-modules/01QubesHVm.py b/core-modules/01QubesHVm.py index 924aac4b..8cf1f241 100644 --- a/core-modules/01QubesHVm.py +++ b/core-modules/01QubesHVm.py @@ -60,8 +60,12 @@ class QubesHVm(QubesVm): attrs['drive'] = { 'save': 'str(self.drive)' } attrs['maxmem'].pop('save') attrs['timezone'] = { 'default': 'localtime', 'save': 'str(self.timezone)' } - attrs['qrexec_installed'] = { 'default': False, 'save': 'str(self.qrexec_installed)' } - attrs['guiagent_installed'] = { 'default' : False, 'save': 'str(self.guiagent_installed)' } + attrs['qrexec_installed'] = { 'default': False, + 'attr': '_qrexec_installed', + 'save': 'str(self._qrexec_installed)' } + attrs['guiagent_installed'] = { 'default' : False, + 'attr': '_guiagent_installed', + 'save': 'str(self._guiagent_installed)' } attrs['_start_guid_first']['eval'] = 'True' attrs['services']['default'] = "{'meminfo-writer': False}" @@ -110,6 +114,28 @@ class QubesHVm(QubesVm): attrs += [ 'guiagent_installed' ] return attrs + @property + def qrexec_installed(self): + return self._qrexec_installed or \ + bool(self.template and self.template.qrexec_installed) + + @qrexec_installed.setter + def qrexec_installed(self, value): + if self.template and self.template.qrexec_installed and not value: + print >>sys.stderr, "WARNING: When qrexec_installed set in template, it will be propagated to the VM" + self._qrexec_installed = value + + @property + def guiagent_installed(self): + return self._guiagent_installed or \ + bool(self.template and self.template.guiagent_installed) + + @guiagent_installed.setter + def guiagent_installed(self, value): + if self.template and self.template.guiagent_installed and not value: + print >>sys.stderr, "WARNING: When guiagent_installed set in template, it will be propagated to the VM" + self._guiagent_installed = value + def create_on_disk(self, verbose, source_template = None): if dry_run: return