<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">Hi Giorgio,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">You can simply do:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><div class="gmail_default" style="display:inline"></div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">dc_storage.disks.list()</span><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">hope that helps</span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="times new roman, serif" size="4"><br></font></div><div dir="ltr"><font size="2" face="arial, helvetica, sans-serif" color="#000000"><br></font></div><div dir="ltr"><font size="2" face="arial, helvetica, sans-serif" color="#000000">Thanks,</font><div><font size="2" face="arial, helvetica, sans-serif" color="#000000">Raz Tamir</font></div><div><font size="2" face="arial, helvetica, sans-serif" color="#000000">Red Hat Israel</font></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Nov 5, 2015 at 7:41 PM, Giorgio Bart <span dir="ltr"><<a href="mailto:giorgiobart300@gmail.com" target="_blank">giorgiobart300@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span lang="en"><span>Hello</span><span>,</span> <br><span>I</span><span>'m writing</span> <span>a python script</span> <span>to draw</span> <span>a graph</span> <span>of the disks</span> <span>and virtual machines</span> <span>in relation to</span> <span>their</span> <span>"</span><span>position</span><span>"</span> <span>in the data center</span><span>.</span><br> <span>I am using</span> <span>pygraphviz</span> <span>to draw</span> <span>the graph</span><span>,</span> <span>I found</span> <span>the</span> <span>vm</span> <span>and their</span> <span>disks</span><span>,</span> <span>data centers and</span> <span>their</span> <span>storage</span> <span>domains</span><span>, but</span> <span>I can not connect</span> <span>the disks</span> <span>to the storage</span> <span>domains</span><span>.</span><br> <span>Here's the code</span> <span>I'm using</span><span>:<br><br>#! /usr/bin/python<br><br>import pygraphviz as PG<br>from ovirtsdk.api import API<br>from ovirtsdk.xml import params<br>#per Graphviz:<br>A = PG.AGraph(directed=True, strict=False)<br>A.graph_attr.update(size="800")<br>########<br> <br>VERSION = params.Version(major='3', minor='0')<br> <br>URL = '<a href="https://xxx/api" target="_blank">https://xxx/api</a>'<br>USERNAME = 'xxx'<br>PASSWORD = 'yyyy'<br> <br>api = API ( url=URL,<br> username=USERNAME,<br> password=PASSWORD,<br> insecure=True)<br>for vm in api.vms.list():<br> for disco in vm.get_disks().list():<br> A.add_edge(<a href="http://vm.name" target="_blank">vm.name</a>,<a href="http://disco.name" target="_blank">disco.name</a>)<br><br>for dc in api.datacenters.list():<br> A.add_edge("ovirt-engine", dc.get_name())<br> for <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0);display:inline"></div>dc_storage in dc.storagedomains.list(): <br> A.add_edge(dc.get_name(), <a href="http://dc_storage.name" target="_blank">dc_storage.name</a>)<br><br>api.disconnect() <br>A.write('ovirt_graph.dot')<br>A.layout(prog='dot')<br>A.draw('ovirt_graph.png') # draw png<br></span></span></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div></div>