NSX: add global setting to configure load balancer service size
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
index 90cfaf9..925e792 100644
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
+++ b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
@@ -106,6 +106,9 @@
static final ConfigKey<Boolean> NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false",
"Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null);
+ static final ConfigKey<String> NSX_LB_SIZE = new ConfigKey<>(String.class, "nsx.lb.size", "Advanced", "SMALL",
+ "Indicates the NSX load balancer service size", true, Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "SMALL, MEDIUM, LARGE, XLARGE");
+
List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
throws ConcurrentOperationException;
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
index a9c13af..6705c08 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
@@ -72,6 +72,7 @@
import com.vmware.vapi.internal.protocol.client.rest.authn.BasicAuthenticationAppender;
import com.vmware.vapi.protocol.HttpConfiguration;
import com.vmware.vapi.std.errors.Error;
+import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.resource.NsxLoadBalancerMember;
import org.apache.cloudstack.resource.NsxNetworkRule;
import org.apache.cloudstack.utils.NsxControllerUtils;
@@ -533,11 +534,12 @@
if (Objects.nonNull(lbService)) {
return;
}
+ String lbSize = LBSize.valueOf(NetworkOrchestrationService.NSX_LB_SIZE.value()).name();
lbService = new LBService.Builder()
.setId(lbName)
.setDisplayName(lbName)
.setEnabled(true)
- .setSize(LBSize.SMALL.name())
+ .setSize(lbSize)
.setConnectivityPath(TIER_1_GATEWAY_PATH_PREFIX + tier1GatewayName)
.build();
lbServices.patch(lbName, lbService);