[pve-devel] [PATCH qemu-server] fix #2043: vm start: always stop existing systemd scopes

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 5 09:40:17 CET 2019


commit 3c23aa808ccc946bad92d9bc63b6f833c61d0f52 tried to fix a issue
where after a stop mode backup a scope could still linger around, but
it actually removed the wrong check. If we want to remove a
lingering, not yet cleaned up, scope we need to check if said scope
exists not if a VM process is still running. While they are corelated
the scope will always get cleaned up _after_ it's processes are gone.

Should fix #2043, but as this is seemingly not that easy to fix one
for all I'll put the should as disclaimer here.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 4a903a6..6dc68a4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5204,7 +5204,7 @@ sub vm_start {
 
 	PVE::Storage::activate_volumes($storecfg, $vollist);
 
-	if (!check_running($vmid, 1)) {
+	if (-d "/sys/fs/cgroup/systemd/qemu.slice/$vmid.scope") {
 	    eval {
 		run_command(['/bin/systemctl', 'stop', "$vmid.scope"],
 		    outfunc => sub {}, errfunc => sub {});
-- 
2.20.1




More information about the pve-devel mailing list