From eba2b72199d5347860d4c070fbd2135f81cce8c5 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 24 Sep 2018 10:44:22 +0200 Subject: [PATCH] use qemu's blockdev-snapshot functions Instead of our own. The code is almost the same, but the upstream implementation uses qemu's transactional system and performs a drain() on the block device first. This seems to help avoid some issues we run into with qcow2 files when creating snapshots. Signed-off-by: Wolfgang Bumiller --- PVE/QMPClient.pm | 2 ++ PVE/QemuServer.pm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/QMPClient.pm b/PVE/QMPClient.pm index 2277fef3..6be4a413 100755 --- a/PVE/QMPClient.pm +++ b/PVE/QMPClient.pm @@ -126,6 +126,8 @@ sub cmd { $cmd->{execute} eq 'query-savevm' || $cmd->{execute} eq 'delete-drive-snapshot' || $cmd->{execute} eq 'guest-shutdown' || + $cmd->{execute} eq 'blockdev-snapshot-internal-sync' || + $cmd->{execute} eq 'blockdev-snapshot-delete-internal-sync' || $cmd->{execute} eq 'snapshot-drive' ) { $timeout = 10*60; # 10 mins ? } else { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b60be59e..cf84255c 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -4288,7 +4288,7 @@ sub qemu_volume_snapshot { my $running = check_running($vmid); if ($running && do_snapshots_with_qemu($storecfg, $volid)){ - vm_mon_cmd($vmid, "snapshot-drive", device => $deviceid, name => $snap); + vm_mon_cmd($vmid, 'blockdev-snapshot-internal-sync', device => $deviceid, name => $snap); } else { PVE::Storage::volume_snapshot($storecfg, $volid, $snap); } @@ -4310,7 +4310,7 @@ sub qemu_volume_snapshot_delete { } if ($running && do_snapshots_with_qemu($storecfg, $volid)){ - vm_mon_cmd($vmid, "delete-drive-snapshot", device => $deviceid, name => $snap); + vm_mon_cmd($vmid, 'blockdev-snapshot-delete-internal-sync', device => $deviceid, name => $snap); } else { PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap, $running); } -- 2.39.5