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>
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) || {};