From d9b8516b6d574caba68ef4516de2fd00c982d3dc Mon Sep 17 00:00:00 2001 From: Mario Geckler Date: Wed, 27 Apr 2016 12:46:05 +0200 Subject: [PATCH 1/2] Fixed #1930: Delete autostart Symlink when deleting a VM --- core-modules/000QubesVm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 227ab8ac..fbbe8b40 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1412,6 +1412,11 @@ class QubesVm(object): e.get_error_code()) raise + if os.path.exists("/etc/systemd/system/multi-user.target.wants/qubes-vm@" + self.name + ".service") == True: + retcode = subprocess.call(["sudo", "rm", "/etc/systemd/system/multi-user.target.wants/qubes-vm@" + self.name + ".service"]) + if retcode != 0: + raise QubesException("Failed to delete autostart entry for VM") + self.storage.remove_from_disk() def write_firewall_conf(self, conf): From 23ec9e92bbe5e4944e7b94f2a9a47bb265b108f5 Mon Sep 17 00:00:00 2001 From: Mario Geckler Date: Thu, 28 Apr 2016 08:30:57 +0200 Subject: [PATCH 2/2] removed unnecessary comparison with True and changed to sysctl instead of remove --- core-modules/000QubesVm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index fbbe8b40..2755a90a 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1412,8 +1412,8 @@ class QubesVm(object): e.get_error_code()) raise - if os.path.exists("/etc/systemd/system/multi-user.target.wants/qubes-vm@" + self.name + ".service") == True: - retcode = subprocess.call(["sudo", "rm", "/etc/systemd/system/multi-user.target.wants/qubes-vm@" + self.name + ".service"]) + if os.path.exists("/etc/systemd/system/multi-user.target.wants/qubes-vm@" + self.name + ".service"): + subprocess.call(["sudo", "systemctl", "-q", "disable","qubes-vm@" + self.name + ".service"]) if retcode != 0: raise QubesException("Failed to delete autostart entry for VM")