]> git.proxmox.com Git - pve-container.git/commitdiff
fix #2086: change process checking mechanism in vmstatus
authorOguz Bektas <o.bektas@proxmox.com>
Mon, 11 Feb 2019 14:51:06 +0000 (15:51 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 13 Feb 2019 09:14:19 +0000 (10:14 +0100)
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@proxmox.com>
src/PVE/LXC.pm

index 8f560c5708901037ac6ebe4b755e0b1f9b66a5fd..0e584f62769dc34c8c661d8216a8b68ec258b01c 100644 (file)
@@ -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) || {};