5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

drive schema: allow 'none' again

This commit is contained in:
Wolfgang Bumiller 2016-03-30 12:20:09 +02:00 committed by Dietmar Maurer
parent bb9207e0e1
commit 822c8a0776

View File

@ -516,13 +516,26 @@ for (my $i = 0; $i < $MAX_NETS; $i++) {
$confdesc->{"net$i"} = $netdesc;
}
PVE::JSONSchema::register_format('pve-volume-id-or-none', \&verify_volume_id_or_none);
sub verify_volume_id_or_none {
my ($volid, $noerr) = @_;
return $volid if $volid eq 'none';
$volid = eval { PVE::JSONSchema::check_format('pve-volume-id', $volid, '') };
if ($@) {
return undef if $noerr;
die $@;
}
return $volid;
}
my $drivename_hash;
my %drivedesc_base = (
volume => { alias => 'file' },
file => {
type => 'string',
format => 'pve-volume-id',
format => 'pve-volume-id-or-none',
default_key => 1,
format_description => 'volume',
description => "The drive's backing volume.",