[pve-devel] [PATCH 2/6] qemu_deviceadd : convert to qmp

Alexandre Derumier aderumier at odiso.com
Tue Feb 19 10:22:07 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6b0ccfc..4bdca11 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2620,13 +2620,11 @@ sub vm_deviceunplug {
 sub qemu_deviceadd {
     my ($vmid, $devicefull) = @_;
 
-    my $ret = vm_human_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
-    return 1 if $ret eq "";
-    syslog("err", "error on hotplug device : $ret");
-    return undef;
+    $devicefull = "driver=".$devicefull;
+    my %options =  split(/[=,]/, $devicefull);
 
+    vm_mon_cmd($vmid, "device_add" , %options);
+    return 1;
 }
 
 sub qemu_devicedel {
-- 
1.7.10.4




More information about the pve-devel mailing list