Updated Branches:
  refs/heads/4.2 f2c8469c5 -> 1b90a4554

CLOUDSTACK-3535: fix regression introduced in 
5d9fa5d42e13a8c8ee10df14c466f66de678e954
(cherry picked from commit 6b4aed2acacb1663cfd3955cc64bc84adef402bc)

Signed-off-by: animesh <anim...@apache.org>


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

Branch: refs/heads/4.2
Commit: 1b90a4554f19ef51940943ab8b2bde28fc933777
Parents: f2c8469
Author: Edison Su <sudi...@gmail.com>
Authored: Tue Aug 27 18:08:06 2013 -0700
Committer: animesh <anim...@apache.org>
Committed: Tue Aug 27 19:55:23 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/volume/VolumeServiceImpl.java  |  1 +
 .../kvm/src/com/cloud/ha/KVMInvestigator.java         | 14 +++++++++-----
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java   |  8 ++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1b90a455/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
 
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index faa8151..8a97c1e 100644
--- 
a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ 
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -522,6 +522,7 @@ public class VolumeServiceImpl implements VolumeService {
         if (result.isSuccess()) {
             vo.processEvent(Event.OperationSuccessed, result.getAnswer());
         } else {
+
             vo.processEvent(Event.OperationFailed);
             volResult.setResult(result.getResult());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1b90a455/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java 
b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
index 1ec48e6..4d8322d 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
@@ -59,15 +59,19 @@ public class KVMInvestigator extends AdapterBase implements 
Investigator {
             return null;
         }
         CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
-        List<HostVO> neighbors = 
_resourceMgr.listAllHostsInCluster(agent.getClusterId());
+        List<HostVO> neighbors = 
_resourceMgr.listHostsInClusterByStatus(agent.getClusterId(), Status.Up);
         for (HostVO neighbor : neighbors) {
             if (neighbor.getId() == agent.getId() || 
neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
                 continue;
             }
-            Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
-
-            return answer.getResult() ? Status.Down : Status.Up;
-
+            try {
+                Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
+                if (answer != null) {
+                    return answer.getResult() ? Status.Down : Status.Up;
+                }
+            } catch (Exception e) {
+                s_logger.debug("Failed to send command to host: " + 
neighbor.getId());
+            }
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1b90a455/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 2f5d51b..11904b9 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1254,10 +1254,14 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
 
         } catch (AgentUnavailableException e) {
             s_logger.warn("Unable to stop vm, agent unavailable: " + 
e.toString());
-            throw e;
+            if (!forced) {
+                throw e;
+            }
         } catch (OperationTimedoutException e) {
             s_logger.warn("Unable to stop vm, operation timed out: " + 
e.toString());
-            throw e;
+            if (!forced) {
+                throw e;
+            }
         } finally {
             if (!stopped) {
                 if (!forced) {

Reply via email to