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/master to 6a92f3b
Date Wed, 05 Jun 2013 06:42:55 GMT
Updated Branches:
  refs/heads/master 402cc917b -> 6a92f3b8a


CLOUDSTACK-2741: [GSLB] GSLB service doesn't come up if the LB rule
mapped to it is serviced by VR

For remote LB services that are not running on NetScaler, there needs to
be a LB monitor bound to GSLB service. Otherwise service is shown down.
This fix binds a LB monitor with GSLB services.


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

Branch: refs/heads/master
Commit: 6a92f3b8ac2f5623c2b7ec27711bc2e91791e050
Parents: 402cc91
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Wed Jun 5 12:10:36 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Wed Jun 5 12:10:36 2013 +0530

----------------------------------------------------------------------
 .../cloud/network/resource/NetscalerResource.java  |   38 +++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a92f3b8/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
index c0d4599..263e13b 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
@@ -904,6 +904,27 @@ public class NetscalerResource implements ServerResource {
                             // Bind 'gslbservice' service object to GSLB virtual server
                             GSLB.createVserverServiceBinding(_netscalerService, serviceName,
vserverName);
 
+                            // create a monitor for the service running on the site
+                            lbmonitor newmonitor = new lbmonitor();
+                            String monitorName =  GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                            newmonitor.set_type("TCP");
+                            newmonitor.set_servicename(serviceName);
+                            newmonitor.set_monitorname(monitorName);
+                            newmonitor.set_state("ENABLED");
+                            lbmonitor.add(_netscalerService, newmonitor);
+
+                            // bind the monitor to the GSLB servie
+                            try {
+                                gslbservice_lbmonitor_binding monitorBinding = new gslbservice_lbmonitor_binding();
+                                monitorBinding.set_monitor_name(monitorName);
+                                monitorBinding.set_servicename(serviceName);
+                                gslbservice_lbmonitor_binding.add(_netscalerService, monitorBinding);
+                            } catch (Exception e) {
+                                // TODO: Nitro API version 10.* is not compatible for NetScalers
9.*, so may fail
+                                // against NetScaler version lesser than 10 hence ignore
the exception
+                                s_logger.warn("Failed to bind monitor to GSLB service due
to " + e.getMessage());
+                            }
+
                         } else {
                             // Unbind GSLB service with GSLB virtual server
                             GSLB.deleteVserverServiceBinding(_netscalerService, serviceName,
vserverName);
@@ -911,6 +932,19 @@ public class NetscalerResource implements ServerResource {
                             // delete 'gslbservice' object
                             gslbservice service = GSLB.getServiceObject(_netscalerService,
serviceName);
                             GSLB.deleteService(_netscalerService, serviceName);
+
+                            // delete the GSLB service monitor
+                            String monitorName =  GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                            try {
+                                lbmonitor serviceMonitor = lbmonitor.get(_netscalerService,
monitorName);
+                                if (serviceMonitor != null) {
+                                    lbmonitor.delete(_netscalerService, serviceMonitor);
+                                }
+                            } catch (nitro_exception ne) {
+                                if (ne.getErrorCode() != NitroError.NS_RESOURCE_NOT_EXISTS)
{
+                                    s_logger.warn("Failed to delete monitor "+ monitorName
+ " for GSLB service due to " + ne.getMessage());
+                                }
+                            }
                         }
 
                         if (site.forRevoke()) { // delete the site if its for revoke
@@ -1469,6 +1503,10 @@ public class NetscalerResource implements ServerResource {
             return "cloud-gslb-service-" + siteName + "-" + publicIp + "-" + publicPort;
         }
 
+        private static String generateGslbServiceMonitorName(String publicIp) {
+            return "cloud-monitor-" + publicIp;
+        }
+
         private static boolean gslbServerExists(nitro_service client, String serverName)
throws ExecutionException {
             try {
                 if (com.citrix.netscaler.nitro.resource.config.basic.server.get(client, serverName)
!= null) {


Mime
View raw message