Bug 1122913 - Cannot detach virtual network from bonded interface via REST API
Summary: Cannot detach virtual network from bonded interface via REST API
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-api
Version: 3.3
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: ---
: ---
Assignee: Moti Asayag
QA Contact: Pavel Stehlik
URL:
Whiteboard: network
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 11:49 UTC by Martin Helmich
Modified: 2014-07-26 18:42 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-26 18:42:10 UTC
oVirt Team: ---
Embargoed:


Attachments (Terms of Use)

Description Martin Helmich 2014-07-24 11:49:35 UTC
Description of problem:

We have a host with a bonded network interface with two slave interfaces.

It is possible to attach virtual networks to this interface using the REST API:

    POST /hosts/aed416c1-97cd-4608-b9eb-fb6331b24e67/nics/65b9cc20-10a8-4b76-b28b-ba83dff9ba5b/attach '<action><network id="8d3a59e3-c34a-4eb0-b59e-6926fd38e3eb"/></action>'
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <action>
        <network id="8d3a59e3-c34a-4eb0-b59e-6926fd38e3eb"/>
        <status>
            <state>complete</state>
        </status>
    </action>

However, detaching the same network after that fails:

    POST /hosts/aed416c1-97cd-4608-b9eb-fb6331b24e67/nics/65b9cc20-10a8-4b76-b28b-ba83dff9ba5b/detach '<action><network id="8d3a59e3-c34a-4eb0-b59e-6926fd38e3eb"/></action>'
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <action>
        <network id="8d3a59e3-c34a-4eb0-b59e-6926fd38e3eb"/>
        <status>
            <state>failed</state>
        </status>
        <fault>
            <reason>Operation Failed</reason>
            <detail>[Bond is not attached to Network.]</detail>
        </fault>
    </action>


Version-Release number of selected component (if applicable):
3.3.3-2.el6


Steps to Reproduce:

See above


Actual results:

See above


Expected results:

Network should be detached.

Comment 1 Juan Hernández 2014-07-24 14:52:00 UTC
Livnat, I don't have an environment with bonding available to check this. Can you ask someone in your team to take a look?

Comment 2 lpeer 2014-07-24 17:53:57 UTC
sure, 
I'm adding Moti to take a look.

Comment 3 Moti Asayag 2014-07-24 19:51:55 UTC
Hi Martin,

Could you specify the definition of the network with id '8d3a59e3-c34a-4eb0-b59e-6926fd38e3eb' ? 

If that network was configured with a vlan id, you should send the detach request on the vlan device, i.e. bondx.y and not on the bond itself.

Comment 4 Martin Helmich 2014-07-25 06:49:16 UTC
Hello Moti,

thanks for the quick reply! Yes, the network is configured with a vlan id. I'll try detaching the network from the vlan interface and get back to you!

Best regards,
Martin

Comment 5 Martin Helmich 2014-07-25 08:16:17 UTC
I sent the request to the vlan device, but am now receiving another error message:

    POST /hosts/aed416c1-97cd-4608-b9eb-fb6331b24e67/nics/3b7f53b6-a90b-46fe-afc9-0e728c440c6a/detach '<action/>' -H 'content-type: application/xml'
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <action>
        <status>
            <state>failed</state>
        </status>
        <fault>
            <reason>Operation Failed</reason>
            <detail>[Cannot edit Network while Host is Active, change the Host to Maintenance mode and try again.]</detail>
        </fault>
    </action>

Detaching the network using the web interface works find, by the way.

I also tried simply DELETEing the vlan interface using the REST API, which appears to kind-of work; but I'm wondering if simply deleting the interface instead of detaching the network may have any other kind of unwanted side-effects?

Comment 6 Moti Asayag 2014-07-26 18:42:10 UTC
(In reply to Martin Helmich from comment #5)
> I sent the request to the vlan device, but am now receiving another error
> message:
> 
>     POST
> /hosts/aed416c1-97cd-4608-b9eb-fb6331b24e67/nics/3b7f53b6-a90b-46fe-afc9-
> 0e728c440c6a/detach '<action/>' -H 'content-type: application/xml'
>     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>     <action>
>         <status>
>             <state>failed</state>
>         </status>
>         <fault>
>             <reason>Operation Failed</reason>
>             <detail>[Cannot edit Network while Host is Active, change the
> Host to Maintenance mode and try again.]</detail>
>         </fault>
>     </action>
> 

The 'detach' of a network via the api is a deprecated api which was developed for 3.0 clusters. Back there, the host had to be in maintenance mode in order to detach a network or to update a network on a nic. 

> Detaching the network using the web interface works find, by the way.
> 

Via the UI (in cluster level >= 3.1) a new api is used, named setup-networks [1].
It allows to update a network when a host is active. The setup networks api is a bit more complex and requires the entire target topology to be sent. 

[1] www.ovirt.org/Features/Design/Network/SetupNetworks

> I also tried simply DELETEing the vlan interface using the REST API, which
> appears to kind-of work; but I'm wondering if simply deleting the interface
> instead of detaching the network may have any other kind of unwanted
> side-effects?

The delete action is translated into 'remove-bond' action. So it seems it was designed for breaking a bond, but somehow it also supports the removal of a vlan network on top of a bond. Using DELETE method on top of a non-bond device will fail. So you can use this method which basically does what you intended to, or to use the setup-networks api.

Since there is no bug here, i'm closing this one.


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