Add alert and log for redundant router state change

This commit is contained in:
Sheng Yang 2011-08-11 23:36:31 -07:00
parent e59c14a758
commit 12a49668d7

View File

@ -758,6 +758,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (!router.getIsRedundantRouter()) {
continue;
}
RedundantState prevState = router.getRedundantState();
if (router.getState() != State.Running) {
router.setRedundantState(RedundantState.UNKNOWN);
updated = true;
@ -805,6 +806,18 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
txn.close();
}
}
RedundantState currState = router.getRedundantState();
if (prevState != currState) {
String title = "Redundant virtual router " + router.getInstanceName() +
" just switch from " + prevState + " to " + currState;
String context = "Redundant virtual router (name: " + router.getHostName() + ", id: " + router.getId() + ") " +
" just switch from " + prevState + " to " + currState;
s_logger.info(context);
if (currState == RedundantState.MASTER) {
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_DOMAIN_ROUTER,
router.getDataCenterIdToDeployIn(), router.getPodIdToDeployIn(), title, context);
}
}
}
}