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;
|
return;
|
||||||
}
|
}
|
||||||
Host lastHost = _hostDao.findById(vm.getLastHostId());
|
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())) {
|
if (destinationClusterId.equals(lastHost.getClusterId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -458,10 +458,9 @@ StateListener<State, VirtualMachine.Event, VirtualMachine>, Configurable {
|
|||||||
DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
|
DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
|
||||||
boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
|
boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
|
||||||
HostVO host = _hostDao.findById(vm.getLastHostId());
|
HostVO host = _hostDao.findById(vm.getLastHostId());
|
||||||
|
if (canUseLastHost(host, avoids, plan, vm, offering, volumesRequireEncryption)) {
|
||||||
_hostDao.loadHostTags(host);
|
_hostDao.loadHostTags(host);
|
||||||
_hostDao.loadDetails(host);
|
_hostDao.loadDetails(host);
|
||||||
|
|
||||||
if (canUseLastHost(host, avoids, plan, vm, offering, volumesRequireEncryption)) {
|
|
||||||
if (host.getStatus() != Status.Up) {
|
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 [{}].",
|
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());
|
vm.getUuid(), host.getUuid(), host.getState().name(), host.getResourceState());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user