From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6391D1FF168 for ; Tue, 26 Nov 2024 16:42:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EB5CA6424; Tue, 26 Nov 2024 16:42:29 +0100 (CET) To: pve-devel@lists.proxmox.com Date: Tue, 26 Nov 2024 16:19:57 +0100 X-Mailman-Approved-At: Tue, 26 Nov 2024 16:42:28 +0100 MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Fabio Fantoni via pve-devel Precedence: list Cc: Fabio Fantoni X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH qemu-server] fix vm shutdown when agent conf is enabled but is not running in the vm Content-Type: multipart/mixed; boundary="===============5381074972208316955==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============5381074972208316955== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 20887CA583 for ; Tue, 26 Nov 2024 16:20:40 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 01A12552D for ; Tue, 26 Nov 2024 16:20:10 +0100 (CET) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 26 Nov 2024 16:20:08 +0100 (CET) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a9aa8895facso917836866b.2 for ; Tue, 26 Nov 2024 07:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=m2r-biz.20230601.gappssmtp.com; s=20230601; t=1732634402; x=1733239202; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aJJN2j6arzUGcxYMxEQyEim/U9MhpFGdokn+jEbL2GY=; b=YB9okkVmOk1qIt+vquomvF5eecdlaBQFmxU1AMz7MgEzQOW4a547Grwr2/SzagHiCw l1WlkTPsjQ8o00zVedlKfPeoZifKFrYr3fIGR7eHYbRcEj3UcseKL8ue380lRzAvlxiB jQ2zjH+iO/VfdQ/UJI+YkYiTwR5CMAtVoC24nRULN0uQCuVhL1TPV6vpXzcjwHU5JRNz 2oaxl1n0GKYySvlJKKqWYACqN4H2c8PmOlFweWY8bXqsKUko6gD44Uz1btEjnuU3X83c LXvENpyL2ODxQhxrLY8DdfxwGYKjHu7e8jPrNDes1KYKVgVS/HMteK39WMlaDplNVFNM WS6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732634402; x=1733239202; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aJJN2j6arzUGcxYMxEQyEim/U9MhpFGdokn+jEbL2GY=; b=RxKWaHHOekyyo2yW2er+73IKcH5wRsl7hcuv/nlOarWGDATtBAB6OKlp9MV2AvauSe cuu0b8ET0jt/8rmQpXxNo3mBig5auIwHRmFcqTmvPlQB7A+X2IrR8Qq22qZlY6C4sz9M /4Z9mRa8XWZzIiLYIKEeXKdWtC5o4NUBKiqnV4nV+HXvB03EQbqAErl1UglBeP2gG2+K UciwT3vazq9XBQOHiwPWcREqnuqqYFVyDoTKIzyOEVeC5CGuD+rm32tLhGWO30hogS5H hEESwPb5EPZJf6OvBRDIU51W0ZkcA1+FTywFTEg/L27ot4Lwp98StJqZO91bOc4p0jQo 1j5A== X-Gm-Message-State: AOJu0YzQ/i9s7I9S8suhbFzSwZq6NoaxzHW4dfa4GQnvJ6pmI+qF3NU4 JdGvkQCU/XL2UoaI1RruhK563d1T23XNYz0MlZqHdeI6SZ4rw+tGTC89RVT4sly5/3WBdhUCx4p X X-Gm-Gg: ASbGncsvf9Bm1yJ5RPIY5xoggDcxL+ci+3+W50QO+hFUNc6tFbiiXQXFmawwMR1n4eB bqSunFsG50zqVG2Y6q3fXXCTVYtRkfbmJ6x7bMFm5iYoIJpGRlQktzpxJLqn3bRKF1xNESvPAj0 FFxCKXj8+3zYYZKCWOsGfoPJGCB2IrP00WR4B4DQqQ7nbWtNXiwr/JMQTibDfcJbH+FUx5u8esr 6HExjbG2BkIr/GhP5zkB2tfsYzdQeEFaqDgkIFBmqCQveZeQ/kQzHlaYr5rkPNpYO8hCfaF8eCm r7yIxKhsFDXBQlDja+u55Fs3XR8j X-Google-Smtp-Source: AGHT+IG4SnDRDX6+r42KWCAlV7Q4yNOVDazYT+umIOpsPSM8OWxPW9UklYgUcJspDxd0uqCBATicGA== X-Received: by 2002:a17:906:2931:b0:aa5:4104:4a8c with SMTP id a640c23a62f3a-aa541044bd2mr747141566b.40.1732634402272; Tue, 26 Nov 2024 07:20:02 -0800 (PST) Received: from localhost.localdomain (host-87-0-78-68.retail.telecomitalia.it. [87.0.78.68]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa54a23545dsm324912766b.152.2024.11.26.07.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 07:20:01 -0800 (PST) From: Fabio Fantoni To: pve-devel@lists.proxmox.com Cc: Fabio Fantoni 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> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DMARC_PASS -0.1 DMARC pass policy JMQ_SPF_NEUTRAL 0.5 SPF set to ?all KAM_INFOUSMEBIZ 0.75 Prevalent use of .info|.us|.me|.me.uk|.biz|xyz|id|rocks|life domains in spam/malware RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] X-Mailman-Approved-At: Tue, 26 Nov 2024 16:42:28 +0100 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 --- 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 --===============5381074972208316955== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============5381074972208316955==--