How do you go with big virtual disk's? I run a file server with a 2TB virtual disk, but don't want a 2TB data log to back up every time I run it. Same goes with a heap of VMs with 100Gb disks, I don't really want to take up another 100gb of space every day I back up, that's why my current solution is vProtect as I can do weekly full and daily incrementals but always keen to see other implementations especially for large disks.

On 24 January 2020 9:23:27 pm Jayme <jaymef@gmail.com> wrote:

Indeed. A felt like there was need for a simple way to backup ovirt vms. Ansible may just be the answer. After some more testing of the playbook I plan to publish a blog post/guide on the subject so others can use it. 



On Fri, Jan 24, 2020 at 4:42 AM Jan Zmeskal <jzmeskal@redhat.com> wrote:
Jayme is trying to solve pretty much the same problem as you - although he's using the Ansible approach instead of SDK. Feel free to join that conversation. At this point it seems like he might have found a good solution, but he needs to test it.

Jan

On Fri, Jan 24, 2020 at 8:33 AM <lars.stolpe@bvg.de> wrote:
hi,

I tryed this with API 4.2 and 4.3.
purpose of the following script is, to export a given list of vm as OVA one after another.
To reach that i need to monitor the job status and pause the script till the actual export is done.
The script works fine, but not the restriction of the returned jobs to the one spcificaly job i need to monitor.
Therefor the script pauses on *any* running job.
the working script:

#!/usr/bin/python

import logging
import time

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

connection = sdk.Connection(
    url='https://ovirtman12/ovirt-engine/api',
    username='admin@internal',
    password='***',
    ca_file='/etc/pki/ovirt-engine/ca-ovirtman12.pem',
)


hosts_service = connection.system_service().hosts_service()
hosts = hosts_service.list()[0]

vms_service = connection.system_service().vms_service()
vms = vms_service.list(search='name=blxlic954')

for vm in vms:
#     print("%s (%s)" % (vm.name, vm.id))
    vm_service = vms_service.vm_service(vm.id)
    start_time = (time.strftime('%Y%m%d_%H%M%S', time.localtime(int(time.time()))))
    vm_service.export_to_path_on_host(
        host=types.Host(id=hosts.id),
        directory='/nfs_c3/export',
        filename=('%s_backup_%s.ova' % (vm.name, start_time)),
        wait=True,
    )
#    time.sleep(5)
    jobs_service = connection.system_service().jobs_service()
    jobs = jobs_service.list(search='')
    for job in jobs:
        print(job.id, job.description)
#        job = jobs_service.job_service(job.id).get()
        while job.status == types.JobStatus.STARTED:
            time.sleep(10)
            job = jobs_service.job_service(job.id).get()
            print('job-status: %s' % (job.status))

connection.close()

The line 
    jobs = jobs_service.list(search='')
works fine as long as the search pattern is empty.

if i try to restrict the results returned like this:
    jobs = jobs_service.list(search='description=*blxlic954*')
i get an error:

 bad sql grammar [select * from (select * from job where ( job id in (select distinct job.job id from  job   where  (  ) ))  order by start time asc) as t1 offset (1 -1) limit 2147483647]; nested exception is org.postgresql.util.psqlexception: error: syntax error at or near ")"

looks like the 'where' clause is not filled correctly.

Am i wrong with my syntax or ist that a bug?
Is there another way to get the correct job id/status?
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/ZVFUE32ORCMN7EBRR7PXKRWAJJV4MAIB/


--

Jan Zmeskal

Quality Engineer, RHV Core System

Red Hat

_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org