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; $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 $drivename_hash;
my %drivedesc_base = ( my %drivedesc_base = (
volume => { alias => 'file' }, volume => { alias => 'file' },
file => { file => {
type => 'string', type => 'string',
format => 'pve-volume-id', format => 'pve-volume-id-or-none',
default_key => 1, default_key => 1,
format_description => 'volume', format_description => 'volume',
description => "The drive's backing volume.", description => "The drive's backing volume.",