def areOptionsApplied(self): # TODO: this method returns True iff self.options are a subset of the # TODO: current bonding options. VDSM should probably compute if the # TODO: non-default settings are equal to the non-default state. # 'custom' is not a real bond option, it just piggybacks custom values options = remove_custom_bond_option(self.options) if options == '': return True confOpts = [option.split('=', 1) for option in options.split(' ')] activeOpts = bond_options.properties( self.name, filter_properties=(name for name, _ in confOpts)) return all(value in activeOpts[name] for name, value in confOpts)
def areOptionsApplied(self): # TODO: this method returns True iff self.options are a subset of the # TODO: current bonding options. VDSM should probably compute if the # TODO: non-default settings are equal to the non-default state. # 'custom' is not a real bond option, it just piggybacks custom values options = remove_custom_bond_option(self.options) if options == '': return True confOpts = [option.split('=', 1) for option in options.split(' ')] activeOpts = bond_options.properties( self.name, filter_properties=(name for name, _ in confOpts)) return all(value in activeOpts[name] for name, value in confOpts)
def addBonding(self, bond, net_info, **opts): """ Create ifcfg-* file with proper fields for bond """ # 'custom' is not a real bond option, it just piggybacks custom values options = remove_custom_bond_option(bond.options) conf = 'BONDING_OPTS=%s\n' % pipes.quote(options) opts['hotplug'] = 'no' # So that udev doesn't trigger an ifup if bond.bridge: conf += 'BRIDGE=%s\n' % pipes.quote(bond.bridge.name) conf += 'ONBOOT=yes\n' ipv4, ipv6, mtu, nameservers = self._getIfaceConfValues(bond, net_info) self._createConfFile(conf, bond.name, ipv4, ipv6, mtu, nameservers, **opts) # create the bonding device to avoid initscripts noise with open(BONDING_MASTERS) as info: names = info.read().split() if bond.name not in names: with open(BONDING_MASTERS, 'w') as bondingMasters: bondingMasters.write('+%s\n' % bond.name)
def addBonding(self, bond, net_info, **opts): """ Create ifcfg-* file with proper fields for bond """ # 'custom' is not a real bond option, it just piggybacks custom values options = remove_custom_bond_option(bond.options) conf = 'BONDING_OPTS=%s\n' % pipes.quote(options) opts['hotplug'] = 'no' # So that udev doesn't trigger an ifup if bond.bridge: conf += 'BRIDGE=%s\n' % pipes.quote(bond.bridge.name) conf += 'ONBOOT=yes\n' ipv4, ipv6, mtu, nameservers = self._getIfaceConfValues(bond, net_info) self._createConfFile(conf, bond.name, ipv4, ipv6, mtu, nameservers, **opts) # create the bonding device to avoid initscripts noise with open(BONDING_MASTERS) as info: names = info.read().split() if bond.name not in names: with open(BONDING_MASTERS, 'w') as bondingMasters: bondingMasters.write('+%s\n' % bond.name)