Git Product home page Git Product logo

Comments (4)

Ziehnert avatar Ziehnert commented on July 22, 2024 1

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.

mrt85 avatar mrt85 commented on July 22, 2024 1

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.

hobyhop avatar hobyhop commented on July 22, 2024

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.

zroupas avatar zroupas commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.