all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob Klocker <j.klocker@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 7/8] vm_reboot: warn when rebooting a VM with `reboot` disabled
Date: Thu, 22 Oct 2026 14:51:10 +0200	[thread overview]
Message-ID: <20261022125111.236538-8-j.klocker@proxmox.com> (raw)
In-Reply-To: <20261022125111.236538-1-j.klocker@proxmox.com>

When `reboot` is set to 0, a reboot requested via `qm reboot` or the
API only stops the VM. Log a warning in the task log so users know why
the VM was not restarted.

Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
 src/PVE/QemuServer.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 011d175f..f5ba04f0 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -6248,6 +6248,15 @@ sub vm_reboot {
                 my $storecfg = PVE::Storage::config();
                 _do_vm_stop($storecfg, $vmid, undef, undef, $timeout, 1);
 
+                # Load the config only after the stop: a pending change to 'reboot' is applied
+                # when the VM stops, so this is the value that decides whether it gets restarted
+                my $conf = PVE::QemuConfig->load_config($vmid);
+                my $reboot = parse_reboot($conf->{reboot});
+                if (!($reboot->{enabled} // 1)) {
+                    my $rpcenv = PVE::RPCEnvironment::get();
+                    $rpcenv->warn("VM $vmid: reboot is disabled -"
+                        . " the VM was shut down instead of rebooted.");
+                }
             };
             if (my $err = $@) {
                 # avoid that the next normal shutdown will be confused for a reboot
-- 
2.47.3





  parent reply	other threads:[~2026-10-22 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 12:51 [PATCH docs/guest-common/manager/qemu-server v2 0/8] fix #7213: add `powercycle` reboot behavior Jakob Klocker
2026-10-22 12:51 ` [PATCH pve-guest-common v2 1/8] AbstractConfig: fix pending delete for options with value 0 Jakob Klocker
2026-10-22 12:51 ` [PATCH pve-docs v2 2/8] qm: add reboot behavior information Jakob Klocker
2026-10-22 12:51 ` [PATCH qemu-server v2 3/8] qm: do not restart VM when `reboot` is disabled Jakob Klocker
2026-10-22 12:51 ` [PATCH qemu-server v2 4/8] fix #7213: config: add `powercycle` sub-property to `reboot` Jakob Klocker
2026-10-22 12:51 ` [PATCH qemu-server v2 5/8] fix #7213: qm: cleanup: add `reset` parameter to honor `powercycle` Jakob Klocker
2026-10-22 12:51 ` [PATCH qemu-server v2 6/8] fix #7213: qmeventd: pass `reset` to `qm cleanup` Jakob Klocker
2026-10-22 12:51 ` Jakob Klocker [this message]
2026-10-22 12:51 ` [PATCH pve-manager v2 8/8] ui: qemu: options: add editor for reboot behavior Jakob Klocker

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=20261022125111.236538-8-j.klocker@proxmox.com \
    --to=j.klocker@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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