[ovirt-users] Creating templates in a blocking fashion from Python SDK

Yedidyah Bar David didi at redhat.com
Sun Apr 10 08:02:02 UTC 2016


On Sun, Apr 10, 2016 at 10:43 AM, Barak Korren <bkorren at redhat.com> wrote:
> Hi there, I use the following Python SDK snippet to create a template
> from an existing VM:
>
>     templ = ovirt.templates.add(
>         ovirtsdk.xml.Template(vm=vm, name=vm.name)
>     )
>
> This seems to launch a template creation task in a non-blocking
> manner, which makes the next command I run, which tries to delete the
> VM, fail because the VM is still locked by the template creation task.
>
> Is there a way to block on the template creation task and not return
> to the code until it finishes?

I don't think so, but you can loop waiting, see e.g.:

http://www.ovirt.org/develop/api/pythonapi/#create-a-template-from-vm
-- 
Didi



More information about the Users mailing list