fix #947: reenable disk/cdrom passthrough

previously, we did not check the file parameter of a disk,
allowing passthrough of a block device (by design)

with the change to the json parser for the disks, the format
became 'pve-volume-id' which is only valid for our volume ids
(and later we also allowed the value 'none')

this patch alternatively checks if the parameter is a path
or 'cdrom'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-04-21 11:40:24 +02:00 committed by Dietmar Maurer
parent de7c2026f7
commit ffa42b860d
2 changed files with 10 additions and 4 deletions

View File

@ -619,11 +619,15 @@ 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 {
PVE::JSONSchema::register_format('pve-volume-id-or-qm-path', \&verify_volume_id_or_qm_path);
sub verify_volume_id_or_qm_path {
my ($volid, $noerr) = @_;
return $volid if $volid eq 'none';
if ($volid eq 'none' || $volid eq 'cdrom' || $volid =~ m|^/|) {
return $volid;
}
# if its neither 'none' nor 'cdrom' nor a path, check if its a volume-id
$volid = eval { PVE::JSONSchema::check_format('pve-volume-id', $volid, '') };
if ($@) {
return undef if $noerr;
@ -638,7 +642,7 @@ my %drivedesc_base = (
volume => { alias => 'file' },
file => {
type => 'string',
format => 'pve-volume-id-or-none',
format => 'pve-volume-id-or-qm-path',
default_key => 1,
format_description => 'volume',
description => "The drive's backing volume.",

View File

@ -2,6 +2,8 @@ qemu-server (4.0-71) unstable; urgency=medium
* Fix #643: activate volumes before resizing
* fix #947: reenable disk/cdrom passthrough
-- Proxmox Support Team <support@proxmox.com> Thu, 21 Apr 2016 10:34:42 +0200
qemu-server (4.0-70) unstable; urgency=medium