Bug 1229632 - Can't remove bond interface via ancient RESTAPI
Summary: Can't remove bond interface via ancient RESTAPI
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Network
Version: ---
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: ---
Assignee: Martin Mucha
QA Contact: GenadiC
URL:
Whiteboard: network
: 1256040 (view as bug list)
Depends On:
Blocks: 1133597 1238738
TreeView+ depends on / blocked
 
Reported: 2015-06-09 09:56 UTC by Juan Hernández
Modified: 2021-11-12 10:13 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-29 14:40:04 UTC
oVirt Team: Network
Embargoed:


Attachments (Terms of Use)
engine, supervdsm and vdsm logs (993.71 KB, application/zip)
2015-08-20 08:26 UTC, GenadiC
no flags Details
engine, supervdsm and vdsm logs (810.42 KB, application/zip)
2015-09-08 13:30 UTC, GenadiC
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-43984 0 None None None 2021-11-12 10:13:25 UTC
oVirt gerrit 43187 0 master MERGED net: maintain legacy addNetwork/delNetwork APIs Never

Description Juan Hernández 2015-06-09 09:56:19 UTC
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.

Comment 1 Piotr Kliczewski 2015-06-17 08:31:19 UTC
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.

Comment 2 Juan Hernández 2015-07-02 14:37:45 UTC
*** Bug 1238738 has been marked as a duplicate of this bug. ***

Comment 3 Dan Kenigsberg 2015-07-03 09:54:49 UTC
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.

Comment 4 GenadiC 2015-08-05 12:35:31 UTC
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

Comment 5 GenadiC 2015-08-05 12:41:49 UTC
> 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>

Comment 6 Dan Kenigsberg 2015-08-19 08:33:42 UTC
This smells like a different bug. Could you share engine and {super,}vdsm logs?

Comment 7 GenadiC 2015-08-20 08:26:56 UTC
Created attachment 1065158 [details]
engine, supervdsm and vdsm logs

Comment 8 Dan Kenigsberg 2015-08-23 13:58:58 UTC
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.

Comment 9 GenadiC 2015-08-23 14:42:16 UTC
Danken,
Could you please explain what is the common sense behind testing this bz with engine of 3.5 and VDSM of 3.6 ?

Comment 10 Dan Kenigsberg 2015-08-23 15:35:00 UTC
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.

Comment 11 GenadiC 2015-09-08 13:30:38 UTC
Created attachment 1071359 [details]
engine, supervdsm and vdsm logs

Comment 12 GenadiC 2015-09-08 13:34:52 UTC
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

Comment 13 Barak 2015-09-09 09:58:55 UTC
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.

Comment 14 Barak 2015-09-09 10:10:03 UTC
*** Bug 1256040 has been marked as a duplicate of this bug. ***

Comment 15 Sandro Bonazzola 2015-09-29 09:09:30 UTC
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.

Comment 16 Meni Yakove 2015-10-21 10:09:37 UTC
Works on the new API

Comment 17 Dan Kenigsberg 2015-10-25 12:31:28 UTC
(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.

Comment 18 Dan Kenigsberg 2015-10-29 14:40:04 UTC
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.

Comment 19 Juan Hernández 2015-10-29 15:11:10 UTC
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}

Comment 20 Dan Kenigsberg 2015-10-29 15:33:17 UTC
Yes, as well as the one PUTting a new NIC. The 3.6 HostSetupNetworks intends to replace it all.


Note You need to log in before you can comment on or make changes to this bug.