[pve-devel] [RFC qemu-server] If a VM is offline, catch the netcat timeout with a user friendly message
Emmanuel Kasper
e.kasper at proxmox.com
Wed Nov 30 10:19:52 CET 2016
This error message replaces the error:
TASK ERROR: command '/bin/nc6 -l -p 5900 -w 10 -e '/usr/bin/ssh -T -o BatchMode=yes 192.168.16.75 /usr/sbin/qm vncproxy 401 2>/dev/null'' failed: exit code 1
as seen in the task list.
It is not currently possible to test if a VM is running or not for the whole cluster
wide, so we just improve the error message.
---
PVE/API2/Qemu.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 902f028..ce83482 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1411,8 +1411,8 @@ __PACKAGE__->register_method({
# also redirect stderr (else we get RFB protocol errors)
$cmd = ['/bin/nc6', '-l', '-p', $port, '-w', $timeout, '-e', "$qmstr 2>/dev/null"];
}
-
- PVE::Tools::run_command($cmd);
+ # catch netcat timeout when the VM is not running
+ PVE::Tools::run_command($cmd, errmsg => "Is VM $vmid running ? Unable to open a console");
return;
};
--
2.1.4
More information about the pve-devel
mailing list