FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

nasbackup.sh: verify backup integrity with qemu-img check by jmsperu · Pull Request #12845 · apache/cloudstack · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .sh  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
23 changes: 23 additions & 0 deletions scripts/vm/hypervisor/kvm/nasbackup.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,25 @@ sanity_checks() {
log -ne "Environment Sanity Checks successfully passed"
}

verify_backup() {
local backup_dir="$1"
local failed=0
for img in "$backup_dir"/*.qcow2; do
[[ -f "$img" ]] || continue
if ! qemu-img check "$img" > /dev/null 2>&1; then
Comment on lines +90 to +92
echo "Backup verification failed for $img"
Comment on lines +87 to +93
log -ne "Backup verification FAILED: $img"
Comment on lines +92 to +94
failed=1
else
log -ne "Backup verification passed: $img"
fi
done
if [[ $failed -ne 0 ]]; then
echo "One or more backup files failed verification"
exit 1
fi
}

### Operation methods ###

backup_running_vm() {
Expand Down Expand Up @@ -114,6 +133,8 @@ backup_running_vm() {
rm -f $dest/backup.xml
sync

verify_backup "$dest"

# Print statistics
virsh -c qemu:///system domjobinfo $VM --completed
du -sb $dest | cut -f1
Expand All @@ -136,6 +157,8 @@ backup_stopped_vm() {
done
sync

verify_backup "$dest"

ls -l --numeric-uid-gid $dest | awk '{print $5}'
}

Expand Down
Loading

Back | FazBrowse Home | New Git URL