]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuServer.pm
Fix #1717: delete snapshot when vm running and drive not attached
[qemu-server.git] / PVE / QemuServer.pm
index 7357e3892abd9d7f41e4d67ff7dfb6fc61b4202a..a4ab11e2ec9d78349986c9e45230b9e7c4e74405 100644 (file)
@@ -4197,6 +4197,16 @@ sub qemu_volume_snapshot_delete {
 
     my $running = check_running($vmid);
 
+    if($running) {
+
+       $running = undef;
+       my $conf = PVE::QemuConfig->load_config($vmid);
+       foreach_drive($conf, sub {
+           my ($ds, $drive) = @_;
+           $running = 1 if $drive->{file} eq $volid;
+       });
+    }
+
     if ($running && do_snapshots_with_qemu($storecfg, $volid)){
        vm_mon_cmd($vmid, "delete-drive-snapshot", device => $deviceid, name => $snap);
     } else {