<div dir="ltr"><div><div><div>Ok that&#39;s work !<br></div>So simply....<br><br></div>Thanks,<br></div>Giorgio<br><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-05 21:38 GMT+01:00 Raz Tamir <span dir="ltr">&lt;<a href="mailto:ratamir@redhat.com" target="_blank">ratamir@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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><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 face="arial, helvetica, sans-serif" size="2" color="#000000"><br></font></div><div dir="ltr"><font face="arial, helvetica, sans-serif" size="2" color="#000000">Thanks,</font><div><font face="arial, helvetica, sans-serif" size="2" color="#000000">Raz Tamir</font></div><div><font face="arial, helvetica, sans-serif" size="2" color="#000000">Red Hat Israel</font></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Thu, Nov 5, 2015 at 7:41 PM, Giorgio Bart <span dir="ltr">&lt;<a href="mailto:giorgiobart300@gmail.com" target="_blank">giorgiobart300@gmail.com</a>&gt;</span> wrote:<br></div></div><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><div class="h5"><div dir="ltr"><div><span lang="en"><span>Hello</span><span>,</span> <br><span>I</span><span>&#39;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>&quot;</span><span>position</span><span>&quot;</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&#39;s the code</span> <span>I&#39;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=&quot;800&quot;)<br>########<br>   <br>VERSION = params.Version(major=&#39;3&#39;, minor=&#39;0&#39;)<br>    <br>URL =           &#39;<a href="https://xxx/api" target="_blank">https://xxx/api</a>&#39;<br>USERNAME =      &#39;xxx&#39;<br>PASSWORD =      &#39;yyyy&#39;<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(&quot;ovirt-engine&quot;, 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(&#39;ovirt_graph.dot&#39;)<br>A.layout(prog=&#39;dot&#39;)<br>A.draw(&#39;ovirt_graph.png&#39;) # draw png<br></span></span></div></div>
<br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org" target="_blank">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>
</blockquote></div><br></div>