It isn't possible to remove a host network interface using the RESTAPI. Add a host with two network interfaces and create a bond using the GUI, then try to delete the bond using the following script: ---8<--- #!/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." host_id="..." nic_id="..." curl \ --verbose \ --insecure \ --user "${user}:${password}" \ --request DELETE \ "${url}/hosts/${host_id}/nics/${nic_id}" --->8--- It will fail and return the following error message: ---8<--- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <reason>Operation Failed</reason> <detail>[Unexpected exception]</detail> </fault> --->8--- The engine.log file contains the following messages: ---8<--- 2015-06-09 11:46:28,352 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] Failed in 'RemoveNetworkVDS' method 2015-06-09 11:46:28,355 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp--127.0.0.1-8702-1) [7ec260ee] Correlation ID: null, Call Stack: null, Custom Event ID: -1, Message: VDSM 'myhost' command failed: Attempt to call function: <bound method Global.delNetwork of <API.Global object at 0x7f73d414afd0>> with arguments: (None, u'bond0', [u'eth1', u'eth0'], None) error: expected string or buffer 2015-06-09 11:46:28,356 INFO [org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] Command 'org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand' return value 'StatusOnlyReturnForXmlRpc [mStatus=StatusForXmlRpc [mCode=-32603, mMessage=Attempt to call function: <bound method Global.delNetwork of <API.Global object at 0x7f73d414afd0>> with arguments: (None, u'bond0', [u'eth1', u'eth0'], None) error: expected string or buffer]]' 2015-06-09 11:46:28,356 INFO [org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] HostName = myhost 2015-06-09 11:46:28,356 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] Command 'RemoveNetworkVDSCommand(HostName = myhost, NetworkVdsmVDSCommandParameters:{runAsync='true', hostId='9889b311-65e4-4df8-8785-bdc7c9b314d2', networkName='ovirtmgmt', oldNetworkName='null', hostAddr='null', checkConnectivity='false', connectionTimeout='0', vlanId='null', bondName='bond0', nics='[eth1, eth0]', inetAddr='null', networkMask='null', gateway='null', stp='false', bondingOptions='null', bootProtocol='NONE', vmNetwork='false', network='null'})' execution failed: VDSGenericException: VDSErrorException: Failed to RemoveNetworkVDS, error = Attempt to call function: <bound method Global.delNetwork of <API.Global object at 0x7f73d414afd0>> with arguments: (None, u'bond0', [u'eth1', u'eth0'], None) error: expected string or buffer, code = -32603 2015-06-09 11:46:28,357 INFO [org.ovirt.engine.core.vdsbroker.vdsbroker.RemoveNetworkVDSCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] FINISH, RemoveNetworkVDSCommand, log id: 3fb82615 2015-06-09 11:46:28,358 ERROR [org.ovirt.engine.core.bll.network.host.RemoveBondCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] Command 'org.ovirt.engine.core.bll.network.host.RemoveBondCommand' failed: VdcBLLException: org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException: VDSGenericException: VDSErrorException: Failed to RemoveNetworkVDS, error = Attempt to call function: <bound method Global.delNetwork of <API.Global object at 0x7f73d414afd0>> with arguments: (None, u'bond0', [u'eth1', u'eth0'], None) error: expected string or buffer, code = -32603 (Failed with error unexpected and code 16) 2015-06-09 11:46:28,371 ERROR [org.ovirt.engine.core.bll.network.host.RemoveBondCommand] (ajp--127.0.0.1-8702-1) [7ec260ee] Transaction rolled-back for command 'org.ovirt.engine.core.bll.network.host.RemoveBondCommand'. 2015-06-09 11:46:28,414 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp--127.0.0.1-8702-1) [7ec260ee] Correlation ID: 7ec260ee, Job ID: f4b1b049-988b-41e0-9df8-bfd324c0e3f3, Call Stack: null, Custom Event ID: -1, Message: Failed to remove bond: bond0 for Host: myhost (User:admin@internal). 2015-06-09 11:46:28,455 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp--127.0.0.1-8702-1) [] Operation Failed: [Unexpected exception] --->8--- Apparently there is a mismtach between the parameters sent from the engine, as defined in IVdsServer#delNetwork, and VDSM API.py#delNetwork: Engine: StatusOnlyReturnForXmlRpc delNetwork(String bridge, String vlan, String bond, String[] nics); VDSM: def delNetwork(self, network, vlan=None, bond=None, nics=None, options=None): Note that the VDSM method has an extra "options" parameter.
The issue is with the name of first parameter for addNetwork and delNetwork verbs. On the engine side we have 'bridge' whereas on vdsm side we have 'network'. I am not sure which side should be fixed so reassigning to network team.
*** Bug 1238738 has been marked as a duplicate of this bug. ***
https://gerrit.ovirt.org/#/c/35090/5/vdsm/API.py has changed the argument name from "bridge" to "network", forgetting that this changes an ancient and well-established Vdsm API.
An action of breaking bond fails with error message that it's not possible to break a bond with VLAN on it, though there is no VLAN on the bond
> DELETE /api/hosts/0340e39c-98e2-4c50-956f-000decf1f31a/nics/ddeb9c98-7329-4304-b2c7-251dda4f0c4e HTTP/1.1 > Authorization: Basic YWRtaW5AaW50ZXJuYWw6MTIzNDU2 > User-Agent: curl/7.32.0 > Host: jenkins-vm-06.scl.lab.tlv.redhat.com > Accept: */* > < HTTP/1.1 409 Conflict < Date: Mon, 03 Aug 2015 11:32:47 GMT < Content-Type: application/xml < Content-Length: 181 < Vary: Accept-Encoding < Connection: close < <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <reason>Operation Failed</reason> <detail>[Bond attached to vlan, remove bonds vlan first]</detail> </fault>
This smells like a different bug. Could you share engine and {super,}vdsm logs?
Created attachment 1065158 [details] engine, supervdsm and vdsm logs
Indeed this is a completely different bug. Note that in the original report, Engine (<=3.5 and early 3.6) was using the addNetwork Vdsm verb. In the newly-attached logs, Engine=3.6 is using the setupNetworks verb. This time the failure is in 2015-08-20 11:21:15,212 WARN [org.ovirt.engine.core.bll.network.host.RemoveBondCommand] (ajp-/127.0.0.1:8702-7) [526b44b4] CanDoAction of action 'RemoveBond' failed for user admin@internal. Reasons: NETWORK_BOND_HAVE_ATTACHED_VLANS 2015-08-20 11:21:15,237 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-7) [] Operation Failed: [Bond attached to vlan, remove bonds vlan first] Please open an new bug for with these logs, and verify the existing bug with an engine-3.5 and vdsm of 3.6.
Danken, Could you please explain what is the common sense behind testing this bz with engine of 3.5 and VDSM of 3.6 ?
The original bug reported here is about breakage of compatibility. New vdsm, 4.17.something, did not support the ancient addNetwork API properly. I've fixed this bug, but to test it - you need to use an Engine that actually uses the ancient API over jsonrpc. Only engine-3.5 does that. One of the motivations of moving to a new networking API in 3.6 was to stop using the ancient Vdsm API.
Created attachment 1071359 [details] engine, supervdsm and vdsm logs
The same problem for 3.5 engine and 3.6 host as well as for 3.5 engine and 3.6 host: <fault><reason>Operation Failed</reason><detail>[Bond attached to vlan, remove bonds vlan first]</detail></fault> Engine: 3.5.4.2-1.3.el6ev Host1: vdsm-4.17.5-1.el7ev RHEL 7.1 Host2: vdsm-4.16.26-1.el6ev RHEL 6.7 Logs attached
Since this is only happens on the old API, I'm not sure this is worth fixing. Meni - please check this scenario with the new API.
*** Bug 1256040 has been marked as a duplicate of this bug. ***
This is an automated message. oVirt 3.6.0 RC1 has been released. This bug has no target release and still have target milestone set to 3.6.0-rc. Please review this bug and set target milestone and release to one of the next releases.
Works on the new API
(In reply to Meni Yakove from comment #16) > Works on the new API So let us not attempt to fix it. Instead, encourage users to move to new API. This decision may change if a paying customer can explain that this affects them badly.
After further examination: this bug refers to the ancient NIC-based API, that was used in rhev-m-3.0. In that API it has never been possible to create or remove bond devices. Engine expected bond0...bond4 to pre-exist on each host. As long as we still remove ${url}/hosts/${host_id}/nics/${nic_id} where nic_id is a name of a VM network, we have no regression and should not fix anything in this API. Actually, we should mark it as deprecated, and drop in in version 4.0.
I didn't fully understand what should be removed in 4.0. The operation to remove a host NIC? DELETE /hosts/{host:id}/nics/${nic:id}
Yes, as well as the one PUTting a new NIC. The 3.6 HostSetupNetworks intends to replace it all.