[pve-devel] [PATCH] run spiceterm and return spiceproxy config only if CT is running

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Aug 27 16:42:44 CEST 2015


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.lamprecht at 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




More information about the pve-devel mailing list