From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 5A9CF1FF0C2 for ; Thu, 22 Oct 2026 15:01:11 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5A4E2218F3; Thu, 22 Oct 2026 15:01:02 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Subject: [PATCH guest-common v2 1/1] fix #1964: replication config: add a setting to skip freezing guest filesystems Date: Thu, 22 Oct 2026 15:00:54 +0200 Message-ID: <20261022130057.361389-2-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261022130057.361389-1-m.sandoval@proxmox.com> References: <20261022130057.361389-1-m.sandoval@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792674057265 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.750 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: 45TEQQP3ECQ3Q4RI64O4CPXX37YYJVX4 X-Message-ID-Hash: 45TEQQP3ECQ3Q4RI64O4CPXX37YYJVX4 X-MailFrom: m.sandoval@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: Add a skip-freeze-fs setting to replication jobs. An entry is logged if the guest is running and skip-freeze-fs is enabled. Signed-off-by: Maximiliano Sandoval --- Notes: See the commit message for more information. Tested: - Created a VM with ID 101 in a cluster with nodes pve1 and pve2 - Enabled the QGA service inside the guest - Created a replication job with pve2 $ pvesr create-local-job 101-1 pve1 --skip-freeze-fs 1 --schedule '*/1' - Start the VM - pvesr run --id 101-1 - cat /var/log/pve/replicate/101-1 - checked that it contains the added line in the logs. Then repeated the whole thing without specifying --skip-freeze-fs and with --skip-freee-fs 0 to ensure nothing was broken. Differences from v1: - use if block instead of post-if in if freezefs check - Add verbose_description to skip-freeze-fs - Improve description of skip-freeze-fs - Fix typo - Check if $running before logging that we skipped the freeze - Run __snapshot_check_freeze_needed only if skip_freeze_fs is falsy src/PVE/Replication.pm | 19 ++++++++++++++++++- src/PVE/ReplicationConfig.pm | 13 +++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm index ba4c2c1..37aaa18 100644 --- a/src/PVE/Replication.pm +++ b/src/PVE/Replication.pm @@ -299,7 +299,24 @@ sub replicate { my $vmid = $jobcfg->{guest}; my $conf = $guest_class->load_config($vmid); - my ($running, $freezefs) = $guest_class->__snapshot_check_freeze_needed($vmid, $conf, 0); + + my $running = $guest_class->__snapshot_check_running($vmid, $conf); + my $freezefs = 1; + + if ($jobcfg->{'skip-freeze-fs'}) { + if ($running) { + $logfunc->( + "replication job configured with 'skip-freeze-fs' enabled, not freezing guest filesystems" + ); + } + $freezefs = 0; + } else { + # We check __snapshot_check_freeze_needed after checking skip-freeze-fs to avoid logging + # messages produced by the former. + my ($_running, $freeze_needed) = $guest_class->__snapshot_check_freeze_needed($vmid, $conf, 0); + $freezefs = $freeze_needed; + } + my $volumes = $guest_class->get_replicatable_volumes( $storecfg, $vmid, diff --git a/src/PVE/ReplicationConfig.pm b/src/PVE/ReplicationConfig.pm index cf9ee01..91d97cc 100644 --- a/src/PVE/ReplicationConfig.pm +++ b/src/PVE/ReplicationConfig.pm @@ -96,6 +96,18 @@ my $defaultData = { format => 'pve-node', optional => 1, }, + 'skip-freeze-fs' => { + description => + "Whether to skip freezing and thawing the guest's filesystems during replication for consistency.", + verbose_description => + "Whether to skip freezing and thawing the guest's filesystems during replication for consistency." + . " Disabling this setting does not enforce that a freeze happens for VMs." + . " For VMs, that also depends on the virtual machine's 'agent' settings for the QEMU guest agent" + . " and the availability of the guest agent in the VM.", + type => 'boolean', + optional => 1, + default => 0, + }, }, }; @@ -335,6 +347,7 @@ sub options { schedule => { optional => 1 }, remove_job => { optional => 1 }, source => { optional => 1 }, + 'skip-freeze-fs' => { optional => 1 }, }; } -- 2.47.3