mirror of https://github.com/apache/cloudstack.git
NSX: Make LB service selectable in network offering (#8512)
* NSX: Make LB service selectable in network offering * fix label * address comments * address comments
This commit is contained in:
parent
19bbec4ade
commit
a4f63053b6
|
|
@ -824,6 +824,7 @@ public class ApiConstants {
|
|||
public static final String SPLIT_CONNECTIONS = "splitconnections";
|
||||
public static final String FOR_VPC = "forvpc";
|
||||
public static final String FOR_NSX = "fornsx";
|
||||
public static final String NSX_SUPPORT_LB = "nsxsupportlb";
|
||||
public static final String FOR_TUNGSTEN = "fortungsten";
|
||||
public static final String SHRINK_OK = "shrinkok";
|
||||
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
|
||||
|
|
|
|||
|
|
@ -154,6 +154,12 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
since = "4.20.0")
|
||||
private String nsxMode;
|
||||
|
||||
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering for NSX network offering supports Load balancer service.",
|
||||
since = "4.20.0")
|
||||
private Boolean nsxSupportsLbService;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_TUNGSTEN,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering is meant to be used for Tungsten-Fabric, false otherwise.")
|
||||
|
|
@ -247,9 +253,11 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
PortForwarding.getName(),
|
||||
UserData.getName(),
|
||||
Lb.getName()
|
||||
UserData.getName()
|
||||
));
|
||||
if (getNsxSupportsLbService()) {
|
||||
services.add(Lb.getName());
|
||||
}
|
||||
if (Boolean.TRUE.equals(forVpc)) {
|
||||
services.add(NetworkACL.getName());
|
||||
} else {
|
||||
|
|
@ -294,6 +302,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
return nsxMode;
|
||||
}
|
||||
|
||||
public boolean getNsxSupportsLbService() {
|
||||
return BooleanUtils.isTrue(nsxSupportsLbService);
|
||||
}
|
||||
|
||||
public Boolean getForTungsten() {
|
||||
return forTungsten;
|
||||
}
|
||||
|
|
@ -356,6 +368,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
serviceProviderMap.put(service, List.of(routerProvider));
|
||||
else
|
||||
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
|
||||
if (!getNsxSupportsLbService()) {
|
||||
serviceProviderMap.remove(Lb.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
since = "4.20.0")
|
||||
private String nsxMode;
|
||||
|
||||
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering for NSX VPC offering supports Load balancer service.",
|
||||
since = "4.20.0")
|
||||
private Boolean nsxSupportsLbService;
|
||||
|
||||
@Parameter(name = ApiConstants.ENABLE,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "set to true if the offering is to be enabled during creation. Default is false",
|
||||
|
|
@ -149,16 +155,18 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
throw new InvalidParameterValueException("Supported services needs to be provided");
|
||||
}
|
||||
if (isForNsx()) {
|
||||
return List.of(
|
||||
supportedServices = new ArrayList<>(List.of(
|
||||
Dhcp.getName(),
|
||||
Dns.getName(),
|
||||
Lb.getName(),
|
||||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
NetworkACL.getName(),
|
||||
PortForwarding.getName(),
|
||||
UserData.getName()
|
||||
);
|
||||
));
|
||||
if (getNsxSupportsLbService()) {
|
||||
supportedServices.add(Lb.getName());
|
||||
}
|
||||
}
|
||||
return supportedServices;
|
||||
}
|
||||
|
|
@ -171,6 +179,10 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
return nsxMode;
|
||||
}
|
||||
|
||||
public boolean getNsxSupportsLbService() {
|
||||
return org.apache.commons.lang3.BooleanUtils.isTrue(nsxSupportsLbService);
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getServiceProviders() {
|
||||
Map<String, List<String>> serviceProviderMap = new HashMap<>();
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
|
||||
|
|
@ -213,6 +225,9 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
else
|
||||
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
|
||||
}
|
||||
if (!getNsxSupportsLbService()) {
|
||||
serviceProviderMap.remove(Lb.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getServiceCapabilityList() {
|
||||
|
|
|
|||
|
|
@ -1444,6 +1444,7 @@
|
|||
"label.nsx.provider.edgecluster": "NSX provider edge cluster",
|
||||
"label.nsx.provider.tier0gateway": "NSX provider tier-0 gateway",
|
||||
"label.nsx.provider.transportzone": "NSX provider transport zone",
|
||||
"label.nsx.supports.lb": "Enable NSX LB service",
|
||||
"label.num.cpu.cores": "# of CPU cores",
|
||||
"label.number": "#Rule",
|
||||
"label.numretries": "Number of retries",
|
||||
|
|
|
|||
|
|
@ -129,6 +129,16 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="12" v-if="forNsx">
|
||||
<a-col :md="12" :lg="12">
|
||||
<a-form-item name="nsxsupportlb" ref="nsxsupportlb" v-if="guestType === 'isolated'">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.nsx.supports.lb')" :tooltip="apiParams.nsxsupportlb.description"/>
|
||||
</template>
|
||||
<a-switch v-model:checked="form.nsxsupportlb" @change="val => { handleNsxLbService(val) }" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item name="nsxmode" ref="nsxmode" v-if="forNsx">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.nsxmode')" :tooltip="apiParams.nsxmode.description"/>
|
||||
|
|
@ -633,7 +643,8 @@ export default {
|
|||
conservemode: true,
|
||||
availability: 'optional',
|
||||
egressdefaultpolicy: 'deny',
|
||||
ispublic: this.isPublic
|
||||
ispublic: this.isPublic,
|
||||
nsxsupportlb: true
|
||||
})
|
||||
this.rules = reactive({
|
||||
name: [{ required: true, message: this.$t('message.error.name') }],
|
||||
|
|
@ -851,6 +862,12 @@ export default {
|
|||
supportedServices = supportedServices.filter(svc => {
|
||||
return Object.keys(this.nsxSupportedServicesMap).includes(svc.name)
|
||||
})
|
||||
supportedServices = supportedServices.map(svc => {
|
||||
if (!['Dhcp', 'Dns', 'UserData'].includes(svc.name)) {
|
||||
svc.provider = [this.NSX]
|
||||
}
|
||||
return svc
|
||||
})
|
||||
self.supportedSvcs = self.supportedServices
|
||||
self.supportedServices = supportedServices
|
||||
self.supportedServiceLoading = false
|
||||
|
|
@ -889,6 +906,15 @@ export default {
|
|||
}
|
||||
this.fetchSupportedServiceData()
|
||||
},
|
||||
handleNsxLbService (supportLb) {
|
||||
if (!supportLb && 'Lb' in this.nsxSupportedServicesMap) {
|
||||
delete this.nsxSupportedServicesMap.Lb
|
||||
}
|
||||
if (supportLb && !('Lb' in this.nsxSupportedServicesMap)) {
|
||||
this.nsxSupportedServicesMap.Lb = this.NSX
|
||||
}
|
||||
this.fetchSupportedServiceData()
|
||||
},
|
||||
handleLbTypeChange (lbType) {
|
||||
this.lbType = lbType
|
||||
this.updateSupportedServices()
|
||||
|
|
@ -998,6 +1024,7 @@ export default {
|
|||
if (values.fornsx === true) {
|
||||
params.fornsx = true
|
||||
params.nsxmode = values.nsxmode
|
||||
params.nsxsupportlb = values.nsxsupportlb
|
||||
}
|
||||
if (values.guestiptype === 'shared' || values.guestiptype === 'isolated') {
|
||||
if (values.conservemode !== true) {
|
||||
|
|
|
|||
|
|
@ -76,10 +76,18 @@
|
|||
<a-switch v-model:checked="form.fornsx" @change="val => { handleForNsxChange(val) }" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="12" :lg="12" v-if="forNsx">
|
||||
<a-form-item name="nsxsupportlb" ref="nsxsupportlb">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.nsx.supports.lb')" :tooltip="apiParams.nsxsupportlb.description"/>
|
||||
</template>
|
||||
<a-switch v-model:checked="form.nsxsupportlb" @change="val => { handleNsxLbService(val) }" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item name="nsxmode" ref="nsxmode" v-if="forNsx">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.nsx.mode')" :tooltip="apiParams.nsxmode.description"/>
|
||||
<tooltip-label :title="$t('label.nsxmode')" :tooltip="apiParams.nsxmode.description"/>
|
||||
</template>
|
||||
<a-select
|
||||
v-if="showMode"
|
||||
|
|
@ -293,7 +301,8 @@ export default {
|
|||
regionlevelvpc: true,
|
||||
distributedrouter: true,
|
||||
ispublic: true,
|
||||
internetprotocol: this.internetProtocolValue
|
||||
internetprotocol: this.internetProtocolValue,
|
||||
nsxsupportlb: true
|
||||
})
|
||||
this.rules = reactive({
|
||||
name: [{ required: true, message: this.$t('message.error.name') }],
|
||||
|
|
@ -482,8 +491,24 @@ export default {
|
|||
async handleForNsxChange (forNsx) {
|
||||
this.forNsx = forNsx
|
||||
this.showMode = forNsx
|
||||
if (forNsx) {
|
||||
this.form.nsxsupportlb = true
|
||||
this.handleNsxLbService(true)
|
||||
}
|
||||
this.fetchSupportedServiceData()
|
||||
},
|
||||
handleNsxLbService (supportLb) {
|
||||
if (!supportLb) {
|
||||
this.supportedServices = this.supportedServices.filter(svc => svc.name !== 'Lb')
|
||||
}
|
||||
if (supportLb) {
|
||||
this.supportedServices.push({
|
||||
name: 'Lb',
|
||||
enabled: true,
|
||||
provider: [{ name: 'Nsx' }]
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSupportedServiceChange (service, checked, provider) {
|
||||
if (service === 'Connectivity') {
|
||||
this.connectivityServiceChecked = checked
|
||||
|
|
@ -561,6 +586,7 @@ export default {
|
|||
if (values.fornsx === true) {
|
||||
params.fornsx = true
|
||||
params.nsxmode = values.nsxmode
|
||||
params.nsxsupportlb = values.nsxsupportlb
|
||||
}
|
||||
if (this.selectedServiceProviderMap != null) {
|
||||
var supportedServices = Object.keys(this.selectedServiceProviderMap)
|
||||
|
|
|
|||
Loading…
Reference in New Issue