bug 10991: Determine existing redundant router using both state and host id

Seems in some condition, when a router is stopped, it's host_id != null.

status 10991: resolved fixed
This commit is contained in:
Sheng Yang 2011-08-05 11:29:58 -07:00
parent 355be3a417
commit 7638f8e7a7
1 changed files with 1 additions and 1 deletions

View File

@ -945,7 +945,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
List<DomainRouterVO> routerList = _routerDao.findBy(router.getAccountId(), router.getDataCenterIdToDeployIn());
DomainRouterVO routerToBeAvoid = null;
for (DomainRouterVO rrouter : routerList) {
if (rrouter.getHostId() != null && rrouter.getIsRedundantRouter()) {
if (rrouter.getHostId() != null && rrouter.getIsRedundantRouter() && rrouter.getState() == State.Running) {
if (routerToBeAvoid != null) {
throw new ResourceUnavailableException("There are already two redundant routers with IP " + router.getPublicIpAddress(), this.getClass(), 0);
}