else we get:
 >
 > lxc-attach: attach.c: lxc_attach: 710 failed to get the init pid

which an arbitrary user could misunderstand.
---
 src/PVE/CLI/pct.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index b2bc361..432da39 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -92,10 +92,14 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
+       my $vmid = $param->{vmid};
+
        # test if container exists on this node
-       PVE::LXC::load_config($param->{vmid});
+       PVE::LXC::load_config($vmid);
+
+       die "Error: container '$vmid' not running!\n" if 
!PVE::LXC::check_running($vmid);
 
-       exec('lxc-attach', '-n',  $param->{vmid});
+       exec('lxc-attach', '-n',  $vmid);
     }});
 
 __PACKAGE__->register_method ({
-- 
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