oVirtBackup
oVirtBackup copied to clipboard
The script does not delete the cloned VM
Hello! Thanks a lot for your script!
I have a problem where the script is ignoring the deletion of the cloned VM.
oVirt vesrion: 4.4.4-7.el8
My config:
[config]
vm_names: ["VM1"]
vm_middle=_BACKUP
snapshot_description=Snapshot for backup script
server=https://ovirt.example.org/ovirt-engine/api
username=svc@internal
password=password
export_domain=vmdisks_backup_01
timeout=10
cluster_name=CLUSTER
datacenter_name=DC01
backup_keep_count=
backup_keep_count_by_number=3
dry_run=False
vm_name_max_length=64
use_short_suffix=False
storage_domain=vmdisks_storage_01
storage_space_threshold=0.1
logger_fmt=%(asctime)s: %(message)s
logger_file_path=
persist_memorystate=False
Command:
# ./backup.py -c config.cfg -d
Logs:
2021-02-07 01:23:38,135: Start backup for: VM1
2021-02-07 01:23:38,184: The storage domain vmdisks_backup_01 is in state active
2021-02-07 01:23:38,255: Search backup snapshots matching Description="Snapshot for backup script"
2021-02-07 01:23:38,358: Snapshot creation started ...
2021-02-07 01:23:39,006: Snapshot operation(creation) in progress ...
2021-02-07 01:23:39,007: Snapshot id=a5d2af3b-0f7e-4729-b678-e0c7b7fb4cf2 status=locked
2021-02-07 01:23:59,647: Snapshot created
2021-02-07 01:24:09,909: Clone into VM (VM1_BACKUP_20210207_012338) started ...
2021-02-07 01:29:25,567: Cloning into VM (VM1_BACKUP_20210207_012338) in progress ... [309/1056]
2021-02-07 01:33:49,119: Cloning finished
2021-02-07 01:33:49,119: Search backup snapshots matching Description="Snapshot for backup script"
2021-02-07 01:33:49,523: Found backup snapshot to delete. Description: Snapshot for backup script, Created on: 2021-02-07 01:23:38.590000+03:00
2021-02-07 01:33:50,014: Snapshot deletion started ...
2021-02-07 01:33:50,841: Snapshot operation(deletion) in progress ...
2021-02-07 01:33:50,841: Snapshot id=a5d2af3b-0f7e-4729-b678-e0c7b7fb4cf2 status=locked
2021-02-07 01:34:21,637: Snapshots deleted
2021-02-07 01:34:21,638: Looking for old backup to delete matching ^VM1_BACKUP*, keeping max 3 images...
2021-02-07 01:34:23,085: Found 0 old backup images in export_domain.
2021-02-07 01:34:23,121: Export of VM (VM1_BACKUP_20210207_012338) started ...
2021-02-07 01:36:57,040: Exporting finished
2021-02-07 01:36:57,089: Duration: 32:37 minutes
2021-02-07 01:36:57,089: VM exported as VM1_BACKUP_20210207_012338
2021-02-07 01:36:57,090: Backup done for: VM1
2021-02-07 01:36:57,091: All backups done
And after the script finishes, I see a virtual machine with the _BACKUP <...> prefix in the VM list, as well as its disks in the original storage domain
Please help
The script does not delete the VM due to the changes made in the last Commit in vmtools.py
Thanks for the report. If you have time can you please create a pull request. Currently I'm totally busy (24/7). If anybody read this I'm searching employees around Lower Austria, more information's on https://blog.wefixit.at
vmtools.py
in del func need replace double "_" to single "_" in regexp