<br clear="all"><div>Hi Folks,<div><br></div><div><br></div><div> I was trying to remove networks from the Cluster and Data-Center using the python bindings for ovirt. I could remove the network from the cluster but it fails to remove the network from the datacenter quitting with the below mentioned traceback :</div>
<div><br></div><div><br></div><div> <i> Traceback (most recent call last):</i></div><div><i> File "netdel.py", line 25, in <module></i></div><div><i> Netwk.delete()</i></div><div><i> File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/brokers.py", line 1889, in delete</i></div>
<div><i> headers={'Content-type':None})</i></div><div><i> File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 36, in delete</i></div>
<div><i> return self.request('DELETE', url, body, headers)</i></div><div><i> File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 52, in request</i></div>
<div><i> conn=self.getConnectionsPool().getConnection())</i></div><div><i> File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 62, in __doRequest</i></div>
<div><i> raise RequestError, response</i></div><div><i>ovirtsdk.infrastructure.errors.RequestError:</i></div><div><i>status: 400</i></div><div><i>reason: Bad Request</i></div><div><i>detail: [Cannot remove Network. Network is being used by at least one Cluster.]</i></div>
<div><br></div><div><br></div><div> However, I am able to remove it when I try from the Manager UI. Below is the code I used to test.I am not able to figure-out if it is a know bug or a logical fault on my side somewhere ? [All the VMs are shutdown and no VM is attached to network that I am deleting.] </div>
<div><br></div><div><br></div><div><div><i>from ovirtsdk.api import API</i></div><div><i>from ovirtsdk.xml import params</i></div><div><i><br></i></div><div><i><br></i></div><div><i>ovirt_uri = "<a href="http://ovirtserver.xyz.com:8080/api">http://ovirtserver.xyz.com:8080/api</a>"</i></div>
<div><i>ovirt_username = "admin@internal"</i></div><div><i>ovirt_password = "*********"</i></div><div><i><br></i></div><div><i>ovirtAPI = API(url=ovirt_uri, username=ovirt_username, password=ovirt_password)</i></div>
<div><i><br></i></div><div><i><br></i></div><div><i>## removing the network from the cluster.</i></div><div><i>Netw=ovirtAPI.clusters.get("Default").networks.get("testnet58")</i></div><div><i>print Netw.name + ":" + Netw.id</i></div>
<div><i>Netw.delete()</i></div><div><i><br></i></div><div><i>## removing the network from the Datacenter.</i></div><div><i>Netwk=ovirtAPI.networks.get("testnet58")</i></div><div><i>print Netwk.name + ":" + Netwk.id</i></div>
<div><i>Netwk.delete()</i></div></div><div><br></div><div> </div><div><br></div><div> </div><div><br clear="all"><div><br></div>-- <br>Regards,<br>Rahul<div>=======================================================</div>
</div></div><br>