From ffa42b860d6f605db1368a64d35ceb44aca34d5c Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 21 Apr 2016 11:40:24 +0200 Subject: [PATCH] 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 --- PVE/QemuServer.pm | 12 ++++++++---- changelog.Debian | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 189d760..cd53978 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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.", diff --git a/changelog.Debian b/changelog.Debian index 2d93b78..8e7c95e 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -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 Thu, 21 Apr 2016 10:34:42 +0200 qemu-server (4.0-70) unstable; urgency=medium -- 2.39.2