X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FQemuConfig.pm;h=692bba88722b7cad5d3a11d5a87f38ab3b44ed5e;hb=3a8deb551f2c7648865437961b3593d11bf0591b;hp=3ce95ac86b5cc4de7d5e17cff7ad829326575aa3;hpb=1ef7592f1e61ef9793ce09f6b8d1d22cff56e913;p=qemu-server.git diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm index 3ce95ac..692bba8 100644 --- a/PVE/QemuConfig.pm +++ b/PVE/QemuConfig.pm @@ -137,10 +137,13 @@ sub __snapshot_create_vol_snapshots_hook { my ($class, $vmid, $snap, $running, $hook) = @_; if ($running) { + my $storecfg = PVE::Storage::config(); + if ($hook eq "before") { if ($snap->{vmstate}) { - my $storecfg = PVE::Storage::config(); my $path = PVE::Storage::path($storecfg, $snap->{vmstate}); + PVE::Storage::activate_volumes($storecfg, [$snap->{vmstate}]); + PVE::QemuServer::vm_mon_cmd($vmid, "savevm-start", statefile => $path); for(;;) { my $stat = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "query-savevm"); @@ -159,7 +162,10 @@ sub __snapshot_create_vol_snapshots_hook { PVE::QemuServer::vm_mon_cmd($vmid, "savevm-start"); } } elsif ($hook eq "after") { - eval { PVE::QemuServer::vm_mon_cmd($vmid, "savevm-end") }; + eval { + PVE::QemuServer::vm_mon_cmd($vmid, "savevm-end"); + PVE::Storage::deactivate_volumes($storecfg, [$snap->{vmstate}]) if $snap->{vmstate}; + }; warn $@ if $@; } elsif ($hook eq "after-freeze") { # savevm-end is async, we need to wait