Damans227 commented on code in PR #14194:
URL: https://github.com/apache/cloudstack/pull/14194#discussion_r4259932867


##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -134,6 +137,217 @@ get_linstor_uuid_from_device() {
   return 1
 }
 
+# ---------------------------------------------------------------------------
+# Content-based backup path (libvirt pull mode).
+#
+# Used for raw block-device disks such as LINSTOR/DRBD. Those cannot carry QEMU
+# persistent dirty bitmaps -- persistence is a qcow2-only feature -- so libvirt
+# checkpoints, and with them the push-mode incremental path, are unavailable.
+#
+# Instead libvirt is asked for a pull-mode backup: it starts an NBD server 
exposing a
+# point-in-time view of each disk, held consistent by copy-before-write into 
local
+# fleecing scratch images. The backup is then derived from that export:
+#
+#   content-full         qemu-img convert -> sparse standalone qcow2. Zero 
detection
+#                        happens while streaming, so the fully allocated 
push-mode
+#                        output and its separate re-convert pass are both 
avoided.
+#   content-incremental  a qcow2 overlay backed by the NBD export, then a SAFE 
rebase
+#                        onto the parent backup. That merges exactly the 
clusters which
+#                        differ between export and parent into the overlay, 
yielding a
+#                        delta qcow2 backed by the parent -- the same chain 
shape the
+#                        push-mode incremental produces, so restore/delete are 
unchanged.
+#
+# Unlike a storage-snapshot based diff there is no trailing DRBD metadata to 
clip: the
+# DRBD device, and therefore the NBD export, is already net-sized.
+#
+# Assumes mount_operation() already ran, so $dest and $mount_point are set.
+# ---------------------------------------------------------------------------
+backup_running_vm_pull() {
+  local effective_mode="$1"
+
+  # Scratch area for the NBD socket and libvirt's fleecing images. Never on 
the NAS:
+  # copy-before-write runs inline with guest writes, so it wants fast local 
storage with
+  # room for the write churn during the backup. 711 lets the qemu process 
traverse in to
+  # the files libvirt creates as root.
+  local scratch_dir
+  scratch_dir=$(mktemp -d "$SCRATCH_PARENT/csbackup-scratch.XXXXXX") || {

Review Comment:
   the check before start helps, but with the default 25 a busy vm that 
rewrites more than a quarter of its disk still gets paused and stays paused. 
can we stop the backup and resume the vm when the scratch area runs low?



##########
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java:
##########
@@ -281,14 +312,25 @@ protected ChainDecision decideChain(VirtualMachine vm) {
         // behaves exactly like the pre-incremental full-only path: no bitmap 
is generated and no
         // chain/checkpoint metadata is created, sent to the agent, or 
persisted (legacy-full).
         Boolean incrementalEnabled = 
NASBackupIncrementalEnabled.valueIn(vm.getDataCenterId());
-        if (incrementalEnabled == null || !incrementalEnabled) {
+        final boolean incrementalOn = incrementalEnabled != null && 
incrementalEnabled;
+
+        // Raw block-device storage (LINSTOR/DRBD) cannot carry QEMU 
persistent dirty bitmaps, so
+        // libvirt checkpoints — and with them the push-mode incremental path 
— are unavailable.
+        // Those VMs take the content-based pull-mode path instead. It is 
chosen regardless of the
+        // master switch, because even a full backup benefits: pull mode 
writes a sparse qcow2 in a
+        // single pass rather than a fully allocated one needing a second 
re-convert pass.
+        if (allVolumesOnContentDiffCapableStorage(vm)) {

Review Comment:
   makes sense, checking the incremental setting first in 3c1820b62e covers it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to