Skip to content

Commit 463a3ab

Browse files
author
Prachi Damle
committed
CLOUDSTACK-3451 Parallel deployment - Xenserver - When deploying 30 Vms in parallel, some of the Vm deployment fails when “applying dhcp entry/applying userdata and password entry on router” and retry eventually happens when they succeed.
Changes: - Passing the avoid set generated by the first pass of deployment to the second try. - The second try is done, when the first pass that uses a reserved plan fails to deploy on the reserved host, to search over the entire zone again
1 parent 694b90f commit 463a3ab

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
115115
@Inject
116116
protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
117117

118+
118119
@Override
119120
public VMEntityVO loadVirtualMachine(String vmId) {
120121
// TODO Auto-generated method stub
@@ -197,7 +198,6 @@ public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse,
197198
if (s_logger.isDebugEnabled()) {
198199
s_logger.debug("Cannot finalize the VM reservation for this destination found, retrying");
199200
}
200-
201201
exclude.addHost(dest.getHost().getId());
202202
continue;
203203
}
@@ -228,8 +228,14 @@ public void deployVirtualMachine(String reservationId, VMEntityVO vmEntityVO, St
228228
_accountDao.findById(vm.getAccountId()), reservedPlan);
229229
} catch (Exception ex) {
230230
// Retry the deployment without using the reservation plan
231+
DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
232+
233+
if (reservedPlan.getAvoids() != null) {
234+
plan.setAvoids(reservedPlan.getAvoids());
235+
}
236+
231237
_itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()),
232-
null);
238+
plan);
233239
}
234240
} else {
235241
// no reservation found. Let VirtualMachineManager retry

server/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,10 +784,11 @@ public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.P
784784
HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
785785

786786
boolean canRetry = true;
787+
ExcludeList avoids = null;
787788
try {
788789
Journal journal = start.second().getJournal();
789790

790-
ExcludeList avoids = null;
791+
791792
if (planToDeploy != null) {
792793
avoids = planToDeploy.getAvoids();
793794
}
@@ -1025,6 +1026,10 @@ public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.P
10251026
}
10261027
}
10271028
}
1029+
1030+
if (planToDeploy != null) {
1031+
planToDeploy.setAvoids(avoids);
1032+
}
10281033
}
10291034

10301035
if (startedVm == null) {

0 commit comments

Comments
 (0)