]> git.proxmox.com Git - qemu-server.git/commitdiff
use qemu's blockdev-snapshot functions
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 24 Sep 2018 08:44:22 +0000 (10:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 24 Sep 2018 09:12:34 +0000 (11:12 +0200)
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 <w.bumiller@proxmox.com>
PVE/QMPClient.pm
PVE/QemuServer.pm

index 2277fef398b2df6f73f5aa6fb3932e9493fbf98b..6be4a41300c189d9ec29647011da3d796cfb35a9 100755 (executable)
@@ -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 '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 {
                 $cmd->{execute} eq 'snapshot-drive'  ) {
            $timeout = 10*60; # 10 mins ?
        } else {
index b60be59ec2364ccf05f0f15b43ec76789b794070..cf84255cfc9631c124841228062d9df277c2aa17 100644 (file)
@@ -4288,7 +4288,7 @@ sub qemu_volume_snapshot {
     my $running = check_running($vmid);
 
     if ($running && do_snapshots_with_qemu($storecfg, $volid)){
     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);
     }
     } 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)){
     }
 
     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);
     }
     } else {
        PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap, $running);
     }