all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Kaiyang Wu <wukaiyang2003@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Kaiyang Wu <wukaiyang@loongfans.cn>
Subject: [PATCH ha-manager 4/5] vm resource: return running status -1 for panicked VMs
Date: Mon, 14 Sep 2026 17:20:11 +0800	[thread overview]
Message-ID: <20260914092015.125780-5-wukaiyang@loongfans.cn> (raw)
In-Reply-To: <20260914092015.125780-1-wukaiyang@loongfans.cn>

Indicate the panicked status used to stop the VM before restarting it to
keep the 'started' state. Keep the return value truthy to shutdown the
VM when needed (e.g. 'stopped' state).

Signed-off-by: Kaiyang Wu <wukaiyang@loongfans.cn>
---
 src/PVE/HA/Resources/PVEVM.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
index 8753271..51c7bac 100644
--- a/src/PVE/HA/Resources/PVEVM.pm
+++ b/src/PVE/HA/Resources/PVEVM.pm
@@ -143,10 +143,13 @@ sub check_running {
     my $nodename = $haenv->nodename();
 
     if (PVE::QemuServer::check_running($vmid, 1, $nodename)) {
+        # return -1 to indicate the panicked status while keeping it truthy
+        my $qmpstatus = eval { PVE::QemuServer::Monitor::mon_cmd($vmid, 'query-status') };
+        return -1 if defined($qmpstatus) && $qmpstatus->{status} eq 'guest-panicked';
+
         # do not count VMs which are suspended for a backup job as running
         my $conf = PVE::QemuConfig->load_config($vmid, $nodename);
         if (defined($conf->{lock}) && $conf->{lock} eq 'backup') {
-            my $qmpstatus = eval { PVE::QemuServer::Monitor::mon_cmd($vmid, 'query-status') };
             $haenv->log('warning', "$@") if $@;
 
             return 0 if defined($qmpstatus) && $qmpstatus->{status} eq 'prelaunch';
-- 
2.55.0




  parent reply	other threads:[~2026-09-14  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  9:20 [PATCH qemu-server/docs/manager/ha-manager 0/5] add pvpanic device support Kaiyang Wu
2026-09-14  9:20 ` [PATCH qemu-server 1/5] qemuserver: add pvpanic device Kaiyang Wu
2026-09-14  9:20 ` [PATCH docs 2/5] qm: add document section for the " Kaiyang Wu
2026-09-14  9:20 ` [PATCH manager 3/5] ui: qemu: add pvpanic device support Kaiyang Wu
2026-09-14  9:20 ` Kaiyang Wu [this message]
2026-09-14  9:20 ` [PATCH ha-manager 5/5] lrm: stop and restart panicked VMs to keep the "started" state Kaiyang Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914092015.125780-5-wukaiyang@loongfans.cn \
    --to=wukaiyang2003@gmail.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=wukaiyang@loongfans.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal