[ovirt-users] Unexpected behaviour during creating VM using oVirt API
mailbox4ovirt at asgardahost.org
Fri Oct 7 18:59:08 UTC 2016
I am trying to create a virtual machine from a template using oVirt
API. Somehow like this:
def createVM(connection, cluster, vmname, vmtemplate):
param = params.VM( name=vmname, \
use_latest_template_version = True )
print "Could not construct a request to oVirtapi,please check parameters which were being sent to"
print "I was not able to commit my request into oVirt api."
Everything is fine when I have only ONE version of a template. But I am
used to create several number of versions for one template because it
is quite flexible. In this case, when I run my script, I receive an
"AmbiguousQueryError" error even if an option
"use_latest_template_version = True" is used.
and found near line 30 that this error is raised unquestionably:
if len(result) > 1:
return result if result else None
It seems quite strange. Either I do not understand the meaning of
option "use_latest_template_version" or using of this option does not
make sense, I mean query constructed in params.VM() function will not
be passed by filterhelper.py in current implementation.
I made a small patch that allows me to use the latest
version of the template during VM creation:
if len(result) > 1 :
result = result[len(result) - 1]
return result if result else Nonepython-2.7.5-34.el7.x86_64
But I am still not sure that original behaviour of filehelper.py is
unexpectable. I would be very pleasant if you explain me this issue.
My OS is CentOS 7. I use Python python-2.7.5-34.el7.x86_64. Version of
ovirt-engine-sdk is ovirt-engine-sdk-python-22.214.171.124-1.el7.centos.noarch
Thanks in advance, Roman A. Chukov.
More information about the Users