Bug 1424810

Summary: Failed to update custom bond mode by name with KeyError
Product: [oVirt] vdsm Reporter: Michael Burman <mburman>
Component: GeneralAssignee: Edward Haas <edwardh>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.19.6CC: bugs, danken, edwardh, stirabos
Target Milestone: ovirt-4.1.3Flags: rule-engine: ovirt-4.1+
Target Release: 4.19.16   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-06 13:41:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael Burman 2017-02-19 15:41:32 UTC
Description of problem:
Failed to update custom bond mode by name with KeyError.

Failed to update and edit a bond with a custom bond mode by name, which is working fine when creating a new bond with custom bond mode by name.

When creating a new bond with custom mode by names, vdsm except it:
Mode 0 (balance-rr)
Mode 1 (active-backup)
Mode 2 (balance-xor)
Mode 3 (broadcast)
Mode 4 (802.3ad)
Mode 5 (balance-tlb)
Mode 6 (balance-alb)

But when trying to update a bond mode with custom mode name we fail with error on vdsm side:

MainProcess|jsonrpc/7::DEBUG::2017-02-19 17:01:38,551::ifcfg::574::root::(writeConfFile) Writing to file /etc/sysconfig/network-scripts/ifcfg-bond0 configuration:
# Generated by VDSM version 4.19.6-1.el7ev
DEVICE=bond0
BONDING_OPTS=mode=balance-rr
ONBOOT=yes
DEFROUTE=no
NM_CONTROLLED=no
IPV6INIT=no

MainProcess|jsonrpc/7::ERROR::2017-02-19 17:01:47,142::supervdsmServer::97::SuperVdsm.ServerCallback::(wrapper) Error in setupNetworks
Traceback (most recent call last):
  File "/usr/share/vdsm/supervdsmServer", line 95, in wrapper
    res = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vdsm/network/api.py", line 217, in setupNetworks
    _setup_networks(networks, bondings, options)
  File "/usr/lib/python2.7/site-packages/vdsm/network/api.py", line 238, in _setup_networks
    netswitch.setup(networks, bondings, options, in_rollback)
  File "/usr/lib/python2.7/site-packages/vdsm/network/netswitch.py", line 132, in setup
    _setup_legacy(legacy_nets, legacy_bonds, options, in_rollback)
  File "/usr/lib/python2.7/site-packages/vdsm/network/netswitch.py", line 150, in _setup_legacy
    in_rollback)
  File "/usr/lib/python2.7/site-packages/vdsm/network/legacy_switch.py", line 517, in bonds_setup
    _bonds_edit(edit, configurator, _netinfo)
  File "/usr/lib/python2.7/site-packages/vdsm/network/legacy_switch.py", line 589, in _bonds_edit
    configurator.editBonding(bond, _netinfo)
  File "/usr/lib/python2.7/site-packages/vdsm/network/configurators/ifcfg.py", line 191, in editBonding
    _restore_default_bond_options(bond.name, bond.options)
  File "/usr/lib/python2.7/site-packages/vdsm/network/configurators/ifcfg.py", line 980, in _restore_default_bond_options
    Bond(bond_name).set_options(parse_bond_options(desired_options))
  File "/usr/lib/python2.7/site-packages/vdsm/network/link/bond/sysfs_driver.py", line 96, in set_options
    sysfs_options.set_options(self._master, options)
  File "/usr/lib/python2.7/site-packages/vdsm/network/link/bond/sysfs_options.py", line 71, in set_options
    bond, desired_mode, options, current_options)
  File "/usr/lib/python2.7/site-packages/vdsm/network/link/bond/sysfs_options.py", line 86, in _set_untouched_options_to_defaults
    for key, value in six.iteritems(getDefaultBondingOptions(mode)):
  File "/usr/lib/python2.7/site-packages/vdsm/utils.py", line 488, in __call__
    value = self.func(*args)
  File "/usr/lib/python2.7/site-packages/vdsm/network/link/bond/sysfs_options.py", line 195, in getDefaultBondingOptions
    return defaults[mode]
KeyError: 'balance-rr'



Version-Release number of selected component (if applicable):
vdsm-4.19.6-1.el7ev.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create default bond in UI setup networks
2. Edit the bond and try to set a custom bond mode with 'mode=active-backup'

Actual results:
Failed on vdsm side

Expected results:
Should work for update as it working for new bond.

Comment 3 Michael Burman 2017-05-29 05:44:53 UTC
Verified on - vdsm-4.19.16-1.el7ev.x86_64 and  4.1.3-0.1.el7