]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #947: reenable disk/cdrom passthrough
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 21 Apr 2016 09:40:24 +0000 (11:40 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 21 Apr 2016 09:54:55 +0000 (11:54 +0200)
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>
PVE/QemuServer.pm
changelog.Debian

index 189d760b7158dd05f641c2af7eaccc25f436f137..cd53978cd4cd2f7b4022399d01f3163369631ea6 100644 (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.",
index 2d93b7856e37a54d93ac6e72fd01790ed305b262..8e7c95e4dd622472f4938f320863528d7a3b64fc 100644 (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