From 09393734a3364fb5546c0db32f8bebaaffe06c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2013 07:14:52 +0100 Subject: [PATCH] core: refuse to set template for standalone VM --- core-modules/000QubesVm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 36d37c3e..b74335f6 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -95,7 +95,7 @@ class QubesVm(object): "volatile_img": { "eval": 'self.absolute_path(value, vm_files["volatile_img"])', 'order': 10 }, "firewall_conf": { "eval": 'self.absolute_path(value, vm_files["firewall_conf"])', 'order': 10 }, "installed_by_rpm": { "default": False, 'order': 10 }, - "template": { "default": None, 'order': 10 }, + "template": { "default": None, "attr": '_template', 'order': 10 }, ### order >= 20: have template set "uses_default_netvm": { "default": True, 'order': 20 }, "netvm": { "default": None, "attr": "_netvm", 'order': 20 }, @@ -475,6 +475,8 @@ class QubesVm(object): @template.setter def template(self, value): + if self._template is None and value is not None: + raise QubesException("Cannot set template for standalone VM") if value and not self.is_template_compatible(value): raise QubesException("Incompatible template type %s with VM of type %s" % (value.type, self.type)) self._template = value