[pve-devel] [PATCH qemu-server 2/2] fix a perl warning when failing to parse a new drive string

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Nov 3 08:17:15 CET 2016


---
Here the parsed drive comes from the API parameters and parse_drive returns
undef on error so we pass undef to later calls which don't expect it.

 PVE/API2/Qemu.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index ac04dff..d25a4e8 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -943,6 +943,7 @@ my $update_vm_api  = sub {
 	if (PVE::QemuServer::is_valid_drivename($opt)) {
 	    # cleanup drive path
 	    my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
+	    raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
 	    PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
 	    $param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
 	} elsif ($opt =~ m/^net(\d+)$/) {
-- 
2.1.4





More information about the pve-devel mailing list