abh1sar commented on code in PR #13074:
URL: https://github.com/apache/cloudstack/pull/13074#discussion_r3408049656


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtTakeBackupCommandWrapper.java:
##########
@@ -94,21 +113,46 @@ public Answer execute(TakeBackupCommand command, 
LibvirtComputingResource libvir
             return answer;
         }
 
+        // Strip out our incremental marker lines before parsing size, so the 
legacy
+        // numeric-suffix parser keeps working.
+        String stdout = result.second().trim();
+        String bitmapCreated = null;
+        boolean incrementalFallback = false;
+        StringBuilder filtered = new StringBuilder();
+        for (String line : stdout.split("\n")) {
+            String trimmed = line.trim();
+            if (trimmed.startsWith("BITMAP_CREATED=")) {

Review Comment:
   @jmsperu please address this.



##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -191,24 +337,39 @@ backup_running_vm() {
     virsh -c qemu:///system domblklist "$VM" --details 2>/dev/null | awk 
'$2=="disk"{print $3, $4}'
   )
 
-  rm -f $dest/backup.xml
+  rm -f $dest/backup.xml $dest/checkpoint.xml
   sync
 
   # Print statistics
   virsh -c qemu:///system domjobinfo $VM --completed
   du -sb $dest | cut -f1
+  if [[ -n "$BITMAP_NEW" ]]; then
+    # Echo the bitmap name on its own line so the Java caller can capture it 
for backup_details.
+    echo "BITMAP_CREATED=$BITMAP_NEW"
+  fi
 
   umount $mount_point
   rmdir $mount_point
 }
 
 backup_stopped_vm() {
+  # Stopped VMs cannot use libvirt's backup-begin (no QEMU process). Take a 
full
+  # backup via qemu-img convert. If the caller asked for incremental, fall back
+  # to full and signal the fallback so the orchestrator can record it as a full
+  # in the chain.
+  if [[ "$MODE" == "incremental" ]]; then
+    # Emit on stdout so Script.executePipedCommands in 
LibvirtTakeBackupCommandWrapper
+    # can parse it and record the backup as FULL.
+    echo "INCREMENTAL_FALLBACK=full (VM stopped — incremental requires running 
VM)"

Review Comment:
   @jmsperu this as well. thanks



-- 
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