cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [24/50] [abbrv] git commit: updated refs/heads/ui-restyle to 326b3a6
Date Tue, 10 Dec 2013 23:52:04 GMT
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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/be67f5d1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/be67f5d1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/be67f5d1

Branch: refs/heads/ui-restyle
Commit: be67f5d17afd65e99759eb8f538016004b529588
Parents: e79350d
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Tue Dec 10 06:19:00 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Tue Dec 10 06:20:58 2013 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java |  1 +
 .../dao/ExternalLoadBalancerDeviceDaoImpl.java  |  2 ++
 .../dao/ExternalLoadBalancerDeviceVO.java       | 11 ++++++++++
 .../element/F5ExternalLoadBalancerElement.java  |  6 ++++--
 .../commands/AddNetscalerLoadBalancerCmd.java   | 22 ++++++++++++++++++--
 .../response/NetscalerLoadBalancerResponse.java |  8 +++++++
 .../cloud/network/element/NetscalerElement.java |  8 ++++++-
 .../ExternalLoadBalancerDeviceManager.java      |  2 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java  |  6 ++++--
 setup/db/db/schema-421to430.sql                 |  2 ++
 10 files changed, 60 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 745a722..a132e54 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -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";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
index f12d063..432b4a2 100644
--- a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
@@ -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);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
index 8cc13fd..d82d537 100644
--- a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
@@ -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;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
index daabf36..1a591e1 100644
--- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
+++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
@@ -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);
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
index 9188f3a..1237e7f 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
@@ -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() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
index 63de361..8b942f4 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
@@ -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;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index 7e68f4e..a2bda90 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -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());
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
index 9f13c2a..850d0d7 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
@@ -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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
index ea23b8a..2a22ac2 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
@@ -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.");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be67f5d1/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index cf6f596..5f81050 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -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';


Mime
View raw message