[PATCH qemu-server] fix vm shutdown when agent conf is enabled but is not running in the vm

Fabio Fantoni fabio.fantoni at m2r.biz
Mon Dec 9 15:00:31 CET 2024


Ping

Il 26/11/2024 16:19, Fabio Fantoni ha scritto:
> Checking only vm configuration for choose the shutdown method causes it
> to always fail, after reaching the timeout, if the qemu agent option in
> the vm configuration is enabled but the agent is not installed and
> active in the guest.
> As I seen in the windows vm the agent also crashes in some cases, so
> shutdown don't fail only if qemu guest agent is not installed or not
> started.
>
> Added check that agent is active when choosing agent shutdown method to
> avoid certain shutdown failure in those cases.
>
> Signed-off-by: Fabio Fantoni <fabio.fantoni at m2r.biz>
> ---
>   PVE/QemuServer.pm | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 2046a7c..4b6aac7 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6341,7 +6341,7 @@ sub _do_vm_stop {
>   
>       eval {
>   	if ($shutdown) {
> -	    if (defined($conf) && get_qga_key($conf, 'enabled')) {
> +	    if (defined($conf) && get_qga_key($conf, 'enabled') && qga_check_running($vmid, 1)) {
>   		mon_cmd($vmid, "guest-shutdown", timeout => $timeout);
>   	    } else {
>   		mon_cmd($vmid, "system_powerdown");



-- 
Questa email è stata esaminata alla ricerca di virus dal software antivirus Avast.
www.avast.com



More information about the pve-devel mailing list