NSX: add global setting to configure load balancer service size

This commit is contained in:
Pearl Dsilva 2024-01-08 15:32:37 -05:00
parent 886c071a6c
commit dc5ee54976
2 changed files with 6 additions and 1 deletions

View File

@ -106,6 +106,9 @@ public interface NetworkOrchestrationService {
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;

View File

@ -72,6 +72,7 @@ import com.vmware.vapi.internal.protocol.RestProtocol;
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 @@ public class NsxApiClient {
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);