mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-23 11:02:12 +00:00
Fix #1174: remove pve-qm-drive
Let 'cdrom' use the pve-qm-ide format, as it's supposed to be an alias to ide2. We're not using the 'alias' schema property since the qemu configs still use a custom parser (due to the pending-changes system and the filename-to-volume-id conversion for legacy support) which does not deal with schema aliases.
This commit is contained in:
parent
94a17e1dea
commit
b799312f2f
@ -452,7 +452,7 @@ EODESCR
|
|||||||
},
|
},
|
||||||
cdrom => {
|
cdrom => {
|
||||||
optional => 1,
|
optional => 1,
|
||||||
type => 'string', format => 'pve-qm-drive',
|
type => 'string', format => 'pve-qm-ide',
|
||||||
typetext => 'volume',
|
typetext => 'volume',
|
||||||
description => "This is an alias for option -ide2",
|
description => "This is an alias for option -ide2",
|
||||||
},
|
},
|
||||||
@ -854,6 +854,7 @@ my $ide_fmt = {
|
|||||||
%rerror_fmt,
|
%rerror_fmt,
|
||||||
%model_fmt,
|
%model_fmt,
|
||||||
};
|
};
|
||||||
|
PVE::JSONSchema::register_format("pve-qm-ide", $ide_fmt);
|
||||||
|
|
||||||
my $idedesc = {
|
my $idedesc = {
|
||||||
optional => 1,
|
optional => 1,
|
||||||
@ -2013,12 +2014,6 @@ sub check_type {
|
|||||||
die "type check ('number') failed - got '$value'\n";
|
die "type check ('number') failed - got '$value'\n";
|
||||||
} elsif ($type eq 'string') {
|
} elsif ($type eq 'string') {
|
||||||
if (my $fmt = $confdesc->{$key}->{format}) {
|
if (my $fmt = $confdesc->{$key}->{format}) {
|
||||||
if ($fmt eq 'pve-qm-drive') {
|
|
||||||
# special case - we need to pass $key to parse_drive()
|
|
||||||
my $drive = parse_drive($key, $value);
|
|
||||||
return $value if $drive;
|
|
||||||
die "unable to parse drive options\n";
|
|
||||||
}
|
|
||||||
PVE::JSONSchema::check_format($fmt, $value);
|
PVE::JSONSchema::check_format($fmt, $value);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
@ -2166,8 +2161,9 @@ sub parse_vm_config {
|
|||||||
if ($@) {
|
if ($@) {
|
||||||
warn "vm $vmid - unable to parse value of '$key' - $@";
|
warn "vm $vmid - unable to parse value of '$key' - $@";
|
||||||
} else {
|
} else {
|
||||||
|
$key = 'ide2' if $key eq 'cdrom';
|
||||||
my $fmt = $confdesc->{$key}->{format};
|
my $fmt = $confdesc->{$key}->{format};
|
||||||
if ($fmt && $fmt eq 'pve-qm-drive') {
|
if ($fmt && $fmt =~ /^pve-qm-(?:ide|scsi|virtio|sata)$/) {
|
||||||
my $v = parse_drive($key, $value);
|
my $v = parse_drive($key, $value);
|
||||||
if (my $volid = filename_to_volume_id($vmid, $v->{file}, $v->{media})) {
|
if (my $volid = filename_to_volume_id($vmid, $v->{file}, $v->{media})) {
|
||||||
$v->{file} = $volid;
|
$v->{file} = $volid;
|
||||||
@ -2178,11 +2174,7 @@ sub parse_vm_config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key eq 'cdrom') {
|
$conf->{$key} = $value;
|
||||||
$conf->{ide2} = $value;
|
|
||||||
} else {
|
|
||||||
$conf->{$key} = $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user