[pve-devel] [PATCH container] fix #2086: change process checking mechanism in vmstatus

Oguz Bektas o.bektas at proxmox.com
Mon Feb 11 15:51:06 CET 2019


vmstatus checked if the container was running by looking at the pid,
which was not an indicator of the process being completely stopped, as
the command socket in /proc/net/unix stays a little while after the
process is dead according to lxc-info.

this resulted in destroy_vm and similar functions which use
/proc/net/unix command socket based checking mechanism to fail when
executed too fast after the vm_status reported the process as stopped.

this changes vm_status to use the same kind of command socket based
mechanism in order to avoid reporting the container as being stopped too
early.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/LXC.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 8f560c5..0e584f6 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -186,7 +186,7 @@ sub vmstatus {
 	eval { $d->{pid} = find_lxc_pid($vmid) if defined($active_hash->{$vmid}); };
 	warn $@ if $@; # ignore errors (consider them stopped)
 
-	$d->{status} = $d->{pid} ? 'running' : 'stopped';
+	$d->{status} = $active_hash->{$vmid} ? 'running' : 'stopped';
 
 	my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
 	my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
-- 
2.11.0




More information about the pve-devel mailing list