Skip to content

Commit 3fc43cf

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 66a6855 commit 3fc43cf

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
@@ -788,10 +788,11 @@ public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.P
788788
HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
789789

790790
boolean canRetry = true;
791+
ExcludeList avoids = null;
791792
try {
792793
Journal journal = start.second().getJournal();
793794

794-
ExcludeList avoids = null;
795+
795796
if (planToDeploy != null) {
796797
avoids = planToDeploy.getAvoids();
797798
}
@@ -1026,6 +1027,10 @@ public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.P
10261027
}
10271028
}
10281029
}
1030+
1031+
if (planToDeploy != null) {
1032+
planToDeploy.setAvoids(avoids);
1033+
}
10291034
}
10301035

10311036
if (startedVm == null) {

0 commit comments

Comments
 (0)