Red Hat Bugzilla – Bug 857160
Unable to create bonded interface for the rhevm network
Last modified: 2016-02-10 14:54:15 EST
Created attachment 612526 [details]
Python code snippet for bond creation
Description of problem:
Testing the rhevm-sdk with RHEVM and RHEL hosts.
RHEL host has 6 NICs, trying to configure 3 bonds for: rhevm (bond0), storage (bond1) and data (bond2). All interfaces on hosts have static IP addresses.
Succeeded in creating bond1 and bond2. But when trying to create bond0, since the rhevm bridge is already using eth0, it fails with an error message stating that the interface is in use.
2012-09-11 17:10:54,156 WARN [org.ovirt.engine.core.bll.AddBondCommand] (http-0.0.0.0-8443-9) CanDoAction of action AddBond failed. Reasons:NETWORK_INTERFACE_NAME_ALREAY_IN_USE
2012-09-11 17:10:54,157 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http-0.0.0.0-8443-9) Operation Failed: [Network interface is already in use.]
When this happens, no vdsm messages are logged on the hosts, it seems that the action is stopped at the RHEVM host.
Version-Release number of selected component (if applicable):
RHEL Server 6.3
Note: Also tested using RHEVM 3.0.5 and RHEL 6.2 hosts and with RHEVM 3.1 beta and RHEL 6.3 hosts. Same results.
Run the Python script, it creates bond1 and bond2, assigns ip/netmask/gateway/boot_protocol to them but fails to create bond0.
After searching for supporting documentation online via Customer Portal, ovirt.org, official product documentation, bugzilla and elsewhere, it seems that this hasn't been tried before using the SDK, so it might be an untested functionality but, if it works using the Web UI, it should also work using the API/SDK.
Code snippet for bond creation attached to BZ.
RHEVM logs snippets attached to BZ.
Created attachment 612527 [details]
RHEVM log snippet for bond creation
When an interface has a network attached, the interface should be updated via UpdateNetworkToVdsInterfaceCommand.
AddBondCommand should be in use for creating a bond over nics which have no network attached.
This is the reason for succeeding in bond creation for nics with no network attached and failing to update the eth0 which rhevm network is already attached.
From API side, supporting the described scenario is problematic:
1. Creating a bond is done via POST method.
2. Modifying an existing interface is done as PUT.
But what actually required here is creating a new bond by modifying an existing entity (detach a network, assemble a bond with that nic as a slave + additional slaves and attach the network to the created bond). This doesn't fall into any of REST methods.
The webadmin is capable doing so, since it uses the UpdateNetworkToVdsInterfaceCommand to achieve the complex network configuration.
But REST will use UpdateNetworkToVdsInterfaceCommand only via PUT to update a nic/network attached to, and at the moment the list of slaves is not being in REST API to the backend in UpdateNetworkToVdsInterfaceCommand.
We could add that list of slaves for the PUT method, but we'll end up with a mixed entity representing partially the slave nic and partially the required bond, e.g:
<ip gateway="10.1.1.2" netmask="255.255.255.0" address="10.1.1.1"/>
<option type="Active-Backup" value="1" name="mode"/>
<option value="100" name="miimon"/>
and the entity referred in the url is the nic that the network is attached to.
This functionality is provided via REST using the SetupNetworks api, introduced in 3.1.
this functionality was not supported in RHEVM 3.0.X api you are using
btw in 3.1 there is new action in api called setupnetworks , it should
do the job, you can try it in sdk against 3.1 beta .
1. nics = api.hosts.get(name=xxx).nics
2. nics_arr = nics.list()
(change nics in nics_arr like you'd expect them to look like)
3. my_nics = params.HostNics(host_nic=[nics_arr,nics_arr,...])
my_nics = params.HostNics(host_nic=nics_arr)
We have tried setupnetworks() with rhevm-sdk-18.104.22.168-1.el6ev and RHEV-M 3.1.0-14.el6ev.
Even if we just take the nics.list() result and call setupnetworks() with it, we get a Java NullPointerException exception on the RHEV-M server.
I'll attach a reproducer script, the current network configuration for the host we ran this against (taken from the API), and the Java stack trace.
Created attachment 614564 [details]
host network configuration
Created attachment 614565 [details]
Created attachment 614571 [details]
Java stack trace
After a few more trials, we managed to create bond0 with eth0/eth1 and the rhevm network using the setupnetworks() method. We did this by reverting the host's network configuration to rhevm on eth0, removing all other interfaces.
The NullPointerException seems to be related to the other networks we have on bond1 and bond2.
From the comments above it seems like when using sdk 3,1 with RHEV 3.1 the scenario worked and the bond was created.
Because this bugs encapsulates a lot of data which most of it is no longer relevant I would like to ask that if there is a specific issue with setupNetwork and bond creation in 3.1 please report a new bug with steps to reproduce.