Bug 1262275 - Unable to add slave to bond using slave id or modify existing slave using name
Unable to add slave to bond using slave id or modify existing slave using name
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
3.6.0
noarch Unspecified
unspecified Severity low (vote)
: ovirt-3.6.1
: 3.6.1
Assigned To: Marcin Mirecki
Michael Burman
network
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-11 06:29 EDT by Marcin Mirecki
Modified: 2016-02-10 14:15 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-16 07:18:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Network
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑3.6.z+
ylavi: Triaged+
danken: testing_plan_complete?
ylavi: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 46138 master MERGED restapi: unable to add/remove slaves from bond using rest api Never
oVirt gerrit 48154 ovirt-engine-3.6 MERGED restapi: unable to add/remove slaves from bond using rest api Never

  None (edit)
Description Marcin Mirecki 2015-09-11 06:29:28 EDT
Description of problem:

Adding a new slave to a bond fails when the slave is specified by the nic id.
The same operation works correctly when slave is specified by name.

For example:
The following rest requests specyfing nics by id will fail:

POST: http://localhost:8080/ovirt-engine/api/hosts/<host id>setupnetworks
<action>
  <modified_bonds>
    <host_nic id="c5fb3db6-44f3-42a0-bb18-6e7905a79400">
    <bonding>
        <slaves>
            <host_nic id="db31f40e-671a-4cff-8a14-9784116e44b8"/>
            <host_nic id="ea0216b9-2b39-4c9f-b70d-0462e7fa674a"/>
            <host_nic id="f572972c-cca8-4ed4-9907-aa39eaca14d1"/>
        </slaves>
    </bonding>
  </host_nic>
 </modified_bonds>
</action>

The following rest request will work fine:
<action>
    <modified_bonds>
      <host_nic id="c5fb3db6-44f3-42a0-bb18-6e7905a79400">
            <bonding>
                <slaves>
                    <host_nic>
                        <name>ens13</name>
                    </host_nic>
                    <host_nic >
                        <name>ens14</name>
                    </host_nic>
                </slaves>
            </bonding>
        </host_nic>
    </modified_bonds>
</action>

The opposite happens when an existing slave is specified by name. In that case the follwing error message is recieved:
Cannot setup Networks. Network interface 'ens13' is used multiple times in new or modified bonds in this request. Slave can be neither shared by multiple bonds nor used multiple times in one bond.

Cause of problem:

The problem lies in the code which creates HostSetupNetworksParameters.
HostNICMapper maps the rest request data to a Bond instance. The bond object is created based on the existing bond object, with existing slaves. After that the following code adds the new bonds from the request data.
HostNICMapper:112
                for (HostNIC slave : model.getBonding().getSlaves().getSlaves()) {
                    if (slave.isSetName()) {
                        entity.getSlaves().add(slave.getName());
                    }
So only the hosts with a name set are added.

When modyfing an existing slave, the code above will add the slave to the bond a second time, so the Bond object in HostSetupNetworksParameters will have this specific slave listed twice.


How reproducible:
Execute the following rest request:
The following rest requests specyfing nics by id will fail:

POST: http://localhost:8080/ovirt-engine/api/hosts/<host id>setupnetworks
<action>
  <modified_bonds>
    <host_nic id="c5fb3db6-44f3-42a0-bb18-6e7905a79400">
    <bonding>
        <slaves>
            <host_nic id="<slave nic id>"/>
            <host_nic id="<slave nic id>"/>

        </slaves>
    </bonding>
  </host_nic>
 </modified_bonds>
</action>


Actual results:
Host is not added to bond

Expected results:
Host is added to bond

Additional info:
Comment 1 Marcin Mirecki 2015-09-11 06:34:40 EDT
An additional problem is the removing of slave nics from a bond.
The same code only handles adding nics to a bond (by name), but does not check if any of the slaves have been removed.
Comment 2 Martin Mucha 2015-09-11 08:43:20 EDT
note: provided change 46054 changes only the way in which is bonds slaves collection interpreted: relative-->absolute.
Comment 3 Red Hat Bugzilla Rules Engine 2015-10-19 06:53:23 EDT
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.
Comment 4 Yaniv Lavi 2015-10-29 08:33:52 EDT
In oVirt testing is done on single release by default. Therefore I'm removing the 4.0 flag. If you think this bug must be tested in 4.0 as well, please re-add the flag. Please note we might not have testing resources to handle the 4.0 clone.
Comment 5 Michael Burman 2015-12-08 03:48:16 EST
Verified on - 3.6.1.1-0.1.el6
Comment 6 Sandro Bonazzola 2015-12-16 07:18:08 EST
According to verification status and target milestone this issue should be fixed in oVirt 3.6.1. Closing current release.

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