server: fix npe during start vr edge case (#10366)

DeploymentPlanner.addPod takes long value while
VmInstanceVO.getPodIdToDeployIn returns a Long value which can be null
when the VM is never started.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2025-03-18 08:52:11 +05:30 committed by GitHub
parent 02d0dca24b
commit 89e6b1f8ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -445,7 +445,9 @@ public class NetworkHelperImpl implements NetworkHelper {
final int retryIndex = 5;
final ExcludeList[] avoids = new ExcludeList[5];
avoids[0] = new ExcludeList();
if (routerToBeAvoid.getPodIdToDeployIn() != null) {
avoids[0].addPod(routerToBeAvoid.getPodIdToDeployIn());
}
avoids[1] = new ExcludeList();
avoids[1].addCluster(_hostDao.findById(routerToBeAvoid.getHostId()).getClusterId());
avoids[2] = new ExcludeList();