H,
Thanks for infos.
BTW, as I need to retrieve cluster and datacenter to which my host belongs within a
software running on the host , I use a Python script
interacting with the ovirt-engine ; is there another way to get these infos
"locally" on the host itself ?
Thx
J.P.
-----Message d'origine-----
De : Juan Hernández [mailto:jhernand@redhat.com]
Envoyé : mercredi 18 novembre 2015 19:10
À : Jean-Pierre Ribeauville; Karli Sjöberg
Cc : users(a)ovirt.org
Objet : Re: [ovirt-users] Error when trying to retrieve cluster, hosts via ovirt API
On 11/18/2015 12:22 PM, Jean-Pierre Ribeauville wrote:
Hi,
You were right .
By setting correct URL and correct certificate file location , it's working.
If I well understand , as this certificate file has to be on the
client side , isn't a point if failure ?
The certificate is needed to secure the SSL communication. You can do without it, adding
"insecure=True" to the constructor of the API object, but then the identity of
the server could be forged and you won't notice.
For example , for a cluster , it's possible to retrieve hosts
belonging to the cluster via this call:
hostoncluster = api.clusters.get(id=api.hosts.get(obj.name
<
http://obj.name>).get_cluster().get_id()).get_name()
That should work, but when you are doing this kind of query it is usually better to let
the server do the search. You can achieve that using the same query language that is used
in the GUI search bar. For example, in the GUI search bar you can type "Hosts:
cluster=mycluster".
With the SDK you can do the same, using the "list" method and the
"query" parameter:
hosts = api.hosts.list(query="cluster=mycluster")
for host in hosts:
print(host.get_name())
How may I know list of available "fields" for host, cluster,
datacenters and so on .. .
You can open the "params.py" file
(/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py if you are using the RPM packags)
and look for the corrsponding class: Host, Cluster, DataCenter etc. There you will see all
the available "get_..."
methods.
Thanks for help.
J.P.
*De :*Karli Sjöberg [mailto:karli.sjoberg@slu.se] *Envoyé :* mardi 17
novembre 2015 17:52 *À :* Jean-Pierre Ribeauville *Cc :*
users(a)ovirt.org *Objet :* Re: [ovirt-users] Error when trying to
retrieve cluster, hosts via ovirt API
Den 17 nov. 2015 5:30 em skrev Jean-Pierre Ribeauville
<jpribeauville(a)axway.com <mailto:jpribeauville@axway.com>>:
>
> Hi,
>
>
>
> By running python example got here ( :
http://website-humblec.rhcloud.com/ovirt-find-hosts-clusters-vm-runnin
g-status-ids-storage-domain-details-ovirt-dc-pythonovirt-sdk-part-3)
> and modified with my connection parameters, I got following error :
>
>
>
>
>
> Unexpected error: [ERROR]::oVirt API connection failure, (77, '')
>
>
>
> How may I get error codes meanings ?
I don't know the meaning but I saw that APIURL was wrong, it should be:
APIURL = "https://${ENGINE_ADDRESS}/ovirt-engine/api
<https://$%7bENGINE_ADDRESS%7d/ovirt-engine/api>"
Could you correct that and try again?
/K
>
>
>
> Thanks for help.
>
>
>
>
>
>
>
> J.P. Ribeauville
>
>
>
> P: +33.(0).1.47.17.20.49
>
> .
>
> Puteaux 3 Etage 5 Bureau 4
>
>
>
> jpribeauville(a)axway.com <mailto:jpribeauville@axway.com>
>
http://www.axway.com
>
>
>
>
>
> P Pensez à l'environnement avant d'imprimer.
>
>
>
>
_______________________________________________
Users mailing list
Users(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid,
Spain Inscrita en el Reg. Mercantil de Madrid - C.I.F. B82657941 - Red Hat S.L.