cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/HA-abstractinvestigatorimpl-nullstate to ece3ff6
Date Fri, 01 May 2015 14:37:39 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/HA-abstractinvestigatorimpl-nullstate fee74106a -> ece3ff68f


server: add null assertions and remove dead code with testIpAddress usage

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/HA-abstractinvestigatorimpl-nullstate
Commit: ece3ff68f7d03e897af671a16bf12b64213bfcc4
Parents: fee7410
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri May 1 16:36:31 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri May 1 16:36:31 2015 +0200

----------------------------------------------------------------------
 server/src/com/cloud/ha/AbstractInvestigatorImpl.java       | 1 +
 .../src/com/cloud/ha/ManagementIPSystemVMInvestigator.java  | 9 ++++-----
 server/src/com/cloud/ha/UserVmDomRInvestigator.java         | 8 +++-----
 3 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ece3ff68/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
index 04343fc..147cecd 100755
--- a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
+++ b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
@@ -85,6 +85,7 @@ public abstract class AbstractInvestigatorImpl extends AdapterBase implements
In
         return hostIds;
     }
 
+    // Method only returns Status.Up, Status.Down and Status.Unknown
     protected Status testIpAddress(Long hostId, String testHostIp) {
         try {
             Answer pingTestAnswer = _agentMgr.send(hostId, new PingTestCommand(testHostIp));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ece3ff68/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java b/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java
index 4591237..27ca849 100644
--- a/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java
+++ b/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java
@@ -78,10 +78,8 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl
{
             List<Long> otherHosts = findHostByPod(vmHost.getPodId(), vm.getHostId());
             for (Long otherHost : otherHosts) {
                 Status vmState = testIpAddress(otherHost, nic.getIp4Address());
-                if (vmState == null || vmState == Status.Unknown) {
-                    // can't get information from that host, try the next one
-                    continue;
-                }
+                assert vmState != null;
+                // In case of Status.Unknown, next host will be tried
                 if (vmState == Status.Up) {
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("successfully pinged vm's private IP (" + vm.getPrivateIpAddress()
+ "), returning that the VM is up");
@@ -91,7 +89,8 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl
{
                     // We can't ping the VM directly...if we can ping the host, then report
the VM down.
                     // If we can't ping the host, then we don't have enough information.
                     Status vmHostState = testIpAddress(otherHost, vmHost.getPrivateIpAddress());
-                    if ((vmHostState != null) && (vmHostState != Status.Unknown)
&& (vmHostState == Status.Up)) {
+                    assert vmHostState != null;
+                    if (vmHostState == Status.Up) {
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("successfully pinged vm's host IP (" + vmHost.getPrivateIpAddress()
+
                                 "), but could not ping VM, returning that the VM is down");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ece3ff68/server/src/com/cloud/ha/UserVmDomRInvestigator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/UserVmDomRInvestigator.java b/server/src/com/cloud/ha/UserVmDomRInvestigator.java
index 48ee283..23db01f 100644
--- a/server/src/com/cloud/ha/UserVmDomRInvestigator.java
+++ b/server/src/com/cloud/ha/UserVmDomRInvestigator.java
@@ -116,14 +116,12 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl
{
         List<Long> otherHosts = findHostByPod(agent.getPodId(), agent.getId());
 
         for (Long hostId : otherHosts) {
-
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("sending ping from (" + hostId + ") to agent's host ip address
(" + agent.getPrivateIpAddress() + ")");
             }
             Status hostState = testIpAddress(hostId, agent.getPrivateIpAddress());
-            if (hostState == null || hostState == Status.Unknown) {
-                continue;
-            }
+            assert hostState != null;
+            // In case of Status.Unknown, next host will be tried
             if (hostState == Status.Up) {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("ping from (" + hostId + ") to agent's host ip address
(" + agent.getPrivateIpAddress() +
@@ -134,7 +132,7 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("returning host state: " + hostState);
                 }
-                return hostState;
+                return Status.Down;
             }
         }
 


Mime
View raw message