public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
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	[thread overview]
Message-ID: <20261022130057.361389-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20261022130057.361389-1-m.sandoval@proxmox.com>

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 <m.sandoval@proxmox.com>
---

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





      reply	other threads:[~2026-10-22 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 13:00 [PATCH guest-common v2 0/1] fix #1964: replication config: add a setting to skip freezing guest filesystems Maximiliano Sandoval
2026-10-22 13:00 ` Maximiliano Sandoval [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=20261022130057.361389-2-m.sandoval@proxmox.com \
    --to=m.sandoval@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