]> git.proxmox.com Git - qemu-server.git/commitdiff
fix CD eject
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Feb 2012 09:49:37 +0000 (10:49 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Feb 2012 09:49:37 +0000 (10:49 +0100)
PVE/API2/Qemu.pm

index e709396db362267fc2e96112311a74212491a78c..b7ef2190ddc5ceae99b07b20f8295f7fc7f541fb 100644 (file)
@@ -65,7 +65,9 @@ my $check_storage_access = sub {
 
        my $volid = $drive->{file};
 
-       if (!$isCDROM && ($volid =~ m/^(([^:\s]+):)?(\d+(\.\d+)?)$/)) {
+       if (!$volid || $volid eq 'none') {
+           # nothing to check
+       } elsif (!$isCDROM && ($volid =~ m/^(([^:\s]+):)?(\d+(\.\d+)?)$/)) {
            my ($storeid, $size) = ($2 || $default_storage, $3);
            die "no storage ID specified (and no default storage)\n" if !$storeid;
            $rpcenv->check_storage_perm($authuser, $vmid, $pool, $storeid, [ 'Datastore.AllocateSpace' ]);
@@ -89,7 +91,9 @@ my $create_disks = sub {
 
        my $volid = $disk->{file};
 
-       if ($volid =~ m/^(([^:\s]+):)?(\d+(\.\d+)?)$/) {
+       if (!$volid || $volid eq 'none') {
+           $res->{$ds} = $settings->{$ds};
+       } elsif ($volid =~ m/^(([^:\s]+):)?(\d+(\.\d+)?)$/) {
            my ($storeid, $size) = ($2 || $default_storage, $3);
            die "no storage ID specified (and no default storage)\n" if !$storeid;
            my $defformat = PVE::Storage::storage_default_format($storecfg, $storeid);
@@ -103,7 +107,7 @@ my $create_disks = sub {
        } else {
            my $path = &$check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid, $pool);
            die "image '$path' does not exists\n" if (!(-f $path || -b $path));
-           $res->{$ds} = $settings->{ds};
+           $res->{$ds} = $settings->{$ds};
        }
     });