cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject [47/50] [abbrv] git commit: refs/heads/gslb-wip - add the ability to add NetScaler device as GSLB provider in a zone
Date Mon, 18 Mar 2013 10:14:48 GMT
add the ability to add NetScaler device as GSLB provider in a zone


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

Branch: refs/heads/gslb-wip
Commit: 11a7546f1ebca7df9a4779db156d1b8cd7d15671
Parents: 89c33a0
Author: Murali Reddy <murali.reddy@citrix.com>
Authored: Mon Mar 11 12:42:51 2013 +0530
Committer: Murali Reddy <murali.reddy@citrix.com>
Committed: Mon Mar 11 12:42:51 2013 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java    |    2 +
 .../element/F5ExternalLoadBalancerElement.java     |    4 +-
 .../api/commands/AddNetscalerLoadBalancerCmd.java  |   18 +++++++-
 .../cloud/network/element/NetscalerElement.java    |   34 ++++++++++---
 .../network/ExternalLoadBalancerDeviceManager.java |    3 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java     |   38 ++++++++++----
 .../network/dao/ExternalLoadBalancerDeviceDao.java |   11 ++++-
 .../dao/ExternalLoadBalancerDeviceDaoImpl.java     |   25 ++++++++--
 .../network/dao/ExternalLoadBalancerDeviceVO.java  |   24 +++++++++
 .../cloudstack/region/RegionServiceProvider.java   |    4 +-
 .../gslb/GlobalLoadBalancingRulesServiceImpl.java  |    6 +-
 .../region/gslb/GslbServiceProvider.java           |    4 +-
 setup/db/create-schema.sql                         |    4 +-
 13 files changed, 140 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 e1cf9a4..e930d86 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -444,6 +444,8 @@ 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 GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip";
+    public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip";
 
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 f9baad2..640e19a 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
@@ -264,7 +264,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);
+                deviceType, new F5BigIpResource(), false, null, null);
 
         if (lbDeviceVO != null) {
             lbHost = _hostDao.findById(lbDeviceVO.getHostId());
@@ -318,7 +318,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
         }
 
         return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(),
cmd.getPassword(),
-                deviceName, new F5BigIpResource(), false);
+                deviceName, new F5BigIpResource(), false, null, null);
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 9de15d2..e4327b4 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
@@ -56,9 +56,17 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
     private String deviceType;
 
     @Parameter(name = ApiConstants.GSLB_PROVIDER, type = CommandType.BOOLEAN, required =
false,
-            description = "true if NetScaler device bieng added is for providing GSLB service")
+            description = "true if NetScaler device being added is for providing GSLB service")
     private boolean  isGslbProvider;
 
+    @Parameter(name = ApiConstants.GSLB_PROVIDER_PUBLIC_IP, type = CommandType.STRING, required
= false,
+            description = "public IP of the site")
+    private String gslbSitePublicIp;
+
+    @Parameter(name = ApiConstants.GSLB_PROVIDER_PRIVATE_IP, type = CommandType.STRING, required
= false,
+            description = "public IP of the site")
+    private String gslbSitePrivateIp;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -87,6 +95,14 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
         return isGslbProvider;
     }
 
+    public String getSitePublicIp() {
+        return gslbSitePublicIp;
+    }
+
+    public String getSitePrivateIp() {
+        return gslbSitePrivateIp;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 4392544..dedaeaf 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
@@ -80,7 +80,7 @@ import javax.inject.Inject;
 import java.net.URI;
 import java.util.*;
 
-@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class})
+@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class,
GslbServiceProvider.class})
 public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider,
         NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer,
StaticNatServiceProvider,
         GslbServiceProvider {
@@ -305,8 +305,26 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
impl
             throw new InvalidParameterValueException(msg);
         }
 
+        if (cmd.isGslbProvider()) {
+
+            if (!deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName()) &&
+                    !deviceName.equals(NetworkDevice.NetscalerMPXLoadBalancer.getName()))
{
+                String msg = "Only Netscaler VPX or MPX load balancers can be specified as
GSLB service provider";
+                s_logger.debug(msg);
+                throw new InvalidParameterValueException(msg);
+            }
+
+            if (cmd.getSitePublicIp() == null || cmd.getSitePrivateIp() == null) {
+                String msg = "Public and Privae IP needs to provided for NetScaler that will
be GSLB provider";
+                s_logger.debug(msg);
+                throw new InvalidParameterValueException(msg);
+            }
+        }
+
         ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(),
cmd.getUrl(),
-                cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(),
cmd.isGslbProvider());
+                cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(),
cmd.isGslbProvider(),
+                cmd.getSitePublicIp(), cmd.getSitePrivateIp());
+
         return lbDeviceVO;
     }
 
@@ -791,17 +809,17 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
impl
 
     @Override
     public boolean isServiceEnabledInZone(long zoneId) {
-        return false;  //To change body of implemented methods use File | Settings | File
Templates.
+        return false;
     }
 
     @Override
-    public String getProviderPublicIp(long zoneId) {
-        return null;  //To change body of implemented methods use File | Settings | File
Templates.
+    public String getZoneGslbProviderPublicIp(long zoneId) {
+        return null;
     }
 
     @Override
-    public String getProviderPrivateIp(long zoneId) {
-        return null;  //To change body of implemented methods use File | Settings | File
Templates.
+    public String getZoneGslbProviderPrivateIp(long zoneId) {
+        return null;
     }
 
     @Override
@@ -814,6 +832,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
impl
         if (answer == null) {
 
         }
-        return false;  //To change body of implemented methods use File | Settings | File
Templates.
+        return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 34f5905..9f55930 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManager.java
@@ -47,7 +47,8 @@ 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 password, String deviceName, ServerResource resource, boolean gslbProvider,
+                String gslbSitePublicIp, String gslbSitePrivateIp);
 
     /**
      * deletes load balancer device added in to a physical network

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/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 33de0ee..0498cc1 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
@@ -158,7 +158,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
     @Override
     @DB
     public ExternalLoadBalancerDeviceVO addExternalLoadBalancer(long physicalNetworkId, String
url,
-                String username, String password, String deviceName, ServerResource resource,
boolean gslbProvider) {
+                String username, String password, String deviceName, ServerResource resource,
boolean gslbProvider,
+                String gslbSitePublicIp, String gslbSitePrivateIp) {
 
         PhysicalNetworkVO pNetwork = null;
         NetworkDevice ntwkDevice = NetworkDevice.getNetworkDevice(deviceName);
@@ -173,15 +174,25 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends
AdapterBase
         if (pNetwork == null) {
             throw new InvalidParameterValueException("Could not find phyical network with
ID: " + physicalNetworkId);
         }
-        zoneId = pNetwork.getDataCenterId();
 
+        zoneId = pNetwork.getDataCenterId();
         PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(),
ntwkDevice.getNetworkServiceProvder());
-        if (ntwkSvcProvider == null) {
-            throw new CloudRuntimeException("Network Service Provider: " + ntwkDevice.getNetworkServiceProvder()
+
-                    " is not enabled in the physical network: " + physicalNetworkId + "to
add this device");
-        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown)
{
-            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName()
+
-                    " is in shutdown state in the physical network: " + physicalNetworkId
+ "to add this device");
+
+        if (gslbProvider) {
+            ExternalLoadBalancerDeviceVO zoneGslbProvider = _externalLoadBalancerDeviceDao.findGslbServiceProvider(
+                    physicalNetworkId, ntwkDevice.getNetworkServiceProvder());
+            if (zoneGslbProvider != null) {
+                throw new CloudRuntimeException("There is a GSLB service provider configured
in the zone alredy.");
+            }
+        } else {
+            ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(),
ntwkDevice.getNetworkServiceProvder());
+            if (ntwkSvcProvider == null) {
+                throw new CloudRuntimeException("Network Service Provider: " + ntwkDevice.getNetworkServiceProvder()
+
+                        " is not enabled in the physical network: " + physicalNetworkId +
"to add this device");
+            } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown)
{
+                throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName()
+
+                        " is in shutdown state in the physical network: " + physicalNetworkId
+ "to add this device");
+            }
         }
 
         URI uri;
@@ -222,11 +233,15 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends
AdapterBase
                     capacity = _defaultLbCapacity;
                 }
 
+                ExternalLoadBalancerDeviceVO lbDeviceVO;
                 txn.start();
-                ExternalLoadBalancerDeviceVO lbDeviceVO = new ExternalLoadBalancerDeviceVO(host.getId(),
pNetwork.getId(), ntwkSvcProvider.getProviderName(),
+                lbDeviceVO = new ExternalLoadBalancerDeviceVO(host.getId(), pNetwork.getId(),
ntwkDevice.getNetworkServiceProvder(),
                         deviceName, capacity, dedicatedUse, gslbProvider);
                 _externalLoadBalancerDeviceDao.persist(lbDeviceVO);
-
+                if (!gslbProvider) {
+                    lbDeviceVO.setGslbSitePrivateIP(gslbSitePublicIp);
+                    lbDeviceVO.setGslbSitePrivateIP(gslbSitePrivateIp);
+                }
                 DetailVO hostDetail = new DetailVO(host.getId(), ApiConstants.LOAD_BALANCER_DEVICE_ID,
String.valueOf(lbDeviceVO.getId()));
                 _hostDetailDao.persist(hostDetail);
 
@@ -471,7 +486,8 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
                             ExternalLoadBalancerDeviceVO lbAppliance = null;
                             try {
                                 lbAppliance = addExternalLoadBalancer(physicalNetworkId,
url, username, password,
-                                        createLbAnswer.getDeviceName(), createLbAnswer.getServerResource(),
false);
+                                        createLbAnswer.getDeviceName(), createLbAnswer.getServerResource(),
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/incubator-cloudstack/blob/11a7546f/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
index 1bd2107..b7baa7e 100644
--- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
+++ b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
@@ -16,12 +16,12 @@
 // under the License.
 package com.cloud.network.dao;
 
-import java.util.List;
-
 import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState;
 import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState;
 import com.cloud.utils.db.GenericDao;
 
+import java.util.List;
+
 public interface ExternalLoadBalancerDeviceDao extends GenericDao<ExternalLoadBalancerDeviceVO,
Long> {
 
     /**
@@ -64,4 +64,11 @@ public interface ExternalLoadBalancerDeviceDao extends GenericDao<ExternalLoadBa
      * @return list of ExternalLoadBalancerDeviceVO for the devices in to this physical network
of a managed type
      */
     List<ExternalLoadBalancerDeviceVO> listByProviderAndManagedType(long physicalNetworkId,
String provider_name, boolean managed);
+
+    /**
+     * Find the external load balancer device that is provisioned as GSLB service provider
in the pyshical network
+     * @param physicalNetworkId physical Network Id
+     * @return ExternalLoadBalancerDeviceVO for the device acting as GSLB provider in the
physical network
+     */
+    ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String providerName);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
index e559fad..ea6437d 100644
--- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
+++ b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
@@ -16,11 +16,6 @@
 // under the License.
 package com.cloud.network.dao;
 
-import java.util.List;
-import javax.ejb.Local;
-
-import org.springframework.stereotype.Component;
-
 import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState;
 import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState;
 import com.cloud.utils.db.DB;
@@ -28,6 +23,10 @@ import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Op;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.List;
 
 @Component
 @Local(value=ExternalLoadBalancerDeviceDao.class) @DB(txn=false)
@@ -37,6 +36,7 @@ public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLo
     final SearchBuilder<ExternalLoadBalancerDeviceVO> allocationStateSearch;
     final SearchBuilder<ExternalLoadBalancerDeviceVO> deviceStatusSearch;
     final SearchBuilder<ExternalLoadBalancerDeviceVO> deviceManagedTypeSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> gslbProviderSearch;
 
     public ExternalLoadBalancerDeviceDaoImpl() {
         super();
@@ -67,6 +67,12 @@ public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLo
         deviceManagedTypeSearch.and("providerName", deviceManagedTypeSearch.entity().getProviderName(),
Op.EQ);
         deviceManagedTypeSearch.and("managedType", deviceManagedTypeSearch.entity().getIsManagedDevice(),
Op.EQ);
         deviceManagedTypeSearch.done();
+
+        gslbProviderSearch = createSearchBuilder();
+        gslbProviderSearch.and("physicalNetworkId", gslbProviderSearch.entity().getPhysicalNetworkId(),
Op.EQ);
+        gslbProviderSearch.and("providerName", gslbProviderSearch.entity().getProviderName(),
Op.EQ);
+        gslbProviderSearch.and("gslbProvider", gslbProviderSearch.entity().getGslbProvider(),
Op.EQ);
+
     }
 
     public List<ExternalLoadBalancerDeviceVO> listByPhysicalNetwork(long physicalNetworkId)
{
@@ -109,4 +115,13 @@ public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLo
         sc.setParameters("managedType", managed);
         return search(sc, null);
     }
+
+    @Override
+    public ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String
providerName) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = gslbProviderSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("gslbProvider", true);
+        return findOneBy(sc);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
index a859af1..04714a6 100644
--- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
+++ b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
@@ -68,6 +68,12 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity,
Identity
     @Column(name="is_gslb_provider")
     private boolean gslbProvider;
 
+    @Column(name="gslb_site_publicip")
+    private String gslbSitePublicIP;
+
+    @Column(name="gslb_site_privateip")
+    private String gslbSitePrivateIP;
+
     @Column(name = "parent_host_id")
     private long parentHostId;
 
@@ -101,6 +107,8 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity,
Identity
         this.state = LBDeviceState.Enabled;
         this.uuid = UUID.randomUUID().toString();
         this.gslbProvider = gslbProvider;
+        this.gslbSitePublicIP = null;
+        this.gslbSitePrivateIP = null;
         if (device_name.equalsIgnoreCase(ExternalNetworkDeviceManager.NetworkDevice.NetscalerSDXLoadBalancer.getName()))
{
             this.allocationState = LBDeviceAllocationState.Provider;
         }
@@ -193,6 +201,22 @@ public class ExternalLoadBalancerDeviceVO implements InternalIdentity,
Identity
         gslbProvider = gslbProvider;
     }
 
+    public void setGslbSitePublicIP(String gslbSitePublicIP) {
+        this.gslbSitePublicIP = gslbSitePublicIP;
+    }
+
+    public String getGslbSitePublicIP() {
+        return gslbSitePublicIP;
+    }
+
+    public void setGslbSitePrivateIP(String gslbSitePrivateIP) {
+        this.gslbSitePrivateIP = gslbSitePrivateIP;
+    }
+
+    public String getGslbSitePrivateIP() {
+        return gslbSitePrivateIP;
+    }
+
     public String getUuid() {
         return uuid;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/server/src/org/apache/cloudstack/region/RegionServiceProvider.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/RegionServiceProvider.java b/server/src/org/apache/cloudstack/region/RegionServiceProvider.java
index 28375a9..ad7e22f 100755
--- a/server/src/org/apache/cloudstack/region/RegionServiceProvider.java
+++ b/server/src/org/apache/cloudstack/region/RegionServiceProvider.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cloudstack.region;
 
-public interface RegionServiceProvider {
+import com.cloud.utils.component.Adapter;
+
+public interface RegionServiceProvider extends Adapter {
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
index 7d0bd96..8042b64 100644
--- a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
+++ b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
@@ -80,7 +80,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
     @Inject
     AgentManager _agentMgr;
     @Inject
-    GslbServiceProvider _gslbProvider;
+    protected GslbServiceProvider _gslbProvider;
 
     @Override
     @DB
@@ -521,8 +521,8 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
             SiteLoadBalancerConfig siteLb = new SiteLoadBalancerConfig(gslbLbMapVo.isRevoke(),
serviceType,
                     ip.getAddress().addr(), Integer.toString(loadBalancer.getDefaultPortStart()));
 
-            siteLb.setGslbProviderPublicIp(_gslbProvider.getProviderPublicIp(dataCenterId));
-            siteLb.setGslbProviderPrivateIp(_gslbProvider.getProviderPrivateIp(dataCenterId));
+            siteLb.setGslbProviderPublicIp(_gslbProvider.getZoneGslbProviderPublicIp(dataCenterId));
+            siteLb.setGslbProviderPrivateIp(_gslbProvider.getZoneGslbProviderPrivateIp(dataCenterId));
 
             zoneSiteLoadbalancerMap.put(network.getDataCenterId(), siteLb);
         }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/server/src/org/apache/cloudstack/region/gslb/GslbServiceProvider.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/gslb/GslbServiceProvider.java b/server/src/org/apache/cloudstack/region/gslb/GslbServiceProvider.java
index 416f187..4338d65 100755
--- a/server/src/org/apache/cloudstack/region/gslb/GslbServiceProvider.java
+++ b/server/src/org/apache/cloudstack/region/gslb/GslbServiceProvider.java
@@ -26,9 +26,9 @@ public interface GslbServiceProvider extends RegionServiceProvider {
 
     public boolean isServiceEnabledInZone(long zoneId);
 
-    public String getProviderPublicIp(long zoneId);
+    public String getZoneGslbProviderPublicIp(long zoneId);
 
-    public String getProviderPrivateIp(long zoneId);
+    public String getZoneGslbProviderPrivateIp(long zoneId);
 
     public boolean applyGlobalLoadBalancerRule(long zoneId, GlobalLoadBalancerConfigCommand
gslbConfigCmd)
             throws ResourceUnavailableException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11a7546f/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index 04fc2dd..c837a44 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -2131,7 +2131,9 @@ CREATE TABLE `cloud`.`external_load_balancer_devices` (
   `allocation_state` varchar(32) NOT NULL DEFAULT 'Free' COMMENT 'Allocation state (Free/Shared/Dedicated/Provider)
of the device',
   `is_dedicated` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if device/appliance is provisioned
for dedicated use only',
   `is_managed` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is
provisioned and its life cycle is managed by by cloudstack',
-  `is_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance
provides gslb service as well',
+  `is_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance
is acting as gslb service provider in the zone',
+  `gslb_site_publicip` varchar(255)  DEFAULT NULL COMMENT 'GSLB service Provider site public
ip',
+  `gslb_site_privateip` varchar(255) DEFAULT NULL COMMENT 'GSLB service Provider site private
ip',
   `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external load balancer
device',
   `parent_host_id` bigint unsigned COMMENT 'if the load balancer appliance is cloudstack
managed, then host id on which this appliance is provisioned',
   PRIMARY KEY (`id`),


Mime
View raw message