Skip to content

Commit f497c7c

Browse files
committed
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
1 parent 3fedd56 commit f497c7c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private Boolean checkingHB() {
5353
cmd.add("-h", _hostIP);
5454
cmd.add("-r");
5555
cmd.add("-t",
56-
String.valueOf((_heartBeatUpdateFreq + _heartBeatUpdateTimeout) / 1000 * 2));
56+
String.valueOf(_heartBeatUpdateFreq/1000));
5757
OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
5858
String result = cmd.execute(parser);
5959
s_logger.debug("pool: " + pool._poolIp);

scripts/vm/hypervisor/kvm/kvmheartbeat.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ write_hbLog() {
133133
}
134134

135135
check_hbLog() {
136-
oldTimeStamp=$(cat $hbFile)
137-
sleep $interval &> /dev/null
138-
newTimeStamp=$(cat $hbFile)
139-
if [ $newTimeStamp -gt $oldTimeStamp ]
136+
now=$(date +%s)
137+
hb=$(cat $hbFile)
138+
diff=`expr $now - $hb`
139+
if [ $diff -gt $interval ]
140140
then
141-
return 0
141+
return 1
142142
fi
143-
return 1
143+
return 0
144144
}
145145

146146
if [ "$rflag" == "1" ]

0 commit comments

Comments
 (0)