cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/4.3 to 4fb54ca
Date Wed, 11 Dec 2013 10:08:45 GMT
Updated Branches:
  refs/heads/4.3 c2a62c3a1 -> 4fb54ca32


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.

Conflicts:
	engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
	plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
	plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
	plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
	plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
	server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
	server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
	setup/db/db/schema-421to430.sql


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

Branch: refs/heads/4.3
Commit: 4fb54ca32d0d191adec782d2af028f5f063506f8
Parents: c2a62c3
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Tue Dec 10 06:19:00 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Wed Dec 11 15:36:22 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4fb54ca3/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 cd8379b..e08923c 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -492,6 +492,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/4fb54ca3/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 e8ef0d2..9e0cfc4 100644
--- a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
@@ -54,6 +54,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();
@@ -95,6 +96,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/4fb54ca3/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 c1c9834..072d294 100644
--- a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
@@ -68,7 +68,10 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity,
Identity
     @Column(name="is_gslb_provider")
     private boolean gslbProvider;
 
-    @Column(name="gslb_site_publicip")
+    @Column(name = "is_exclusive_gslb_provider")
+    private boolean exclusiveGslbProvider;
+
+    @Column(name = "gslb_site_publicip")
     private String gslbSitePublicIP;
 
     @Column(name="gslb_site_privateip")
@@ -201,6 +204,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/4fb54ca3/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 fc2256b..77916dd 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
@@ -320,7 +320,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
 
         String deviceType = NetworkDevice.F5BigIpLoadBalancer.getName();
         lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(),
cmd.getPassword(),
-                deviceType, new F5BigIpResource(), false, null, null);
+                deviceType, new F5BigIpResource(), false, false, null, null);
 
         if (lbDeviceVO != null) {
             lbHost = _hostDao.findById(lbDeviceVO.getHostId());
@@ -374,7 +374,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
         }
 
         return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(),
cmd.getPassword(),
-                deviceName, new F5BigIpResource(), false, null, null);
+                deviceName, new F5BigIpResource(), false, false, null, null);
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4fb54ca3/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 d04a183..155247f 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
@@ -59,7 +59,7 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
 
     @Parameter(name = ApiConstants.GSLB_PROVIDER, 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")
@@ -69,6 +69,12 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
             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 ///////////////////////
     /////////////////////////////////////////////////////
@@ -94,7 +100,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/4fb54ca3/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 1348788..6abbc07 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
@@ -63,7 +63,12 @@ public class NetscalerLoadBalancerResponse extends BaseResponse {
     @SerializedName(ApiConstants.GSLB_PROVIDER) @Param(description="true if NetScaler device
is provisioned to be a GSLB service provider")
     private Boolean isGslbProvider;
 
-    @SerializedName(ApiConstants.GSLB_PROVIDER_PUBLIC_IP) @Param(description="public IP of
the NetScaler representing GSLB site")
+    @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;
 
     @SerializedName(ApiConstants.GSLB_PROVIDER_PRIVATE_IP) @Param(description="private IP
of the NetScaler representing GSLB site")
@@ -122,6 +127,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/4fb54ca3/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 de3d7e8..2ed2605 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
 
         }
 
-        ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(),
cmd.getUrl(),
-                cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(),
cmd.isGslbProvider(),
-                cmd.getSitePublicIp(), cmd.getSitePrivateIp());
+        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.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/4fb54ca3/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 cb00614..07740ad 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
@@ -47,9 +47,8 @@ public interface ExternalLoadBalancerDeviceManager extends Manager{
      * @param server resource that will handle the commands specific to this device 
      * @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);
+    public ExternalLoadBalancerDeviceVO addExternalLoadBalancer(long physicalNetworkId, String
url, String username, String password, String deviceName,
+        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/4fb54ca3/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 8d54541..78cc88d 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
@@ -197,9 +197,9 @@ 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) {
+    public ExternalLoadBalancerDeviceVO addExternalLoadBalancer(long physicalNetworkId, String
url, String username, String password, final String deviceName,
+        ServerResource resource, final boolean gslbProvider, final boolean exclusiveGslbProivider,
+        final String gslbSitePublicIp, final String gslbSitePrivateIp) {
 
         PhysicalNetworkVO pNetwork = null;
         final NetworkDevice ntwkDevice = NetworkDevice.getNetworkDevice(deviceName);
@@ -283,6 +283,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()));
@@ -527,9 +528,9 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
                                     "&publicipvlan=" + publicIPVlanTag + "&publicipgateway="
+ publicIPgateway;
                             ExternalLoadBalancerDeviceVO lbAppliance = null;
                             try {
-                                lbAppliance = addExternalLoadBalancer(physicalNetworkId,
url, username, password,
-                                        createLbAnswer.getDeviceName(), createLbAnswer.getServerResource(),
false,
-                                        null, null);
+                                lbAppliance =
+                                    addExternalLoadBalancer(physicalNetworkId, url, username,
password, createLbAnswer.getDeviceName(),
+                                        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/4fb54ca3/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index 3a19295..1d9fe8d 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -822,3 +822,5 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT',
'VMSna
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager',
"vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0);
 
 UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait",
"vmsnapshot.max");
+
+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