Re: [ovirt-users] python sdk : how to get disks from storage domain

2015-11-05 Thread Giorgio Bart
Ok that's work !
So simply

Thanks,
Giorgio



2015-11-05 21:38 GMT+01:00 Raz Tamir :

> Hi Giorgio,
> You can simply do:
> ​
> dc_storage.disks.list()
>
> hope that helps
>
>
>
>
> Thanks,
> Raz Tamir
> Red Hat Israel
>
> On Thu, Nov 5, 2015 at 7:41 PM, Giorgio Bart 
> wrote:
>
>> Hello,
>> I'm writing a python script to draw a graph of the disks and virtual
>> machines in relation to their "position" in the data center.
>> I am using pygraphviz to draw the graph, I found the vm and their disks, data
>> centers and their storage domains, but I can not connect the disks to
>> the storage domains.
>> Here's the code I'm using:
>>
>> #! /usr/bin/python
>>
>> import pygraphviz as PG
>> from ovirtsdk.api import API
>> from ovirtsdk.xml import params
>> #per Graphviz:
>> A = PG.AGraph(directed=True, strict=False)
>> A.graph_attr.update(size="800")
>> 
>>
>> VERSION = params.Version(major='3', minor='0')
>>
>> URL =   'https://xxx/api'
>> USERNAME =  'xxx'
>> PASSWORD =  ''
>>
>> api = API ( url=URL,
>> username=USERNAME,
>> password=PASSWORD,
>> insecure=True)
>> for vm in api.vms.list():
>> for disco in vm.get_disks().list():
>> A.add_edge(vm.name,disco.name)
>>
>> for dc in api.datacenters.list():
>> A.add_edge("ovirt-engine", dc.get_name())
>> for
>> ​​
>> dc_storage in dc.storagedomains.list():
>> A.add_edge(dc.get_name(), dc_storage.name)
>>
>> api.disconnect()
>> A.write('ovirt_graph.dot')
>> A.layout(prog='dot')
>> A.draw('ovirt_graph.png') # draw png
>>
>> ___
>> Users mailing list
>> Users@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] python sdk : how to get disks from storage domain

2015-11-05 Thread Raz Tamir
Hi Giorgio,
You can simply do:
​
dc_storage.disks.list()

hope that helps




Thanks,
Raz Tamir
Red Hat Israel

On Thu, Nov 5, 2015 at 7:41 PM, Giorgio Bart 
wrote:

> Hello,
> I'm writing a python script to draw a graph of the disks and virtual
> machines in relation to their "position" in the data center.
> I am using pygraphviz to draw the graph, I found the vm and their disks, data
> centers and their storage domains, but I can not connect the disks to the
> storage domains.
> Here's the code I'm using:
>
> #! /usr/bin/python
>
> import pygraphviz as PG
> from ovirtsdk.api import API
> from ovirtsdk.xml import params
> #per Graphviz:
> A = PG.AGraph(directed=True, strict=False)
> A.graph_attr.update(size="800")
> 
>
> VERSION = params.Version(major='3', minor='0')
>
> URL =   'https://xxx/api'
> USERNAME =  'xxx'
> PASSWORD =  ''
>
> api = API ( url=URL,
> username=USERNAME,
> password=PASSWORD,
> insecure=True)
> for vm in api.vms.list():
> for disco in vm.get_disks().list():
> A.add_edge(vm.name,disco.name)
>
> for dc in api.datacenters.list():
> A.add_edge("ovirt-engine", dc.get_name())
> for
> ​​
> dc_storage in dc.storagedomains.list():
> A.add_edge(dc.get_name(), dc_storage.name)
>
> api.disconnect()
> A.write('ovirt_graph.dot')
> A.layout(prog='dot')
> A.draw('ovirt_graph.png') # draw png
>
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[ovirt-users] python sdk : how to get disks from storage domain

2015-11-05 Thread Giorgio Bart
Hello,
I'm writing a python script to draw a graph of the disks and virtual
machines in relation to their "position" in the data center.
I am using pygraphviz to draw the graph, I found the vm and their disks, data
centers and their storage domains, but I can not connect the disks to the
storage domains.
Here's the code I'm using:

#! /usr/bin/python

import pygraphviz as PG
from ovirtsdk.api import API
from ovirtsdk.xml import params
#per Graphviz:
A = PG.AGraph(directed=True, strict=False)
A.graph_attr.update(size="800")


VERSION = params.Version(major='3', minor='0')

URL =   'https://xxx/api'
USERNAME =  'xxx'
PASSWORD =  ''

api = API ( url=URL,
username=USERNAME,
password=PASSWORD,
insecure=True)
for vm in api.vms.list():
for disco in vm.get_disks().list():
A.add_edge(vm.name,disco.name)

for dc in api.datacenters.list():
A.add_edge("ovirt-engine", dc.get_name())
for dc_storage in dc.storagedomains.list():
A.add_edge(dc.get_name(), dc_storage.name)

api.disconnect()
A.write('ovirt_graph.dot')
A.layout(prog='dot')
A.draw('ovirt_graph.png') # draw png
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users