mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5428: support NetScaler to be configured exclusively for GSLB
service and not used for LB Fix adds a boolean flag to addNetscalerLoadBalancer api, which will mark added NetScaler for exclusive GSLB service. A netscaler marked as exclusive gslb service provider is not picked for any guest network's lb provider.
This commit is contained in:
parent
e79350d256
commit
be67f5d17a
|
|
@ -502,6 +502,7 @@ public class ApiConstants {
|
|||
public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
|
||||
public static final String UCS_DN = "ucsdn";
|
||||
public static final String GSLB_PROVIDER = "gslbprovider";
|
||||
public static final String EXCLUSIVE_GSLB_PROVIDER = "isexclusivegslbprovider";
|
||||
public static final String GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip";
|
||||
public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip";
|
||||
public static final String VM_SNAPSHOT_DESCRIPTION = "description";
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLo
|
|||
allocationStateSearch.and("physicalNetworkId", allocationStateSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
allocationStateSearch.and("providerName", allocationStateSearch.entity().getProviderName(), Op.EQ);
|
||||
allocationStateSearch.and("allocationState", allocationStateSearch.entity().getAllocationState(), Op.EQ);
|
||||
allocationStateSearch.and("exclusiveGslbProvider", allocationStateSearch.entity().getExclusiveGslbProvider(), Op.EQ);
|
||||
allocationStateSearch.done();
|
||||
|
||||
deviceStatusSearch = createSearchBuilder();
|
||||
|
|
@ -99,6 +100,7 @@ public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLo
|
|||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
sc.setParameters("providerName", provider_name);
|
||||
sc.setParameters("allocationState", state);
|
||||
sc.setParameters("exclusiveGslbProvider", false);
|
||||
return search(sc, null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity, Identity
|
|||
@Column(name = "is_gslb_provider")
|
||||
private boolean gslbProvider;
|
||||
|
||||
@Column(name = "is_exclusive_gslb_provider")
|
||||
private boolean exclusiveGslbProvider;
|
||||
|
||||
@Column(name = "gslb_site_publicip")
|
||||
private String gslbSitePublicIP;
|
||||
|
||||
|
|
@ -209,6 +212,14 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity, Identity
|
|||
this.gslbProvider = gslbProvider;
|
||||
}
|
||||
|
||||
public boolean getExclusiveGslbProvider() {
|
||||
return exclusiveGslbProvider;
|
||||
}
|
||||
|
||||
public void setExclusiveGslbProvider(boolean exclusiveGslbProvider) {
|
||||
this.exclusiveGslbProvider = exclusiveGslbProvider;
|
||||
}
|
||||
|
||||
public void setGslbSitePublicIP(String gslbSitePublicIP) {
|
||||
this.gslbSitePublicIP = gslbSitePublicIP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,7 +321,8 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
|||
pNetwork = physicalNetworks.get(0);
|
||||
|
||||
String deviceType = NetworkDevice.F5BigIpLoadBalancer.getName();
|
||||
lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, new F5BigIpResource(), false, null, null);
|
||||
lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(),
|
||||
deviceType, new F5BigIpResource(), false, false, null, null);
|
||||
|
||||
if (lbDeviceVO != null) {
|
||||
lbHost = _hostDao.findById(lbDeviceVO.getHostId());
|
||||
|
|
@ -374,7 +375,8 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
|||
throw new InvalidParameterValueException("Invalid F5 load balancer device type");
|
||||
}
|
||||
|
||||
return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, new F5BigIpResource(), false, null,
|
||||
return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(),
|
||||
deviceName, new F5BigIpResource(), false, false, null,
|
||||
null);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
|
|||
type = CommandType.BOOLEAN,
|
||||
required = false,
|
||||
description = "true if NetScaler device being added is for providing GSLB service")
|
||||
private boolean isGslbProvider;
|
||||
private Boolean isGslbProvider;
|
||||
|
||||
@Parameter(name = ApiConstants.GSLB_PROVIDER_PUBLIC_IP, type = CommandType.STRING, required = false, description = "public IP of the site")
|
||||
private String gslbSitePublicIp;
|
||||
|
|
@ -85,6 +85,12 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
|
|||
@Parameter(name = ApiConstants.GSLB_PROVIDER_PRIVATE_IP, type = CommandType.STRING, required = false, description = "public IP of the site")
|
||||
private String gslbSitePrivateIp;
|
||||
|
||||
@Parameter(name = ApiConstants.EXCLUSIVE_GSLB_PROVIDER,
|
||||
type = CommandType.BOOLEAN,
|
||||
required = false,
|
||||
description = "true if NetScaler device being added is for providing GSLB service exclusively and can not be used for LB")
|
||||
private Boolean isExclusiveGslbProvider;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -110,7 +116,19 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
|
|||
}
|
||||
|
||||
public boolean isGslbProvider() {
|
||||
return isGslbProvider;
|
||||
if (isGslbProvider != null) {
|
||||
return isGslbProvider;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExclusiveGslbProvider() {
|
||||
if (isExclusiveGslbProvider != null) {
|
||||
return isExclusiveGslbProvider;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSitePublicIp() {
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ public class NetscalerLoadBalancerResponse extends BaseResponse {
|
|||
@Param(description = "true if NetScaler device is provisioned to be a GSLB service provider")
|
||||
private Boolean isGslbProvider;
|
||||
|
||||
@SerializedName(ApiConstants.EXCLUSIVE_GSLB_PROVIDER)
|
||||
@Param(description = "true if NetScaler device is provisioned exclusively to be a GSLB service provider")
|
||||
private Boolean isExclusiveGslbProvider;
|
||||
|
||||
@SerializedName(ApiConstants.GSLB_PROVIDER_PUBLIC_IP)
|
||||
@Param(description = "public IP of the NetScaler representing GSLB site")
|
||||
private String gslbSitePublicIp;
|
||||
|
|
@ -137,6 +141,10 @@ public class NetscalerLoadBalancerResponse extends BaseResponse {
|
|||
this.isGslbProvider = isGslbProvider;
|
||||
}
|
||||
|
||||
public void setExclusiveGslbProvider(boolean isExclusiveGslbProvider) {
|
||||
this.isExclusiveGslbProvider = isExclusiveGslbProvider;
|
||||
}
|
||||
|
||||
public void setGslbSitePublicIp(String publicIP) {
|
||||
this.gslbSitePublicIp = publicIP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,9 +381,14 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||
|
||||
}
|
||||
|
||||
if (cmd.isExclusiveGslbProvider() && !cmd.isGslbProvider()) {
|
||||
throw new InvalidParameterValueException("NetScaler can be provisioned to be exclusive GSLB service provider" +
|
||||
" only if its being configured as GSLB service provider also.");
|
||||
}
|
||||
|
||||
ExternalLoadBalancerDeviceVO lbDeviceVO =
|
||||
addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(),
|
||||
cmd.isGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp());
|
||||
cmd.isGslbProvider(), cmd.isExclusiveGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp());
|
||||
|
||||
return lbDeviceVO;
|
||||
}
|
||||
|
|
@ -605,6 +610,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||
response.setObjectName("netscalerloadbalancer");
|
||||
|
||||
response.setGslbProvider(lbDeviceVO.getGslbProvider());
|
||||
response.setExclusiveGslbProvider(lbDeviceVO.getExclusiveGslbProvider());
|
||||
response.setGslbSitePublicIp(lbDeviceVO.getGslbSitePublicIP());
|
||||
response.setGslbSitePrivateIp(lbDeviceVO.getGslbSitePrivateIP());
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public interface ExternalLoadBalancerDeviceManager extends Manager {
|
|||
* @return Host object for the device added
|
||||
*/
|
||||
public ExternalLoadBalancerDeviceVO addExternalLoadBalancer(long physicalNetworkId, String url, String username, String password, String deviceName,
|
||||
ServerResource resource, boolean gslbProvider, String gslbSitePublicIp, String gslbSitePrivateIp);
|
||||
ServerResource resource, boolean gslbProvider, boolean exclusiveGslbProvider, String gslbSitePublicIp, String gslbSitePrivateIp);
|
||||
|
||||
/**
|
||||
* deletes load balancer device added in to a physical network
|
||||
|
|
|
|||
|
|
@ -198,7 +198,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||
@Override
|
||||
@DB
|
||||
public ExternalLoadBalancerDeviceVO addExternalLoadBalancer(long physicalNetworkId, String url, String username, String password, final String deviceName,
|
||||
ServerResource resource, final boolean gslbProvider, final String gslbSitePublicIp, final String gslbSitePrivateIp) {
|
||||
ServerResource resource, final boolean gslbProvider, final boolean exclusiveGslbProivider,
|
||||
final String gslbSitePublicIp, final String gslbSitePrivateIp) {
|
||||
|
||||
PhysicalNetworkVO pNetwork = null;
|
||||
final NetworkDevice ntwkDevice = NetworkDevice.getNetworkDevice(deviceName);
|
||||
|
|
@ -285,6 +286,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||
if (gslbProvider) {
|
||||
lbDeviceVO.setGslbSitePublicIP(gslbSitePublicIp);
|
||||
lbDeviceVO.setGslbSitePrivateIP(gslbSitePrivateIp);
|
||||
lbDeviceVO.setExclusiveGslbProvider(exclusiveGslbProivider);
|
||||
}
|
||||
_externalLoadBalancerDeviceDao.persist(lbDeviceVO);
|
||||
DetailVO hostDetail = new DetailVO(host.getId(), ApiConstants.LOAD_BALANCER_DEVICE_ID, String.valueOf(lbDeviceVO.getId()));
|
||||
|
|
@ -528,7 +530,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
|||
try {
|
||||
lbAppliance =
|
||||
addExternalLoadBalancer(physicalNetworkId, url, username, password, createLbAnswer.getDeviceName(),
|
||||
createLbAnswer.getServerResource(), false, null, null);
|
||||
createLbAnswer.getServerResource(), false, false, null, null);
|
||||
} catch (Exception e) {
|
||||
s_logger.error("Failed to add load balancer appliance in to cloudstack due to " + e.getMessage() +
|
||||
". So provisioned load balancer appliance will be destroyed.");
|
||||
|
|
|
|||
|
|
@ -804,3 +804,5 @@ CREATE TABLE `cloud`.`network_acl_item_details` (
|
|||
ALTER TABLE `cloud`.`alert` ADD COLUMN `name` varchar(255) DEFAULT NULL COMMENT 'name of the alert';
|
||||
|
||||
UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='Vmware';
|
||||
|
||||
ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN `is_exclusive_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is acting exclusively as gslb service provider in the zone and can not be used for LB';
|
||||
|
|
|
|||
Loading…
Reference in New Issue