Comments (4)
We are currently using it on oVirt 4.4, I also made some changes to work with python3. The only problem occurring right now is that the cloned VMs aren't automatically deleted after a backup. Probably since the sdk got updated, im already looking for the sdk changes.
from ovirtbackup.
I replaced part of the code in vmtools.py 4.3 and the old VM's started to be deleted in 4.4
Replaced it
# @staticmethod
# def delete_vm(api, config, vm_name):
# """
# Delets a vm which was created during backup
# :param vm: Virtual machine object
# :param config: Configuration
# """
# done = False
# try:
# vms_service = api.system_service().vms_service()
# vm_search_regexp = 'name=' + str(vm_name) + config.get_vm_middle() + '__*'
# for vm in vms_service.list(search=vm_search_regexp):
# logger.info("Delete cloned VM (%s) started ..." % vm.name)
# if not config.get_dry_run():
# vm_service = vms_service.vm_service(vm.id)
# if vm_service is None:
# logger.warn(
# "The VM (%s) doesn't exist anymore, "
# "skipping deletion ...", vm.name
# )
# done = True
# continue
# vm.delete_protected = False
# vm_service.update(vm)
# while True:
# try:
# vm_service.remove()
# break
# except:
# logger.debug("Wait for previous clone operation to complete (VM %s status is %s)..." , vm.name, vm.status)
# time.sleep(config.get_timeout())
# while True:
# try:
# vm_service.get()
# except:
# break
# logger.debug("Deletion of cloned VM (%s) in progress ..." % vm.name)
# time.sleep(config.get_timeout())
# done = True
# except Exception as e:
# logger.info("!!! Can't delete cloned VM (%s)", vm.name)
# raise e
# if done:
# logger.info("Cloned VM (%s) deleted" , vm.name)
with this
@staticmethod
def delete_vm(api, config, vm_name):
"""
Delets a vm which was created during backup
:param api: ovirtsdk api
:param config: Configuration
:param vm_name: Virtual machine object
"""
global global_vm
done = False
try:
vms_service = api.system_service().vms_service()
vm_search_regexp = ("name=%s%s_*" % (vm_name, config.get_vm_middle()))
for global_vm in vms_service.list(search=vm_search_regexp):
logger.info("Delete cloned VM (%s) started ..." % global_vm.name)
if not config.get_dry_run():
vm_service = vms_service.vm_service(global_vm.id)
if vm_service is None:
logger.warning(
"The VM (%s) doesn't exist anymore, "
"skipping deletion ...", global_vm.name
)
done = True
continue
global_vm.delete_protected = False
vm_service.update(global_vm)
while True:
try:
vm_service.remove()
break
except:
logger.debug("Wait for previous clone operation to complete (VM %s status is %s)...",
global_vm.name, global_vm.status)
time.sleep(config.get_timeout())
while True:
try:
vm_service.get()
except:
break
logger.debug("Deletion of cloned VM (%s) in progress ..." % global_vm.name)
time.sleep(config.get_timeout())
done = True
except Exception as e:
logger.info("!!! Can't delete cloned VM (%s)", global_vm.name)
raise e
if done:
logger.info("Cloned VM (%s) deleted", global_vm.name)
from ovirtbackup.
No code updates for 4.4? I could start some tests in the next weeks (in a RHV production environment).
Do I need updated information?
from ovirtbackup.
Hi, i've been using this awesome script for months now with 4.2.3 without any problems. Now after moving to 4.4 and some python3, config tweaking i was able to run the backup/export successfully.
As @Ziehnert pointed out though , the only problem is that the cloned VM's aren't deleted and it seems that the script doesn't even try to remove those as it did in the previous version, for example in previous versions you could see in the log file entries like
2021-12-27 05:34:43,218: Delete cloned VM (test-vm__20211227_040755) started ...
@Ziehnert did you manage to find a solution?
Thanks
from ovirtbackup.
Related Issues (20)
- Backup fails completely if VM missing HOT 1
- Create VM from snapshot HOT 2
- oVirtBackup stop working after update to oVirt 4.2.7 HOT 1
- API version 4 required (v3 support dropped with oVirt engine 4.3) HOT 4
- !!! No snapshot found !!! HOT 5
- Cyrillic symbol in name of snapshot HOT 1
- Error in VM nameresolution on delete cloned-vm HOT 13
- Imported VM deleted in backup rotation HOT 2
- !!! Got unexpected exception: The 'search' parameter should be of type 'str', but it is of type 'unicode'.
- Branch 4.3 no cleanup before or after backup
- The script does not delete the cloned VM HOT 3
- Selecting a disk for backup HOT 2
- TypeError: The 'search' parameter should be of type 'str', but it is of type 'unicode'. HOT 2
- [feature] Support for not incremental backup API
- [feature] Support incremental backup API
- [feature] Support User Interface interface plugin
- [deprication] Export storage domain is depricated HOT 1
- Add back the option to backup vms by vm_names
- Master branch failed with : 'Config' object has no attribute 'get_disks_id_exclude' HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ovirtbackup.