[pve-devel] [PATCH v2 qemu-server 1/2] Add missing checks for paused runstates

Fiona Ebner f.ebner at proxmox.com
Mon Oct 9 13:11:08 CEST 2023


Am 25.08.23 um 14:18 schrieb Filip Schauer:
> Add checks for "suspended" and "prelaunch" runstates when checking
> whether a VM is paused.
> 
> This fixes the following issues:
> * ACPI-suspended VMs automatically resuming after migration
> * Shutdown and reboot commands timing out instead of failing
>   immediately on suspended VMs
> 
> Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
> ---
>  PVE/QemuServer.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index bf1de17..954fed7 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -8596,7 +8596,11 @@ sub vm_is_paused {
>  	mon_cmd($vmid, "query-status");
>      };
>      warn "$@\n" if $@;
> -    return $qmpstatus && $qmpstatus->{status} eq "paused";
> +    return $qmpstatus && (
> +	$qmpstatus->{status} eq "paused" or
> +	$qmpstatus->{status} eq "suspended" or

Style nit: mixing '&&' and 'or' is not too nice. For boolean expressions
like here, '&&' and '||' should always be used. For assertions like
$variable or die "error"
usually 'or' is used in our code base.

Once that's fixed:
Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>

> +	$qmpstatus->{status} eq "prelaunch"
> +    );
>  }
>  
>  sub check_volume_storage_type {





More information about the pve-devel mailing list