[pve-devel] [PATCH 3/8] remove code from vm_deviceplug / vm_deviceunplug

Derumier Alexandre aderumier at odiso.com
Fri Dec 23 08:09:43 CET 2011


Signed-off-by: Derumier Alexandre <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   49 -------------------------------------------------
 1 files changed, 0 insertions(+), 49 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 48edfe0..684701c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2282,29 +2282,6 @@ sub vm_deviceplug {
     my ($storecfg, $conf, $vmid, $deviceid, $device) = @_;
     return if !check_running($vmid) || !$conf->{hotplug} || $conf->{$deviceid};
     
-    if($deviceid =~ m/^(virtio)(\d+)$/) {
-
-        my $drive = print_drive_full($storecfg, $vmid, $device);
-        my $ret = vm_monitor_command($vmid, "drive_add auto $drive");
-        # If the command succeeds qemu prints: "OK"
-        if ($ret !~ m/OK/s) {
-           die "adding drive failed: $ret";
-        }
-       
-        my $devicefull = print_drivedevice_full($storecfg, $vmid, $device);
-        $ret = vm_monitor_command($vmid, "device_add $devicefull");
-        $ret =~ s/^\s+//;
-        # Otherwise, if the command succeeds, no output is sent. So any non-empty string shows an error 
-        die 'error on hotplug device : $ret' if $ret ne "";
-    }
-
-    for (my $i = 0; $i <= 5; $i++) {
-        my $devices_list = vm_devices_list($vmid);
-        return if defined($devices_list->{$deviceid});   
-        sleep 1;
-    }
-	
-    die "error on hotplug device $deviceid";
 }
 
 sub vm_deviceunplug {
@@ -2314,32 +2291,6 @@ sub vm_deviceunplug {
 
     die "can't unplug bootdisk" if $conf->{bootdisk} eq $deviceid;
 
-    if($deviceid =~ m/^(virtio)(\d+)$/){
-
-        my $ret = vm_monitor_command($vmid, "drive_del drive-$deviceid");
-        $ret =~ s/^\s+//;
-        if ($ret =~ m/Device \'.*?\' not found/s) {
-            # NB: device not found errors mean the drive was auto-deleted and we ignore the error 
-        }
-        elsif ($ret ne "") {
-            die "deleting drive $deviceid failed : $ret";
-        }
-
-        $ret = vm_monitor_command($vmid, "device_del $deviceid");
-        $ret =~ s/^\s+//;
-        die 'detaching device $deviceid failed : $ret' if $ret ne "";
-
-    }
-
-    #need to verify the device is correctly remove as device_del is async and empty return is not reliable
-    for (my $i = 0; $i <= 5; $i++) {
-        my $devices_list = vm_devices_list($vmid);
-        return if !defined($devices_list->{$deviceid});
-        sleep 1;
-    }
-    die "error on hot-plugging device $deviceid";
-
-
 }
 
 sub vm_start {
-- 
1.7.2.5




More information about the pve-devel mailing list