]> git.proxmox.com Git - qemu-server.git/commitdiff
add runs_at_least_qemu_version to check if we can backup IOThread disks
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Oct 2019 08:39:16 +0000 (10:39 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Oct 2019 08:47:45 +0000 (10:47 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm
PVE/VZDump/QemuServer.pm

index 455f0fe1fce34c226b15600c3bdea9fd8e2b6e53..f7212389395b3e9f7974d38377afa2d33c462f4c 100644 (file)
@@ -7203,6 +7203,15 @@ sub version_cmp {
     return 0;
 }
 
+sub runs_at_least_qemu_version {
+    my ($vmid, $major, $minor, $extra) = @_;
+
+    my $v = PVE::QemuServer::vm_qmp_command($vmid, { execute => 'query-version' });
+    $v = $v->{qemu};
+
+    return version_cmp($v->{major}, $major, $v->{minor}, $minor, $v->{micro}, $extra) >= 0;
+}
+
 sub qemu_machine_pxe {
     my ($vmid, $conf) = @_;
 
index ad96b013eb6c5403d76a21120e76c08f45539cdb..955339a21ebf890bc0c8c9ca71e4d39f27776e1d 100644 (file)
@@ -77,7 +77,10 @@ sub prepare {
            $self->loginfo("exclude disk '$ds' '$volid' (backup=no)");
            return;
        } elsif ($drive->{iothread}) {
-           die "disk '$ds' '$volid' (iothread=on) can't use backup feature currently. Please set backup=no for this drive";
+           if (!PVE::QemuServer::runs_at_least_qemu_version($vmid, 4, 0, 1)) {
+               die "disk '$ds' '$volid' (iothread=on) can't use backup feature with running QEMU " .
+                   "version < 4.0.1! Either set backup=no for this drive or upgrade QEMU and restart VM\n";
+           }
        } else {
            my $log = "include disk '$ds' '$volid'";
           if (defined $drive->{size}) {