mirror of
https://github.com/netinvent/npbackup.git
synced 2025-09-10 15:04:55 +08:00
kvm_qemu: Don't create snapshots for offline VMs
This commit is contained in:
parent
af8c8f5df4
commit
f8c729cd33
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Script ver 2025042801
|
||||
# Script ver 2025062501
|
||||
|
||||
#TODO: blockcommit removes current snapshots, even if not done by cube
|
||||
# - it's interesting to make housekeeping, let's make this an option
|
||||
|
@ -68,6 +68,12 @@ function create_snapshot {
|
|||
# Add VM xml description from virsh
|
||||
## At least use a umask
|
||||
|
||||
if [ "$(virsh domstate $vm)" == "shut off" ]; then
|
||||
log "Domain is not running, no need for snapshots"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
# Don't redirect direct virsh output or SELinux may complain that we cannot write with virsh context
|
||||
xml=$(virsh dumpxml --security-info $vm || log "Failed to create XML file" "ERROR")
|
||||
echo "${xml}" > "${ROOT_DIR}/${vm}.xml"
|
||||
|
|
Loading…
Add table
Reference in a new issue