]> git.proxmox.com Git - qemu-server.git/commitdiff
Change format for unused drives
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 12 Mar 2020 10:19:12 +0000 (11:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 16 Mar 2020 12:30:50 +0000 (13:30 +0100)
and make it match with what parse_drive does. Even though the 'real' format
was pve-volume-id, callers already expected that parse_drive returns a hash
with a valid 'file' key (e.g. PVE/API2/Qemu.pm:1147ff).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/QemuServer/Drive.pm

index e927abf1c79419757c8d6e550c2ae694c6e070af..d4121473917fc76c429716bbdcfdc3ad9b3a31a8 100644 (file)
@@ -355,9 +355,20 @@ for (my $i = 0; $i < $MAX_VIRTIO_DISKS; $i++)  {
 
 $drivedesc_hash->{efidisk0} = $efidisk_desc;
 
+my $unused_fmt = {
+    volume => { alias => 'file' },
+    file => {
+       type => 'string',
+       format => 'pve-volume-id',
+       default_key => 1,
+       format_description => 'volume',
+       description => "The drive's backing volume.",
+    },
+};
+
 our $unuseddesc = {
     optional => 1,
-    type => 'string', format => 'pve-volume-id',
+    type => 'string', format => $unused_fmt,
     description => "Reference to unused volumes. This is used internally, and should not be modified manually.",
 };
 
@@ -418,7 +429,7 @@ sub parse_drive {
        return undef;
     }
 
-    my $desc = $key =~ /^unused\d+$/ ? $alldrive_fmt
+    my $desc = $key =~ /^unused\d+$/ ? $unuseddesc->{format}
                                      : $drivedesc_hash->{$key}->{format};
     if (!$desc) {
        warn "invalid drive key: $key\n";