mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [main] (#9063)
This commit is contained in:
parent
64593574d8
commit
6fda757936
@ -1077,6 +1077,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
return;
|
||||
}
|
||||
Host lastHost = _hostDao.findById(vm.getLastHostId());
|
||||
if (lastHost == null) {
|
||||
logger.warn("Could not find last host with id [{}], skipping migrate VM [{}] across cluster check." , vm.getLastHostId(), vm.getUuid());
|
||||
return;
|
||||
}
|
||||
if (destinationClusterId.equals(lastHost.getClusterId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -458,10 +458,9 @@ StateListener<State, VirtualMachine.Event, VirtualMachine>, Configurable {
|
||||
DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
|
||||
boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
|
||||
HostVO host = _hostDao.findById(vm.getLastHostId());
|
||||
_hostDao.loadHostTags(host);
|
||||
_hostDao.loadDetails(host);
|
||||
|
||||
if (canUseLastHost(host, avoids, plan, vm, offering, volumesRequireEncryption)) {
|
||||
_hostDao.loadHostTags(host);
|
||||
_hostDao.loadDetails(host);
|
||||
if (host.getStatus() != Status.Up) {
|
||||
logger.debug("Cannot deploy VM [{}] to the last host [{}] because this host is not in UP state or is not enabled. Host current status [{}] and resource status [{}].",
|
||||
vm.getUuid(), host.getUuid(), host.getState().name(), host.getResourceState());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user