abh1sar commented on code in PR #13074:
URL: https://github.com/apache/cloudstack/pull/13074#discussion_r3324551775
##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -113,20 +126,104 @@ backup_running_vm() {
mount_operation
mkdir -p "$dest" || { echo "Failed to create backup directory $dest"; exit
1; }
+ # Determine effective mode for this run.
+ # Legacy callers (no -M argument) get the original full-only behavior with
no checkpoint.
+ local effective_mode="${MODE:-legacy-full}"
+ local make_checkpoint=0
+ case "$effective_mode" in
+ incremental)
+ if [[ -z "$BITMAP_PARENT" || -z "$BITMAP_NEW" || -z "$PARENT_PATHS" ]];
then
+ echo "incremental mode requires --bitmap-parent, --bitmap-new, and
--parent-paths"
+ cleanup
+ exit 1
+ fi
+ make_checkpoint=1
+ ;;
+ full)
+ if [[ -z "$BITMAP_NEW" ]]; then
+ echo "full mode requires --bitmap-new (the bitmap to create for the
next incremental)"
+ cleanup
+ exit 1
+ fi
+ make_checkpoint=1
+ ;;
+ legacy-full)
+ make_checkpoint=0
+ ;;
+ *)
+ echo "Unknown mode: $effective_mode"
+ cleanup
Review Comment:
Can we put this whole logic in the Java code?
Do the required checks there and have the simple logic here that if
BITMAP_NEW is passed, it means we have to create the new bitmap on the disks.
The motivation is to make the shell code as simple as possible and let the
Java code do the heavy lifting.
--
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]