[Engine-devel] Problem with detachment of host interface using ovirt-sdk
Juan Hernandez
juan.hernandez at redhat.com
Mon May 7 11:08:41 UTC 2012
On 04/29/2012 10:44 AM, Itzik Brown wrote:
> I used the repository git://gerrit.ovirt.org/ovirt-engine-sdk
> Commit 3c721e60ab3af3ad07e1a20bc6fdbcdbc1344df0
>
> The test script :
>
> #!/usr/bin/python
>
> import sys
> from ovirtsdk.api import API
> from ovirtsdk.xml import params
>
> OVIRT_ENGINE_SERVER = 'server1'
> OVIRT_ENGINE_PORT = '8080'
> OVIRT_ENGINE_USER = 'admin at internal'
> OVIRT_ENGINE_PASSWORD = 'password'
>
> url = 'http://%s:%s' % (OVIRT_ENGINE_SERVER, OVIRT_ENGINE_PORT)
> api = API(url = url, username = OVIRT_ENGINE_USER , password = OVIRT_ENGINE_PASSWORD)
>
> host = 'host1'
> if_name = 'eth4'
> net_name = 'net1'
> nic = api.hosts.get(name=host).nics.get(name=if_name)
> net = params.Network(name=net_name)
> act = params.Action(network=net)
> nic.detach(act)
> api.hosts.get(name=host).commitnetconfig()
Itzik, I think there is nothing wrong with the SDK or with your code.
The issue is deeper in the restapi or the backend (depends on how you
look at it). I compared what restapi and webadmin do:
* Both create an instance of the parameters using the constructor:
AttachNetworkToVdsParameters(Guid vdsId, network net,
VdsNetworkInterface iface)
* Webadmin passes an instance of the network class where the status is 0
(non operational), even if the status of the network is 1 (operational).
This might be a bug, but a bug that combined with the backend behavior
makes the operation work.
* The rest API passes an instance of the network class where the status
is 1 (operational). This, combined with the backend behavior, makes the
operation fail.
* In the backend, if the status of the network is operational, the
detach is performed only if the network is not in use in the cluster,
which will always be true.
I think that neither the webadmin nor the restapi should pass anything
but the network name (or id) and the backend should ignore any
additional information if passed. In addition the backend should allow
the detach operation even if the network is in use in the cluster.
Livnat, Michael, Einav, any comments?
More information about the Engine-devel
mailing list