set a flag so that api clients know whether to use the elb api

This commit is contained in:
Chiradeep Vittal 2011-07-27 16:00:59 -07:00
parent 5a3dd61245
commit 0ee45261e7
4 changed files with 21 additions and 0 deletions

View File

@ -49,6 +49,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setSecurityGroupsEnabled((Boolean)capabilities.get("securityGroupsEnabled"));
response.setCloudStackVersion((String)capabilities.get("cloudStackVersion"));
response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
response.setSupportELB((Boolean)capabilities.get("supportELB"));
response.setObjectName("capability");
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -30,6 +30,10 @@ public class CapabilitiesResponse extends BaseResponse {
@SerializedName("userpublictemplateenabled") @Param(description="true if user and domain admins can set templates to be shared, false otherwise")
private boolean userPublicTemplateEnabled;
@SerializedName("supportELB") @Param(description="true if region supports elastic load balancer on basic zones")
private boolean supportELB;
public boolean getSecurityGroupsEnabled() {
return securityGroupsEnabled;
@ -54,4 +58,12 @@ public class CapabilitiesResponse extends BaseResponse {
public void setUserPublicTemplateEnabled(boolean userPublicTemplateEnabled) {
this.userPublicTemplateEnabled = userPublicTemplateEnabled;
}
public void setSupportELB(boolean supportELB) {
this.supportELB = supportELB;
}
public boolean isSupportELB() {
return supportELB;
}
}

View File

@ -171,6 +171,10 @@ public enum Config {
UseUserConcentratedPodAllocation("Advanced", ManagementServer.class, Boolean.class, "use.user.concentrated.pod.allocation", "true", "If true, deployment planner applies the user concentration heuristic during VM resource allocation", "true,false"),
HostCapacityTypeToOrderClusters("Advanced", ManagementServer.class, String.class, "host.capacityType.to.order.clusters", "CPU", "The host capacity type (CPU or RAM) is used by deployment planner to order clusters during VM resource allocation", "CPU,RAM"),
EndpointeUrl("Advanced", ManagementServer.class, String.class, "endpointe.url", "http://localhost:8080/client/api", "Endpointe Url", "The endpoint callback URL"),
ElasticLoadBalancerEnabled("Advanced", ManagementServer.class, String.class, "network.loadbalancer.basiczone.elb.enabled", "true", "Whether the load balancing service is enabled for basic zones", "true,false"),
ElasticLoadBalancerNetwork("Advanced", ManagementServer.class, String.class, "network.loadbalancer.basiczone.elb.network", "guest", "Whether the elastic load balancing service public ips are taken from the public or guest network", "guest,public"),
// XenServer
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),

View File

@ -4179,9 +4179,12 @@ public class ManagementServerImpl implements ManagementServer {
Map<String, Object> capabilities = new HashMap<String, Object>();
boolean securityGroupsEnabled = false;
boolean elasticLoadBalancerEnabled = false;
List<DataCenterVO> dc = _dcDao.listSecurityGroupEnabledZones();
if (dc != null && !dc.isEmpty()) {
securityGroupsEnabled = true;
String elbEnabled = _configDao.getValue(Config.ElasticLoadBalancerEnabled.key());
elasticLoadBalancerEnabled = elbEnabled==null?false:Boolean.parseBoolean(elbEnabled);
}
String userPublicTemplateEnabled = _configs.get(Config.AllowPublicUserTemplates.key());
@ -4189,6 +4192,7 @@ public class ManagementServerImpl implements ManagementServer {
capabilities.put("securityGroupsEnabled", securityGroupsEnabled);
capabilities.put("userPublicTemplateEnabled", (userPublicTemplateEnabled == null || userPublicTemplateEnabled.equals("false") ? false : true));
capabilities.put("cloudStackVersion", getVersion());
capabilities.put("supportELB", elasticLoadBalancerEnabled);
return capabilities;
}