bug 9024:

two issues here:
1. in some case, two sequent commands are sent out at the same time.
2. before starting a user VM , make sure domr is up

status 9024: resolved fixed
This commit is contained in:
anthony 2011-03-17 17:28:04 -07:00
parent f12f7da0ba
commit 8e741fb80d
2 changed files with 27 additions and 15 deletions

View File

@ -405,17 +405,21 @@ public abstract class AgentAttache {
} catch (OperationTimedoutException e) {
s_logger.warn(log(seq, "Timed out on " + req.toString()));
cancel(seq);
throw e;
} catch (Exception e) {
s_logger.warn(log(seq, "Exception while waiting for answer"), e);
cancel(seq);
throw new OperationTimedoutException(req.getCommands(), _id, seq, wait, false);
} finally {
unregisterListener(seq);
final Long current = _currentSequence;
if (req.executeInSequence() && (current != null && current == seq)) {
sendNext(seq);
}
throw e;
} catch (Exception e) {
s_logger.warn(log(seq, "Exception while waiting for answer"), e);
cancel(seq);
final Long current = _currentSequence;
if (req.executeInSequence() && (current != null && current == seq)) {
sendNext(seq);
}
throw new OperationTimedoutException(req.getCommands(), _id, seq, wait, false);
} finally {
unregisterListener(seq);
}
}

View File

@ -217,8 +217,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
@Inject
VMTemplateHostDao _vmTemplateHostDao = null;
@Inject
UserVmDao _vmDao = null;
@Inject
ResourceLimitDao _limitDao = null;
@Inject
CapacityDao _capacityDao = null;
@ -251,8 +249,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
@Inject
NetworkOfferingDao _networkOfferingDao = null;
@Inject
NetworkDao _networksDao = null;
@Inject
GuestOSDao _guestOSDao = null;
@Inject
NetworkManager _networkMgr;
@ -822,9 +818,21 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
router.setRole(Role.DHCP_USERDATA);
router = _itMgr.allocate(router, template, _offering, networks, plan, null, owner);
}
State state = router.getState();
if (state != State.Starting && state != State.Running) {
router = this.start(router, _accountService.getSystemUser(), _accountService.getSystemAccount(), params);
Long routeId = router.getId();
router = _routerDao.acquireInLockTable(routeId, 600);
if (router == null) {
throw new ConcurrentOperationException("Unable to acquire router: " + routeId);
}
try {
State state = router.getState();
if (state == State.Starting ) {
throw new RuntimeException("router " + routeId + " is in Starting state");
}
if (state != State.Running) {
router = this.start(router, _accountService.getSystemUser(), _accountService.getSystemAccount(), params);
}
} finally {
_routerDao.releaseFromLockTable(routeId);
}
// Creating stats entry for router
UserStatisticsVO stats = _userStatsDao.findBy(owner.getId(), dcId, null, router.getId(), router.getType().toString());
@ -1222,7 +1230,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
String routerControlIpAddress = null;
List<NicVO> nics = _nicDao.listByVmId(router.getId());
for (NicVO n : nics) {
NetworkVO nc = _networksDao.findById(n.getNetworkId());
NetworkVO nc = _networkDao.findById(n.getNetworkId());
if (nc.getTrafficType() == TrafficType.Control) {
routerControlIpAddress = n.getIp4Address();
}