Merge remote-tracking branch 'origin/4.13' into 4.14

This commit is contained in:
Rohit Yadav 2020-07-07 12:51:46 +05:30
commit b141b8e256
3 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.deploy;
import com.cloud.dc.DataCenter;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
import com.cloud.exception.InsufficientServerCapacityException;
@ -49,4 +50,6 @@ public interface DeploymentPlanningManager extends Manager {
void cleanupVMReservations();
DeploymentPlanner getDeploymentPlannerByName(String plannerName);
void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids);
}

View File

@ -362,9 +362,6 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
}
}
if (vm.getType() == VirtualMachine.Type.User) {
checkForNonDedicatedResources(vmProfile, dc, avoids);
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Deploy avoids pods: " + avoids.getPodsToAvoid() + ", clusters: " + avoids.getClustersToAvoid() + ", hosts: " + avoids.getHostsToAvoid());
}
@ -572,7 +569,8 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
return null;
}
private void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) {
@Override
public void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) {
boolean isExplicit = false;
VirtualMachine vm = vmProfile.getVirtualMachine();

View File

@ -1343,6 +1343,11 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
}
if (vm.getType() == VirtualMachine.Type.User || vm.getType() == VirtualMachine.Type.DomainRouter) {
final DataCenterVO dc = _dcDao.findById(srcHost.getDataCenterId());
_dpMgr.checkForNonDedicatedResources(vmProfile, dc, excludes);
}
for (final HostAllocator allocator : hostAllocators) {
if (canMigrateWithStorage) {
suitableHosts = allocator.allocateTo(vmProfile, plan, Host.Type.Routing, excludes, allHosts, HostAllocator.RETURN_UPTO_ALL, false);