
Hi Rahul, This is known issue indeed, the bug in api and occurs when you fetch network by-name, (returned incorrect network), as workaround you can get network by-id (.clusters.get("Default").networks.get(id=XXX)) fix expected in sdk 3.1.0.4 On 07/04/2012 03:35 PM, Rahul Upadhyaya wrote:
Hi Folks,
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 :
/ Traceback (most recent call last):/ / File "netdel.py", line 25, in <module>/ / Netwk.delete()/ / File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/brokers.py", line 1889, in delete/ / headers={'Content-type':None})/ / File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 36, in delete/ / return self.request('DELETE', url, body, headers)/ / File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 52, in request/ / conn=self.getConnectionsPool().getConnection())/ / File "/usr/lib/python2.6/site-packages/ovirt_engine_sdk-1.5_SNAPSHOT-py2.6.egg/ovirtsdk/infrastructure/proxy.py", line 62, in __doRequest/ / raise RequestError, response/ /ovirtsdk.infrastructure.errors.RequestError:/ /status: 400/ /reason: Bad Request/ /detail: [Cannot remove Network. Network is being used by at least one Cluster.]/
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.]
/from ovirtsdk.api import API/ /from ovirtsdk.xml import params/ / / / / /ovirt_uri = "http://ovirtserver.xyz.com:8080/api"/ /ovirt_username = "admin@internal"/ /ovirt_password = "*********"/ / / /ovirtAPI = API(url=ovirt_uri, username=ovirt_username, password=ovirt_password)/ / / / / /## removing the network from the cluster./ /Netw=ovirtAPI.clusters.get("Default").networks.get("testnet58")/ /print Netw.name + ":" + Netw.id/ /Netw.delete()/ / / /## removing the network from the Datacenter./ /Netwk=ovirtAPI.networks.get("testnet58")/ /print Netwk.name + ":" + Netwk.id/ /Netwk.delete()/
-- Regards, Rahul =======================================================
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Michael Pasternak RedHat, ENG-Virtualization R&D