bug 9154: Add router fault state report

This commit is contained in:
Sheng Yang 2011-06-14 20:14:29 -07:00
parent 07a61686db
commit 6f0edd9541
3 changed files with 10 additions and 6 deletions

View File

@ -32,7 +32,8 @@ public interface VirtualRouter extends VirtualMachine {
public enum RedundantState {
UNKNOWN,
MASTER,
BACKUP
BACKUP,
FAULT
}
RedundantState getRedundantState();
}

View File

@ -364,11 +364,10 @@ public class VirtualRoutingResource implements Manager {
final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
final String result = getRouterStatus(routerPrivateIPAddress);
CheckRouterAnswer answer = new CheckRouterAnswer(cmd, false, "Router return: " + result);
if (result != null) {
answer.setIsMaster(result.equals("Status: MASTER"));
if (result == null || result.isEmpty()) {
return new CheckRouterAnswer(cmd, "CheckRouterCommand failed");
}
return answer;
return new CheckRouterAnswer(cmd, result.equals("Status: MASTER"), result);
}
protected Answer execute(final CheckConsoleProxyLoadCommand cmd) {

View File

@ -734,7 +734,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (answer.getIsMaster()) {
router.setRedundantState(RedundantState.MASTER);
} else {
router.setRedundantState(RedundantState.BACKUP);
if (answer.getDetails() != null && answer.getDetails().equals("Status: BACKUP")) {
router.setRedundantState(RedundantState.BACKUP);
} else {
router.setRedundantState(RedundantState.FAULT);
}
}
} else {
router.setRedundantState(RedundantState.UNKNOWN);