def _translate_netinfo_bond(bond_attr, bond_running_config): bond_conf = { 'nics': sorted(bond_attr['slaves']), 'options': bonding.bondOptsForIfcfg(bond_attr['opts']), 'switch': bond_attr['switch'] } hwaddr_explicitly_set = (bond_running_config and 'hwaddr' in bond_running_config) if hwaddr_explicitly_set: bond_conf['hwaddr'] = bond_attr['hwaddr'] return bond_conf
def _normalize_bonding_opts(config_copy): for bond, bond_attr in config_copy.bonds.iteritems(): # TODO: globalize default bond options from Bond in models.py normalized_opts = _parse_bond_options(bond_attr.get('options')) if 'mode' not in normalized_opts: normalized_opts['mode'] = '0' normalized_opts.pop('custom', None) bond_attr['options'] = bonding.bondOptsForIfcfg(normalized_opts) # before d18e2f10 bondingOptions were also part of networks, so in case # we are upgrading from an older version, they should be ignored if # they exist. # REQUIRED_FOR upgrade from vdsm<=4.16.20 for net_attr in config_copy.networks.itervalues(): net_attr.pop('bondingOptions', None)
def _normalize_bonding_opts(config_copy): for bond, bond_attr in config_copy.bonds.iteritems(): # TODO: globalize default bond options from Bond in models.py normalized_opts = _parse_bond_options( bond_attr.get('options')) if "mode" not in normalized_opts: normalized_opts["mode"] = '0' normalized_opts.pop('custom', None) bond_attr['options'] = bonding.bondOptsForIfcfg(normalized_opts) # before d18e2f10 bondingOptions were also part of networks, so in case # we are upgrading from an older version, they should be ignored if # they exist. # REQUIRED_FOR upgrade from vdsm<=4.16.20 for net_attr in config_copy.networks.itervalues(): net_attr.pop('bondingOptions', None)
def _translate_netinfo_bond(bond_attr): return { 'nics': sorted(bond_attr['slaves']), 'options': bonding.bondOptsForIfcfg(bond_attr['opts']), 'switch': bond_attr['switch'] }