weizhouapache commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092570389

   @sureshanaparti 
   #7214 has refactored this code snippet in main/4.20 branch
   we can consider the backport to 4.18/4.19, and fix the issue like
   ```
        private DeployDestination deployInVmLastHost(VirtualMachineProfile 
vmProfile, DeploymentPlan plan, ExcludeList avoids,
                DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, 
ServiceOffering offering, int cpuRequested, long ramRequested,
                boolean volumesRequireEncryption) throws 
InsufficientServerCapacityException {
            HostVO host = _hostDao.findById(vm.getLastHostId());
   +        if (host == null) {
   +            logger.warn(String.format("The last host [id=%s] does not 
exist, it may have been removed.", vm.getLastHostId()));
   +            return null;
   +        }
            _hostDao.loadHostTags(host);
            _hostDao.loadDetails(host);
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to