Update bond properties depending on DPDK status
Bond should have 'ovs' type if DPDK is enabled on it, and 'linux' type in case of disabled DPDK. Closes-Bug: #1566312 Change-Id: I555a603fc53deaf38d801b55631ef496ccff004b
This commit is contained in:
parent
156d63fe30
commit
3b350fdd1e
|
@ -453,7 +453,7 @@
|
||||||
"physical_network": "Physical Network Name",
|
"physical_network": "Physical Network Name",
|
||||||
"dpdk": "DPDK",
|
"dpdk": "DPDK",
|
||||||
"dpdk_description": "The Data Plane Development Kit (DPDK) provides high-performance packet processing libraries and user space drivers.",
|
"dpdk_description": "The Data Plane Development Kit (DPDK) provides high-performance packet processing libraries and user space drivers.",
|
||||||
"dpdk_in_ovs_bond": "DPDK can not be disabled in OVS bond",
|
"locked_dpdk_bond": "DPDK can not be enabled because not all slave interfaces support it",
|
||||||
"different_availability": "<Different Availability>",
|
"different_availability": "<Different Availability>",
|
||||||
"availability_tooltip": "Some network interfaces do not support this feature, therefore, these properties will not change after saving."
|
"availability_tooltip": "Some network interfaces do not support this feature, therefore, these properties will not change after saving."
|
||||||
},
|
},
|
||||||
|
|
|
@ -356,9 +356,7 @@ var EditNodeInterfacesScreen = React.createClass({
|
||||||
var bondMode = _.flatten(
|
var bondMode = _.flatten(
|
||||||
_.pluck(this.props.bondingConfig.properties[bondType].mode, 'values')
|
_.pluck(this.props.bondingConfig.properties[bondType].mode, 'values')
|
||||||
)[0];
|
)[0];
|
||||||
bondName = this.props.interfaces.generateBondName(
|
bondName = this.props.interfaces.generateBondName('bond');
|
||||||
bondType === 'linux' ? 'bond' : 'ovs-bond'
|
|
||||||
);
|
|
||||||
|
|
||||||
bond = new models.Interface({
|
bond = new models.Interface({
|
||||||
type: 'bond',
|
type: 'bond',
|
||||||
|
@ -657,10 +655,9 @@ var EditNodeInterfacesScreen = React.createClass({
|
||||||
errors={this.state.interfacesErrors[ifcName]}
|
errors={this.state.interfacesErrors[ifcName]}
|
||||||
validate={this.validate}
|
validate={this.validate}
|
||||||
removeInterfaceFromBond={this.removeInterfaceFromBond}
|
removeInterfaceFromBond={this.removeInterfaceFromBond}
|
||||||
bondingProperties={
|
bondingProperties={this.props.bondingConfig.properties}
|
||||||
this.props.bondingConfig.properties[availableBondingTypes[ifcName][0]]
|
|
||||||
}
|
|
||||||
availableBondingTypes={availableBondingTypes[ifcName]}
|
availableBondingTypes={availableBondingTypes[ifcName]}
|
||||||
|
getAvailableBondingTypes={this.getAvailableBondingTypes}
|
||||||
interfaceSpeeds={interfaceSpeeds[index]}
|
interfaceSpeeds={interfaceSpeeds[index]}
|
||||||
interfaceNames={interfaceNames[index]}
|
interfaceNames={interfaceNames[index]}
|
||||||
/>
|
/>
|
||||||
|
@ -765,10 +762,12 @@ var NodeInterface = React.createClass({
|
||||||
},
|
},
|
||||||
getAvailableBondingModes() {
|
getAvailableBondingModes() {
|
||||||
var {configModels, bondingProperties} = this.props;
|
var {configModels, bondingProperties} = this.props;
|
||||||
var modes = bondingProperties.mode;
|
var ifc = this.props.interface;
|
||||||
|
var bondType = ifc.get('bond_properties').type__;
|
||||||
|
var modes = bondingProperties[bondType].mode;
|
||||||
|
|
||||||
var availableModes = [];
|
var availableModes = [];
|
||||||
var interfaces = this.props.interface.isBond() ? this.props.interface.getSlaveInterfaces() :
|
var interfaces = ifc.isBond() ? ifc.getSlaveInterfaces() : [ifc];
|
||||||
[this.props.interface];
|
|
||||||
_.each(interfaces, (ifc) => {
|
_.each(interfaces, (ifc) => {
|
||||||
availableModes.push(_.reduce(modes, (result, modeSet) => {
|
availableModes.push(_.reduce(modes, (result, modeSet) => {
|
||||||
if (
|
if (
|
||||||
|
@ -784,7 +783,8 @@ var NodeInterface = React.createClass({
|
||||||
return _.intersection(...availableModes);
|
return _.intersection(...availableModes);
|
||||||
},
|
},
|
||||||
getBondPropertyValues(propertyName, value) {
|
getBondPropertyValues(propertyName, value) {
|
||||||
return _.flatten(_.pluck(this.props.bondingProperties[propertyName], value));
|
var bondType = this.props.interface.get('bond_properties').type__;
|
||||||
|
return _.flatten(_.pluck(this.props.bondingProperties[bondType][propertyName], value));
|
||||||
},
|
},
|
||||||
updateBondProperties(options) {
|
updateBondProperties(options) {
|
||||||
var bondProperties = _.cloneDeep(this.props.interface.get('bond_properties')) || {};
|
var bondProperties = _.cloneDeep(this.props.interface.get('bond_properties')) || {};
|
||||||
|
@ -1021,20 +1021,45 @@ var NodeInterface = React.createClass({
|
||||||
return this.renderDPDK(errors);
|
return this.renderDPDK(errors);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
changeBondType(newType) {
|
||||||
|
this.props.interface.set('bond_properties.type__', newType);
|
||||||
|
var newMode = _.flatten(
|
||||||
|
_.pluck(this.props.bondingProperties[newType].mode, 'values')
|
||||||
|
)[0];
|
||||||
|
this.bondingModeChanged(null, newMode);
|
||||||
|
},
|
||||||
renderDPDK(errors) {
|
renderDPDK(errors) {
|
||||||
var ifc = this.props.interface;
|
var ifc = this.props.interface;
|
||||||
var isOVSBond = ifc.isBond() && ifc.get('bond_properties').type__ === 'ovs';
|
var currentDPDKValue = ifc.get('interface_properties').dpdk.enabled;
|
||||||
|
var isBond = ifc.isBond();
|
||||||
|
|
||||||
|
// check if DPDK can be switched
|
||||||
|
var newBondType = isBond ?
|
||||||
|
_.without(_.intersection(... _.compact(
|
||||||
|
_.map(ifc.getSlaveInterfaces(), (slave) => {
|
||||||
|
slave.get('interface_properties').dpdk.enabled = !currentDPDKValue;
|
||||||
|
var bondTypes = this.props.getAvailableBondingTypes(slave);
|
||||||
|
slave.get('interface_properties').dpdk.enabled = currentDPDKValue;
|
||||||
|
return bondTypes;
|
||||||
|
})
|
||||||
|
)), ifc.get('bond_properties').type__)[0]
|
||||||
|
:
|
||||||
|
null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='dpdk-panel'>
|
<div className='dpdk-panel'>
|
||||||
<div className='description'>{i18n(ns + 'dpdk_description')}</div>
|
<div className='description'>{i18n(ns + 'dpdk_description')}</div>
|
||||||
<Input
|
<Input
|
||||||
type='checkbox'
|
type='checkbox'
|
||||||
label={i18n('common.enabled')}
|
label={i18n('common.enabled')}
|
||||||
checked={ifc.get('interface_properties').dpdk.enabled}
|
checked={currentDPDKValue}
|
||||||
name='dpdk.enabled'
|
name='dpdk.enabled'
|
||||||
onChange={this.onInterfacePropertiesChange}
|
onChange={(propertyName, propertyValue) => {
|
||||||
disabled={this.props.locked || isOVSBond}
|
this.onInterfacePropertiesChange('dpdk.enabled', propertyValue);
|
||||||
tooltipText={isOVSBond && i18n(ns + 'dpdk_in_ovs_bond')}
|
if (isBond) this.changeBondType(newBondType);
|
||||||
|
}}
|
||||||
|
disabled={this.props.locked || isBond && !newBondType}
|
||||||
|
tooltipText={isBond && !newBondType && i18n(ns + 'locked_dpdk_bond')}
|
||||||
wrapperClassName='dpdk-control'
|
wrapperClassName='dpdk-control'
|
||||||
error={errors && errors.common}
|
error={errors && errors.common}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue