[pve-devel] [PATCH] qmp drive_add : remove backslashes from $drive string

Dietmar Maurer dietmar at proxmox.com
Mon Mar 2 07:08:14 CET 2015


Hi Alexandre,

I wonder if it works with standard shell quotin? Please can you test?


diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6ca95bc..74ed9eb 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3393,8 +3393,8 @@ sub qemu_objectdel {
 sub qemu_driveadd {
     my ($storecfg, $vmid, $device) = @_;
 
-    my $drive = print_drive_full($storecfg, $vmid, $device);
-    my $ret = vm_human_monitor_command($vmid, "drive_add auto \"$drive\"");
+    my $drive = PVE::Tools::shellquote(print_drive_full($storecfg, $vmid,
$device));
+    my $ret = vm_human_monitor_command($vmid, "drive_add auto $drive");
 
     # If the command succeeds qemu prints: "OK"
     return 1 if $ret =~ m/OK/s;




More information about the pve-devel mailing list