[pve-devel] [PATCH v2 qemu-server 09/28] parse_drive: Allow parsing vmstate volumes

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:43:59 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer/Drive.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm
index 35ac99d..e922392 100644
--- a/PVE/QemuServer/Drive.pm
+++ b/PVE/QemuServer/Drive.pm
@@ -378,16 +378,22 @@ sub parse_drive {
     if ($key =~ m/^([^\d]+)(\d+)$/) {
 	$interface = $1;
 	$index = $2;
+    } elsif ($key eq 'vmstate') {
+	$interface = 'vmstate';
     } else {
 	return undef;
     }
 
-    my $desc = $key =~ /^unused\d+$/ ? $alldrive_fmt
-                                     : $drivedesc_hash->{$key}->{format};
-    if (!$desc) {
+    my $desc;
+    if ($key =~ m/^unused\d+$/ || $key eq 'vmstate') {
+	$desc = $alldrive_fmt;
+    } elsif (defined($drivedesc_hash->{$key})) {
+	$desc = $drivedesc_hash->{$key}->{format};
+    } else {
 	warn "invalid drive key: $key\n";
 	return undef;
     }
+
     my $res = eval { PVE::JSONSchema::parse_property_string($desc, $data) };
     return undef if !$res;
     $res->{interface} = $interface;
-- 
2.20.1





More information about the pve-devel mailing list