This mirrors the behavior of qemu VMs, if the container is not
running, return an error when trying to launch the spiceproxy
API call.

Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com>
---
 src/PVE/API2/LXC.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 14b5d3d..35f2c24 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -734,6 +734,9 @@ __PACKAGE__->register_method ({
        my $permissions = 'VM.Console';
 
        my $conf = PVE::LXC::load_config($vmid);
+
+       die "CT $vmid not running\n" if !PVE::LXC::check_running($vmid);
+
        my $concmd = PVE::LXC::get_console_command($vmid, $conf);
 
        my $shcmd = ['/usr/bin/dtach', '-A',
-- 
2.1.4

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

Reply via email to