[pve-devel] [PATCH qemu-server] fix #2578: check if $target is provided in clone

Oguz Bektas o.bektas at proxmox.com
Mon Feb 3 16:23:55 CET 2020


regression introduced with commit a85ff91b

previously we set $target to undef if it's localnode or localhost, then
we check if node exists.

with regression commit, behaviour changes as we do the node check in
else, but $target may be undef. this causes an error:

    no such cluster node ''

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 PVE/API2/Qemu.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index e15c0c3..fe68e87 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2749,10 +2749,12 @@ __PACKAGE__->register_method({
 
         my $localnode = PVE::INotify::nodename();
 
-        if ($target && ($target eq $localnode || $target eq 'localhost')) {
-	    undef $target;
-	} else {
-	    PVE::Cluster::check_node_exists($target);
+	if ($target) {
+	    if ($target eq $localnode || $target eq 'localhost') {
+		undef $target;
+	    } else {
+		PVE::Cluster::check_node_exists($target);
+	    }
 	}
 
 	my $storecfg = PVE::Storage::config();
-- 
2.20.1




More information about the pve-devel mailing list