[pve-devel] [PATCH container] fix #3927: Stopped containers now return 0, like VMs do

Matthias Heiserer m.heiserer at proxmox.com
Thu Mar 17 11:45:01 CET 2022


On 17.03.2022 11:15, Daniel Tschlatscher wrote:
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher at proxmox.com>
> ---
>   src/PVE/API2/LXC/Status.pm | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
> index f7e3128..f414f7a 100644
> --- a/src/PVE/API2/LXC/Status.pm
> +++ b/src/PVE/API2/LXC/Status.pm
> @@ -237,8 +237,12 @@ __PACKAGE__->register_method({
>   	my $skiplock = extract_param($param, 'skiplock');
>   	raise_param_exc({ skiplock => "Only root may use this option." })
>   	    if $skiplock && $authuser ne 'root at pam';
> -
> -	die "CT $vmid not running\n" if !PVE::LXC::check_running($vmid);
> +	Trailing whitespace
> +	# Containers that are already stopped should exit with code 0, like VMs do
> +	if (!PVE::LXC::check_running($vmid)) {
> +		print "CT $vmid not running\n";
> +		exit 0;
> +	}
Wrong identation, should be tab + 4 spaces
>   
>   	if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
>   






More information about the pve-devel mailing list