public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix vm shutdown when agent conf is enabled but is not running in the vm
@ 2024-11-26 15:19 Fabio Fantoni via pve-devel
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio Fantoni via pve-devel @ 2024-11-26 15:19 UTC (permalink / raw)
  To: pve-devel; +Cc: Fabio Fantoni

[-- Attachment #1: Type: message/rfc822, Size: 6312 bytes --]

From: Fabio Fantoni <fabio.fantoni@m2r.biz>
To: pve-devel@lists.proxmox.com
Cc: Fabio Fantoni <fabio.fantoni@m2r.biz>
Subject: [PATCH qemu-server] fix vm shutdown when agent conf is enabled but is not running in the vm
Date: Tue, 26 Nov 2024 16:19:57 +0100
Message-ID: <20241126151957.10072-1-fabio.fantoni@m2r.biz>

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@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");
-- 
2.25.1



[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-09 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20241126151957.10072-1-fabio.fantoni@m2r.biz>
2024-12-09 14:00 ` [pve-devel] [PATCH qemu-server] fix vm shutdown when agent conf is enabled but is not running in the vm Fabio Fantoni via pve-devel
2024-11-26 15:19 Fabio Fantoni via pve-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal