From 463a3aba7185033ff54644fc8c7644570e85cedc Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Thu, 18 Jul 2013 00:26:38 -0700 Subject: [PATCH] =?UTF-8?q?CLOUDSTACK-3451=20Parallel=20deployment=20-=20X?= =?UTF-8?q?enserver=20-=20When=20deploying=2030=20Vms=20in=20parallel,=20s?= =?UTF-8?q?ome=20of=20the=20Vm=20deployment=20fails=20when=20=E2=80=9Cappl?= =?UTF-8?q?ying=20dhcp=20entry/applying=20userdata=20and=20password=20entr?= =?UTF-8?q?y=20on=20router=E2=80=9D=20and=20retry=20eventually=20happens?= =?UTF-8?q?=20when=20they=20succeed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../engine/cloud/entity/api/VMEntityManagerImpl.java | 10 ++++++++-- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java index 0822b924018..6dd5844cbc9 100755 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java @@ -115,6 +115,7 @@ public class VMEntityManagerImpl implements VMEntityManager { @Inject protected AffinityGroupVMMapDao _affinityGroupVMMapDao; + @Override public VMEntityVO loadVirtualMachine(String vmId) { // TODO Auto-generated method stub @@ -197,7 +198,6 @@ public class VMEntityManagerImpl implements VMEntityManager { if (s_logger.isDebugEnabled()) { s_logger.debug("Cannot finalize the VM reservation for this destination found, retrying"); } - exclude.addHost(dest.getHost().getId()); continue; } @@ -228,8 +228,14 @@ public class VMEntityManagerImpl implements VMEntityManager { _accountDao.findById(vm.getAccountId()), reservedPlan); } catch (Exception ex) { // Retry the deployment without using the reservation plan + DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null); + + if (reservedPlan.getAvoids() != null) { + plan.setAvoids(reservedPlan.getAvoids()); + } + _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), - null); + plan); } } else { // no reservation found. Let VirtualMachineManager retry diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 9962f03a8df..7a4bf50f128 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -784,10 +784,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType()); boolean canRetry = true; + ExcludeList avoids = null; try { Journal journal = start.second().getJournal(); - ExcludeList avoids = null; + if (planToDeploy != null) { avoids = planToDeploy.getAvoids(); } @@ -1025,6 +1026,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } } } + + if (planToDeploy != null) { + planToDeploy.setAvoids(avoids); + } } if (startedVm == null) {