Description of problem:
In host setup networks dialog:
When a nic is removed from a bond and added to a new bond, an error is shown: "Error while executing action HostSetupNetworks: Interface already in use"
Steps to Reproduce:
1. Create a bond with 3 slaves. Submit
2. Open setupnetworks dialog.
3. Remove one nic from the bond.
4. Use this nic to create another bond
5. Submit -> Error
Traceback (most recent call last):
File "/usr/share/vdsm/supervdsmServer", line 111, in wrapper
res = func(*args, **kwargs)
File "/usr/share/vdsm/supervdsmServer", line 218, in setupNetworks
return setupNetworks(networks, bondings, **options)
File "/usr/share/vdsm/network/api.py", line 899, in setupNetworks
_handleBondings(bondings, configurator, in_rollback)
File "/usr/share/vdsm/network/api.py", line 646, in _handleBondings
destroyOnMasterRemoval='remove' in attrs)
File "/usr/share/vdsm/network/models.py", line 279, in objectivize
File "/usr/share/vdsm/network/models.py", line 268, in _objectivizeSlaves
(nic, nicVlans or nicNet or nicBond))
ConfigNetworkError: (24, u'nic ens11 already used by bond0')
Marcin, Alona, is the problem in the engine logic or vdsm ?
*** Bug 1283528 has been marked as a duplicate of this bug. ***
This happened because removing, editing and adding of slaves to a bond was done bond by bond, so if a nic was added to a bond which was handled before the bond from which the nic was removed the operation failed.
bond0: nic0, nic1 => nic2, nic3
bond1: nic2, nic3 => nic0, nic1
In this situation first bond0 is processed: nic0 and nic1 will be removed, but nic2 and nic3 can not yet be removed as they are part of bond1 (validation fails). Processing of bond1 will introduce errors, as nic2 and nic3 will be removed (already assigned to bond0), which will in effect reset their ifcfg files, and cause the previous attachment to bond0 to be undone.
Verified on - 4.0.0-0.0.master.20160404161620.git4ffd5a4.el7.centos and vdsm-4.17.999-900.giteba4b25.el7.centos.noarch
oVirt 4.0.0 has been released, closing current release.