Improve logs on KVMHAVMActivityChecker (#4705)

Co-authored-by: Daniel Augusto Veronezi Salvador <daniel@scclouds.com.br>
This commit is contained in:
Daniel Augusto Veronezi Salvador 2021-05-11 04:12:59 -03:00 committed by GitHub
parent 99f2919ef4
commit 6b9f3fb501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 9 deletions

View File

@ -181,7 +181,7 @@ public class KVMHABase {
return result;
}
public Boolean checkingHB() {
public Boolean checkingHeartBeat() {
// TODO Auto-generated method stub
return null;
}

View File

@ -41,7 +41,7 @@ public class KVMHAChecker extends KVMHABase implements Callable<Boolean> {
* means heartbeating is stopped definitely
*/
@Override
public Boolean checkingHB() {
public Boolean checkingHeartBeat() {
List<Boolean> results = new ArrayList<Boolean>();
for (NfsStoragePool pool : _pools) {
Script cmd = new Script(s_heartBeatPath, _heartBeatCheckerTimeout, s_logger);
@ -77,6 +77,6 @@ public class KVMHAChecker extends KVMHABase implements Callable<Boolean> {
public Boolean call() throws Exception {
// s_logger.addAppender(new org.apache.log4j.ConsoleAppender(new
// org.apache.log4j.PatternLayout(), "System.out"));
return checkingHB();
return checkingHeartBeat();
}
}

View File

@ -42,7 +42,7 @@ public class KVMHAVMActivityChecker extends KVMHABase implements Callable<Boolea
}
@Override
public Boolean checkingHB() {
public Boolean checkingHeartBeat() {
Script cmd = new Script(vmActivityCheckPath, activityScriptTimeout.getStandardSeconds(), LOG);
cmd.add("-i", nfsStoragePool._poolIp);
cmd.add("-p", nfsStoragePool._poolMountSourcePath);
@ -52,11 +52,14 @@ public class KVMHAVMActivityChecker extends KVMHABase implements Callable<Boolea
cmd.add("-t", String.valueOf(String.valueOf(System.currentTimeMillis() / 1000)));
cmd.add("-d", String.valueOf(suspectTimeInSeconds));
OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
String result = cmd.execute(parser);
LOG.debug("KVMHAVMActivityChecker pool: " + nfsStoragePool._poolIp);
LOG.debug("KVMHAVMActivityChecker result: " + result);
LOG.debug("KVMHAVMActivityChecker parser: " + parser.getLine());
if (result == null && parser.getLine().contains("DEAD")) {
String parsedLine = parser.getLine();
LOG.debug(String.format("Checking heart beat with KVMHAVMActivityChecker [{command=\"%s\", result: \"%s\", log: \"%s\", pool: \"%s\"}].", cmd.toString(), result, parsedLine, nfsStoragePool._poolIp));
if (result == null && parsedLine.contains("DEAD")) {
LOG.warn(String.format("Checking heart beat with KVMHAVMActivityChecker command [%s] returned [%s]. It is [%s]. It may cause a shutdown of host IP [%s].", cmd.toString(), result, parsedLine, hostIP));
return false;
} else {
return true;
@ -65,6 +68,6 @@ public class KVMHAVMActivityChecker extends KVMHABase implements Callable<Boolea
@Override
public Boolean call() throws Exception {
return checkingHB();
return checkingHeartBeat();
}
}