cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshbatt...@apache.org
Subject [1/7] git commit: updated refs/heads/4.3 to 58aaf67
Date Sun, 22 Dec 2013 16:58:56 GMT
Updated Branches:
  refs/heads/4.3 b4c4f7cbc -> 58aaf6780


CLOUDSTACK-5603  support Monitoring VR services when VR running on Hyper-V


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

Branch: refs/heads/4.3
Commit: 0ef953f993b475e0bca56c575d15a940e1b25da5
Parents: a63fd39
Author: Rajesh Battala <rajesh.battala@citrix.com>
Authored: Sun Dec 22 17:03:55 2013 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Sun Dec 22 20:24:15 2013 +0530

----------------------------------------------------------------------
 .../resource/HypervDirectConnectResource.java   | 37 ++++++++++++++++++--
 1 file changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ef953f9/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index e0a1158..7047685 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -19,6 +19,7 @@ package com.cloud.hypervisor.hyperv.resource;
 import java.io.File;
 import java.io.IOException;
 import java.net.ConnectException;
+import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -77,6 +78,7 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
 import com.cloud.agent.api.routing.SavePasswordCommand;
 import com.cloud.agent.api.routing.SetFirewallRulesAnswer;
 import com.cloud.agent.api.routing.SetFirewallRulesCommand;
+import com.cloud.agent.api.routing.SetMonitorServiceCommand;
 import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer;
 import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
 import com.cloud.agent.api.routing.SetSourceNatAnswer;
@@ -425,6 +427,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements
S
             answer = execute((CheckS2SVpnConnectionsCommand) cmd);
         } else if (clazz == SetStaticRouteCommand.class) {
             answer = execute((SetStaticRouteCommand) cmd);
+        } else if (clazz == SetMonitorServiceCommand.class) {
+            answer = execute((SetMonitorServiceCommand) cmd);
         } else {
             if (clazz == StartCommand.class) {
                 VirtualMachineTO vmSpec = ((StartCommand)cmd).getVirtualMachine();
@@ -1509,6 +1513,34 @@ public class HypervDirectConnectResource extends ServerResourceBase
implements S
         return stats;
     }
 
+    protected Answer execute(SetMonitorServiceCommand cmd) {
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Executing resource SetMonitorServiceCommand: " + s_gson.toJson(cmd));
+        }
+
+        String controlIp = getRouterSshControlIp(cmd);
+        String config = cmd.getConfiguration();
+
+        String args = "";
+
+        args += " -c " + config;
+
+        try {
+            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT,
"root", getSystemVMKeyFile(), null, "/opt/cloud/bin/monitor_service.sh " + args);
+
+            if (!result.first()) {
+                String msg=  "monitor_service.sh failed on domain router " + controlIp +
" failed " + result.second();
+                s_logger.error(msg);
+                return new Answer(cmd, false, msg);
+            }
+
+            return new Answer(cmd);
+
+        } catch (Throwable e) {
+            s_logger.error("Unexpected exception: " + e.toString(), e);
+            return new Answer(cmd, false, "SetMonitorServiceCommand failed due to " + e);
+        }
+    }
 
     protected CheckSshAnswer execute(CheckSshCommand cmd) {
         String vmName = cmd.getName();
@@ -1742,10 +1774,9 @@ public class HypervDirectConnectResource extends ServerResourceBase
implements S
                 sch = SocketChannel.open();
                 sch.configureBlocking(true);
                 sch.socket().setSoTimeout(5000);
-                // we need to connect to the public ip address to check the status of the
VM
-                /*
+                // we need to connect to the control ip address to check the status of the
system vm
                 InetSocketAddress addr = new InetSocketAddress(ipAddress, port);
-                sch.connect(addr);*/
+                sch.connect(addr);
                 return null;
             } catch (IOException e) {
                 s_logger.info("Could not connect to " + ipAddress + " due to " + e.toString());


Mime
View raw message