[ovirt-users] ovirt python sdk and starting stateless vm

Jiří Sléžka jiri.slezka at slu.cz
Mon Sep 26 11:12:46 UTC 2016


Dne 26.9.2016 v 13:07 Ondra Machacek napsal(a):
> On 09/26/2016 12:48 PM, Jiří Sléžka wrote:
>> Dne 26.9.2016 v 12:10 Ondra Machacek napsal(a):
>>> On 09/26/2016 11:41 AM, Jiří Sléžka wrote:
>>>> Hello,
>>>>
>>>> I am testing some from scratch deployment so I created a stateless vm
>>>> and wrote small python script to shutdown and start the vm again (to
>>>> revert vm state to starting point).
>>>>
>>>> http://pastebin.com/b5yTFEkN
>>>>
>>>> problem is that after stopping the vm there is a running operation of
>>>> snapshot removal and when script try to start the vm it fails with
>>>>
>>>> Failed to Start VM:
>>>>
>>>> status: 409
>>>> reason: Conflict
>>>> detail: Cannot run VM. Related operation is currently in progress.
>>>> Please try again later.
>>>>
>>>> Is there a cleaner way than checking status and looping or waiting some
>>>> time to end of this operation? (desclaimer: I am new to python so
>>>> please
>>>> don't hit me :-)
>>>
>>> Unfortunatelly, no. You always have to poll the API to check the status
>>> of the operation.
>>
>> ok, I will
>>
>>> Just for info, we have new Python SDK version 4[1]. Python SDK version
>>> 3 will be removed someday in future. So you would have to migrate your
>>> scripts, so maybe better to write it in version 4 now, then rewrite it
>>> later.
>>
>> thanks for link. Unfortunatelly it looks like there is only 3.6.3.0
>> version of ovirt-engine-sdk-python in Fedora24 repo at this time (and
>> ovirt-engine-sdk-python-3.6.9.1-1.fc23.noarch.rpm in /ovirt-4.0 repo for
>> fc23)
>
> It has different name - python-ovirt-engine-sdk4.
>
> http://resources.ovirt.org/pub/ovirt-4.0/rpm/fc23/x86_64/python-ovirt-engine-sdk4-4.0.1-1.fc23.x86_64.rpm

+1

:-)

>
>
>>
>>> And also, if you don't know Python, but you know Ansible, you can use
>>> Ansible VMs module[2].
>>
>> thanks once more. I am using ansible and I will try ovirt module for
>> sure (but python is on my todo list as well ;-)
>>
>> Cheers, Jiri
>>
>>>
>>> [1] - https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
>>> [2] - http://docs.ansible.com/ansible/ovirt_vms_module.html
>>
>>
>>>
>>>>
>>>>
>>>> Cheers, Jiri
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at ovirt.org
>>>> http://lists.ovirt.org/mailman/listinfo/users
>>>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jiri_slezka.vcf
Type: text/x-vcard
Size: 586 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160926/39a415c8/attachment-0001.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3267 bytes
Desc: Elektronicky podpis S/MIME
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160926/39a415c8/attachment-0001.p7s>


More information about the Users mailing list