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.bek...@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

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to