* [pve-devel] [PATCH v2 container] fix #3927: Containers that are already stopped now return 0, like VMs
@ 2022-03-17 12:16 Daniel Tschlatscher
2022-03-17 12:33 ` Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Tschlatscher @ 2022-03-17 12:16 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
Fixed indentation and trailing whitespace
src/PVE/API2/LXC/Status.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
index f7e3128..d4e0b66 100644
--- a/src/PVE/API2/LXC/Status.pm
+++ b/src/PVE/API2/LXC/Status.pm
@@ -238,7 +238,11 @@ __PACKAGE__->register_method({
raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $authuser ne 'root@pam';
- die "CT $vmid not running\n" if !PVE::LXC::check_running($vmid);
+ # 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;
+ }
if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pve-devel] [PATCH v2 container] fix #3927: Containers that are already stopped now return 0, like VMs
2022-03-17 12:16 [pve-devel] [PATCH v2 container] fix #3927: Containers that are already stopped now return 0, like VMs Daniel Tschlatscher
@ 2022-03-17 12:33 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-03-17 12:33 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Tschlatscher
On 17.03.22 13:16, Daniel Tschlatscher wrote:
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
> ---
> Fixed indentation and trailing whitespace
> src/PVE/API2/LXC/Status.pm | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
> index f7e3128..d4e0b66 100644
> --- a/src/PVE/API2/LXC/Status.pm
> +++ b/src/PVE/API2/LXC/Status.pm
> @@ -238,7 +238,11 @@ __PACKAGE__->register_method({
> raise_param_exc({ skiplock => "Only root may use this option." })
> if $skiplock && $authuser ne 'root@pam';
>
> - die "CT $vmid not running\n" if !PVE::LXC::check_running($vmid);
> + # 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;
for the record (just talked off-list): this is the API code path that the CLI
handler only reuses, and while for the CLI use case a print STDOUT + exit can
be OK, it means a broken connection and existing an API worker process
potentially impacting other API requests that said worker process could handle
concurrently.
FYI, qemu-server does actually the same (die "already running") but there it
happens inside the worker there, which for the CLI means basically above behavior
while the API gets a error task result.
> + }
>
> if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-17 12:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 12:16 [pve-devel] [PATCH v2 container] fix #3927: Containers that are already stopped now return 0, like VMs Daniel Tschlatscher
2022-03-17 12:33 ` Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox