mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
server: Dedicated hosts should be 'Not Suitable' while find hosts for vm migration (#4001)
While migrate a vm, in the popup, the host dedicated to other accounts/domains are also 'Suitable" for migration, which is obviously wrong. The same issue happens with api findHostsForMigration
This commit is contained in:
parent
5526342f4a
commit
4da374b6b4
@ -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);
|
||||
}
|
||||
|
||||
@ -351,9 +351,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());
|
||||
}
|
||||
@ -561,7 +558,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();
|
||||
|
||||
|
||||
@ -1321,6 +1321,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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user