]> git.proxmox.com Git - qemu-server.git/commitdiff
fix CDROM hotplug
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Feb 2015 07:00:14 +0000 (08:00 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Feb 2015 07:00:14 +0000 (08:00 +0100)
PVE/QemuServer.pm

index e5c79e3b916c03da2079cd3ab27a288c63a58c29..ee8ee8b2422e49bf3ce055f9ce3b14a649e57177 100644 (file)
@@ -4062,25 +4062,23 @@ sub vmconfig_update_disk {
                    
                    return 1;
                }
+
+           } else { # cdrom
+               
+               if ($drive->{file} eq 'none') {
+                   vm_mon_cmd($vmid, "eject",force => JSON::true,device => "drive-$opt");
+               } else {
+                   my $path = get_iso_path($storecfg, $vmid, $drive->{file});
+                   vm_mon_cmd($vmid, "eject", force => JSON::true,device => "drive-$opt"); # force eject if locked
+                   vm_mon_cmd($vmid, "change", device => "drive-$opt",target => "$path") if $path;
+               }
            }
        }
     }
 
-    if (drive_is_cdrom($drive)) { # cdrom
-
-       if ($drive->{file} eq 'none') {
-           vm_mon_cmd($vmid, "eject",force => JSON::true,device => "drive-$opt");
-       } else {
-           my $path = get_iso_path($storecfg, $vmid, $drive->{file});
-           vm_mon_cmd($vmid, "eject", force => JSON::true,device => "drive-$opt"); # force eject if locked
-           vm_mon_cmd($vmid, "change", device => "drive-$opt",target => "$path") if $path;
-       }
-
-    } else { 
-       die "skip\n" if !$hotplug || $opt =~ m/(ide|sata)(\d+)/;   
-       # hotplug new disks
-       vm_deviceplug($storecfg, $conf, $vmid, $opt, $drive);
-    }
+    die "skip\n" if !$hotplug || $opt =~ m/(ide|sata)(\d+)/;   
+    # hotplug new disks
+    vm_deviceplug($storecfg, $conf, $vmid, $opt, $drive);
 }
 
 sub vm_start {