Petr Horáček has uploaded a new change for review. Change subject: network: api: allow removal of bond with no slaves ......................................................................
network: api: allow removal of bond with no slaves If we try to remove bond with no slaves listed in kernel, VDSM explodes and don't allow us to repair the network. With this patch, slaves checking is moved upper only to edit and add bonding functionality, remove bonding functionality objectivize slaveless bond and allow us to remove it. Change-Id: I8b472305c00e3f11a4f7ede78f84eea589ca616b Signed-off-by: Petr Horáček <[email protected]> --- M vdsm/network/api.py M vdsm/network/models.py 2 files changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/37751/1 diff --git a/vdsm/network/api.py b/vdsm/network/api.py index 7f418a9..ad4e64e 100755 --- a/vdsm/network/api.py +++ b/vdsm/network/api.py @@ -600,6 +600,9 @@ bond = Bond.objectivize(name, configurator, attrs.get('options'), attrs.get('nics'), mtu=None, _netinfo=_netinfo, destroyOnMasterRemoval='remove' in attrs) + if len(bond.slaves) == 0: + raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Missing required nics' + ' for bonding device.') return bond for name, attrs in edition: diff --git a/vdsm/network/models.py b/vdsm/network/models.py index 864a20f..f5e2868 100644 --- a/vdsm/network/models.py +++ b/vdsm/network/models.py @@ -276,6 +276,8 @@ @classmethod def objectivize(cls, name, configurator, options, nics, mtu, _netinfo, destroyOnMasterRemoval=None): + slaves = () + if nics: # New bonding or edit bonding. slaves = cls._objectivizeSlaves(name, configurator, _nicSort(nics), mtu, _netinfo) @@ -297,9 +299,6 @@ raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Missing required nics on a bonding %s ' 'that is unknown to Vdsm ' % name) - if not slaves: - raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Missing required nics' - ' for bonding device.') return cls(name, configurator, slaves=slaves, options=options, mtu=mtu, destroyOnMasterRemoval=destroyOnMasterRemoval) -- To view, visit http://gerrit.ovirt.org/37751 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8b472305c00e3f11a4f7ede78f84eea589ca616b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Petr Horáček <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
