mirror of https://github.com/apache/cloudstack.git
Bug 13248 - NPE: DeployVMCmd fired during 2.2.x regression test on Acton build
Changes: - After deployment of Router failed, we did not throw out the error inorder to retry the start using another hypervisorType. - But there is no other hypervisor to try, causing the failed and expunged router to be passed on further leading to an NPE later - So in case there are no more hypervisors to retry the router start, we should throw out the original error.
This commit is contained in:
parent
e87e30bc3d
commit
6a7fd4d96c
|
|
@ -24,6 +24,7 @@ import java.util.Comparator;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -1340,7 +1341,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
|
||||
int allocateRetry = 0;
|
||||
int startRetry = 0;
|
||||
for (HypervisorType hType : supportedHypervisors) {
|
||||
|
||||
|
||||
for (Iterator<HypervisorType> iter = supportedHypervisors.iterator();iter.hasNext();) {
|
||||
HypervisorType hType = iter.next();
|
||||
try {
|
||||
s_logger.debug("Allocating the domR with the hypervisor type " + hType);
|
||||
VMTemplateVO template = _templateDao.findRoutingTemplate(hType);
|
||||
|
|
@ -1361,7 +1365,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
router.setRole(Role.VIRTUAL_ROUTER);
|
||||
router = _itMgr.allocate(router, template, routerOffering, networks, plan, null, owner);
|
||||
} catch (InsufficientCapacityException ex) {
|
||||
if (allocateRetry < 2) {
|
||||
if (allocateRetry < 2 && iter.hasNext()) {
|
||||
s_logger.debug("Failed to allocate the domR with hypervisor type " + hType + ", retrying one more time");
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -1375,7 +1379,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
router = startVirtualRouter(router, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), params);
|
||||
break;
|
||||
} catch (InsufficientCapacityException ex) {
|
||||
if (startRetry < 2) {
|
||||
if (startRetry < 2 && iter.hasNext()) {
|
||||
s_logger.debug("Failed to start the domR " + router + " with hypervisor type " + hType + ", destroying it and recreating one more time");
|
||||
//destroy the router
|
||||
destroyRouter(router.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue