public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 7/7] fix #7383: agent: fsfreeze: skip freeze if already frozen
Date: Thu, 23 Apr 2026 14:35:18 +0200	[thread overview]
Message-ID: <20260423124004.115303-8-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260423124004.115303-1-f.ebner@proxmox.com>

This avoids the following error message about the command being
disallowed which can be hard to interpret for users:
> Command guest-fsfreeze-freeze has been disabled: the command is not allowed

It's disallowed, because the fs is already frozen, but the error
message does not indicate this. Instead avoid the error by skipping if
already frozen and log it if that is the case.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes in v2:
* Use subroutine signature.
* Adapt to log function change.

 src/PVE/QemuServer/Agent.pm | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/Agent.pm b/src/PVE/QemuServer/Agent.pm
index c8cd334f..be6df443 100644
--- a/src/PVE/QemuServer/Agent.pm
+++ b/src/PVE/QemuServer/Agent.pm
@@ -276,6 +276,23 @@ sub guest_fs_thaw($vmid) {
     return;
 }
 
+=head3 guest_fs_is_frozen
+
+    if (guest_fs_is_frozen($vmid)) {
+        print "skipping guest fs freeze - already frozen\n";
+    }
+
+Check if the file systems of the guest C<$vmid> is currently frozen.
+
+=cut
+
+sub guest_fs_is_frozen($vmid) {
+    my $status = PVE::QemuServer::Monitor::mon_cmd($vmid, "guest-fsfreeze-status");
+    check_agent_error($status, "unable to check guest filesystem freeze status");
+
+    return $status eq 'frozen';
+}
+
 =head3 guest_fs_freeze_applicable
 
     if (guest_fs_freeze_applicable($agent_str, $vmid, $logfunc)) {
@@ -283,9 +300,9 @@ sub guest_fs_thaw($vmid) {
     }
 
 Check if the file systems of the guest C<$vmid> should be frozen according to the guest agent
-property string C<$agent_str> and if freezing is actionable in practice, i.e. guest agent running.
-Logs a message if skipped. Using a custom log function via C<$logfunc> is supported. Otherwise,
-C<print()> and C<warn()> will be used.
+property string C<$agent_str> and if freezing is actionable in practice, i.e. guest agent running
+and file system not already frozen. Logs a message if skipped. Using a custom log function via
+C<$logfunc> is supported. Otherwise, C<print()> and C<warn()> will be used.
 
 =cut
 
@@ -304,6 +321,14 @@ sub guest_fs_freeze_applicable($agent_str, $vmid, $logfunc = undef) {
         return;
     }
 
+    my $frozen = eval { PVE::QemuServer::Agent::guest_fs_is_frozen($vmid) };
+    $logfunc->("unable to check guest fs freeze status - $@", 'warn') if $@;
+
+    if ($frozen) {
+        $logfunc->("skipping guest filesystem freeze - already frozen");
+        return;
+    }
+
     return 1;
 }
 
-- 
2.47.3





      parent reply	other threads:[~2026-04-23 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 12:35 [PATCH-SERIES qemu-server v2 0/7] " Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 1/7] agent: migrate to v5.36 and use subroutine signatures Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 2/7] agent: rename guest_fs{freeze,thaw} to guest_fs_{freeze,thaw} Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 3/7] agent: parse: change signature to take property string rather than full VM config Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 4/7] agent: should fs freeze: " Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 5/7] clone disk/block jobs: change signatures to take guest agent property string Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 6/7] agent: fs freeze: harmonize checks for guest fs freeze Fiona Ebner
2026-04-23 12:35 ` Fiona Ebner [this message]

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=20260423124004.115303-8-f.ebner@proxmox.com \
    --to=f.ebner@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 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