I wrote the last days a little Tool to get in touch with Python (first time) and solved a little backup problem since I switched from vmware esxi to oVirt.
The Tool creates a full backup and export it to a NFS share (export domain).
Requests:
- NFS share which are connected to the ovirt-engine where the backups will be stored
Workflow:
- Create a snapshot
- Clone the snapshot into a new VM
- Delete the snapshot
- Export the VM to the NFS share
- Delete the VM
Configuration:
- It is possible to set the age in days how long the backup should be hold
You can find it on github:
https://github.com/wefixit-AT/oVirtBackup
WARNING: Wrong configuration can delete your existent backup !!! Please test it first with a new clean VM !!!
Note: With the current Python API (ovirtsdk) it is not possible to export a snapshot directly to the NFS share so it is necessary to create first a temporary VM
Hi Gregor
I’m trying to use the script, but i get this message:
Traceback (most recent call last):
File “/opt/oVirtBackup/backup.py”, line 127, in
main(sys.argv[1:])
File “/opt/oVirtBackup/backup.py”, line 88, in main
VMTools.wait_for_vm_operation(api, config, “Cloning”, vm_from_list)
File “/opt/oVirtBackup/vmtools.py”, line 105, in wait_for_vm_operation
while str(api.vms.get(vm_name + config.get_vm_middle() + config.get_vm_suffix()).get_status().state) != ‘down’:
AttributeError: ‘NoneType’ object has no attribute ‘get_status’
In the log file I get:
Start backup for: Ansible
Snapshot creation started …
Snapshot operation(creation) in progress …
Snapshot created
Clone into VM started …
Cloning in progress …
My .cfg is here:
[config]
# A list of names which VM’s should be backed up
vm_names: [“Ansible”]
# Middle part for the exported VM name
vm_middle=_BACKUP
# Description which should be set to the created snapshot
snapshot_description=Snapshot creado por el script
# Url which you use to connect to your engine
server=https://ovirt-server.mydomainishere
# Username to connect to the engine
username=admin@internal
# Password for the above user
password=my_very_secure_password_;)
# Name of the NFS Export Domain
export_domain=MyExportDomain
# Timeout in seconds to wait during long time operations (snapshot creation, snapshot deletion, …)
timeout=300
# The name of the cluster where the VM should be cloned
cluster_name=my_local_cluster_name
# How long backups should be keeped, this is in days
backup_keep_count=1
# If set to “True” no creation, deletion and other operations will be executed
#dry_run=True
dry_run=False
I Get this message from the oVirt Engine:
1) Snapshot ‘Snapshot creado por el script’ deletion for VM ‘Ansible’ was initiated by admin@internal.
2) Snapshot ‘Snapshot creado por el script’ deletion for VM ‘Ansible’ has been completed.
3) VM Ansible_BACKUP_1445893715 creation was initiated by admin@internal.
4) VDSM srvovirt03.cnsc.net command failed: low level Image copy failed
5) VDSM command failed: Image does not exist in domain: u’image=7c0d6bb9-30d4-46f4-a239-327cc6557c9b, domain=27ee47c4-6106-47fc-bd74-d482fe1de653′
6) Failed to complete VM Ansible_BACKUP_1445893715 creation.
It’s oVirt 3.6 RC 3
Thanks for any idea
hi,
can you please checkout the latest source and create a issue on github.
cheers gregor
Hi
This issue was resolved, thanks but I have another bug:
https://github.com/wefixit-AT/oVirtBackup/issues/22