[pve-devel] [PATCH] vm_start : force systemctl stop if orphan scope exist

Alexandre Derumier aderumier at odiso.com
Thu Apr 21 15:18:28 CEST 2016


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index cd53978..02a689c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4531,6 +4531,12 @@ sub vm_start {
 
 	PVE::Storage::activate_volumes($storecfg, $vollist);
 
+	if (!check_running($vmid, 1) && -d "/sys/fs/cgroup/systemd/qemu.slice/$vmid.scope") {
+	    my $cmd = [];
+	    push @$cmd, '/bin/systemctl', 'stop', "$vmid.scope";
+	    eval  { run_command($cmd); };
+	}
+
 	eval  { run_command($cmd, timeout => $statefile ? undef : 30,
 		    umask => 0077); };
 
-- 
2.1.4



More information about the pve-devel mailing list