From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 5DCA71FF144 for ; Tue, 24 Mar 2026 14:53:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B53DA12F15; Tue, 24 Mar 2026 14:53:36 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 8/8] fix #7383: agent: fsfreeze: skip freeze if already frozen Date: Tue, 24 Mar 2026 14:50:48 +0100 Message-ID: <20260324135325.120749-9-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260324135325.120749-1-f.ebner@proxmox.com> References: <20260324135325.120749-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774360362551 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EY7LYUYUP3HYMTMIUD6YBURE3AUXOFOC X-Message-ID-Hash: EY7LYUYUP3HYMTMIUD6YBURE3AUXOFOC X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- src/PVE/QemuServer/Agent.pm | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/PVE/QemuServer/Agent.pm b/src/PVE/QemuServer/Agent.pm index 12f9f9d5..54e30bcf 100644 --- a/src/PVE/QemuServer/Agent.pm +++ b/src/PVE/QemuServer/Agent.pm @@ -289,6 +289,25 @@ sub guest_fsthaw { 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 { + my ($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_fsfreeze_applicable if (guest_fsfreeze_applicable($agent_str, $vmid, $logfunc, $is_backup)) { @@ -296,10 +315,10 @@ sub guest_fsthaw { } 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 and C will be used. In the context of backup tasks, C<$is_backup> must be -specified. +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 and C will be used. In the context of backup +tasks, C<$is_backup> must be specified. =cut @@ -331,6 +350,14 @@ sub guest_fsfreeze_applicable { return; } + my $frozen = eval { PVE::QemuServer::Agent::guest_fs_is_frozen($vmid) }; + $logfunc->('warn', "unable to check guest fs freeze status - $@") if $@; + + if ($frozen) { + $logfunc->('info', "skipping guest filesystem freeze - already frozen"); + return; + } + return 1; } -- 2.47.3