Skip to content

Commit ef59186

Browse files
committed
freeze the fs before backup-begin in nasbackup.sh
1 parent 8b9f9b5 commit ef59186

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

scripts/vm/hypervisor/kvm/nasbackup.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,27 @@ backup_running_vm() {
100100
name="datadisk"
101101
done
102102
echo "</disks></domainbackup>" >> $dest/backup.xml
103+
d
104+
local thaw=0
105+
if virsh -c qemu:///system qemu-agent-command "$VM" '{"execute":"guest-fsfreeze-freeze"}' > /dev/null 2>/dev/null; then
106+
thaw=1
107+
fi
103108

104109
# Start push backup
105-
virsh -c qemu:///system backup-begin --domain $VM --backupxml $dest/backup.xml > /dev/null 2>/dev/null
110+
local backup_begin=0
111+
if virsh -c qemu:///system backup-begin --domain $VM --backupxml $dest/backup.xml > /dev/null 2>&1; then
112+
backup_begin=1;
113+
fi
114+
115+
if [[ $thaw -eq 1 ]]; then
116+
if ! virsh -c qemu:///system qemu-agent-command "$VM" '{"execute":"guest-fsfreeze-thaw"}' > /dev/null 2>&1; then
117+
echo "FS thaw failed for $VM"
118+
fi
119+
fi
120+
121+
if [[ $backup_begin -ne 1 ]]; then
122+
exit 1
123+
fi
106124

107125
# Backup domain information
108126
virsh -c qemu:///system dumpxml $VM > $dest/domain-config.xml 2>/dev/null

0 commit comments

Comments
 (0)