You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/07/25 19:17:22 UTC

git commit: Bug: HA takes a lot of time to migrate VMs (trigger HA) to another KVM host if there are multiple storage pools in a cluster.

Updated Branches:
  refs/heads/master 3fedd56ad -> f497c7c03


Bug: HA takes a lot of time to migrate VMs (trigger HA) to another KVM
host if there are multiple storage pools in a cluster.

The issue is as follows:
1. When CloudStack detects that a host is not responding to ping
requests it'll send a fence command for this host to another host in the
cluster.
2. The agent takes a long time to respond to this check if the storage
is fenced. This is because the agent checks if the first host is writing
to its heartbeat file on all pools in the cluster. It is doing this in a
sequential manner on all storage pool.

Making a fix to get rid of sleep, wait during HA. The behavior is now
similar to Xenserver.

RB: https://reviews.apache.org/r/6133/
Send-by:devdeep.singh@citrix.com


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

Branch: refs/heads/master
Commit: f497c7c031b580919ada45209e690f3983f509b0
Parents: 3fedd56
Author: Edison Su <su...@gmail.com>
Authored: Wed Jul 25 10:16:13 2012 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Wed Jul 25 10:17:09 2012 -0700

----------------------------------------------------------------------
 .../agent/resource/computing/KVMHAChecker.java     |    2 +-
 scripts/vm/hypervisor/kvm/kvmheartbeat.sh          |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f497c7c0/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java b/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java
index b2df8c1..f5b8a32 100644
--- a/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java
+++ b/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java
@@ -53,7 +53,7 @@ public class KVMHAChecker extends KVMHABase implements Callable<Boolean> {
             cmd.add("-h", _hostIP);
             cmd.add("-r");
             cmd.add("-t",
-                    String.valueOf((_heartBeatUpdateFreq + _heartBeatUpdateTimeout) / 1000 * 2));
+                    String.valueOf(_heartBeatUpdateFreq/1000));
             OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
             String result = cmd.execute(parser);
             s_logger.debug("pool: " + pool._poolIp);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f497c7c0/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/kvm/kvmheartbeat.sh b/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
index c634655..7293b14 100755
--- a/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
+++ b/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
@@ -133,14 +133,14 @@ write_hbLog() {
 }
 
 check_hbLog() {
-  oldTimeStamp=$(cat $hbFile) 
-  sleep $interval &> /dev/null
-  newTimeStamp=$(cat $hbFile) 
-  if [ $newTimeStamp -gt $oldTimeStamp ]
+  now=$(date +%s)
+  hb=$(cat $hbFile)
+  diff=`expr $now - $hb`
+  if [ $diff -gt $interval ]
   then
-    return 0
+    return 1
   fi
-  return 1
+  return 0
 }
 
 if [ "$rflag" == "1" ]