Fixup: Optimize getRouterHealthChecksConfig method (#8677)

This commit is contained in:
Vishesh 2024-02-21 13:54:11 +05:30 committed by GitHub
parent af942e2260
commit e09fd2e26b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1791,16 +1791,14 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
} }
SearchBuilder<UserVmJoinVO> sbvm = userVmJoinDao.createSearchBuilder(); SearchBuilder<UserVmJoinVO> sbvm = userVmJoinDao.createSearchBuilder();
sbvm.and("networkId", sbvm.entity().getNetworkId(), SearchCriteria.Op.EQ); sbvm.and("networkId", sbvm.entity().getNetworkId(), SearchCriteria.Op.EQ);
sbvm.and("state", sbvm.entity().getState(), SearchCriteria.Op.EQ);
SearchCriteria<UserVmJoinVO> scvm = sbvm.create(); SearchCriteria<UserVmJoinVO> scvm = sbvm.create();
scvm.setParameters("networkId", routerJoinVO.getNetworkId()); scvm.setParameters("networkId", routerJoinVO.getNetworkId());
scvm.setParameters("state", VirtualMachine.State.Running);
List<UserVmJoinVO> vms = userVmJoinDao.search(scvm, null); List<UserVmJoinVO> vms = userVmJoinDao.search(scvm, null);
boolean isDhcpSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dhcp); boolean isDhcpSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dhcp);
boolean isDnsSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dns); boolean isDnsSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dns);
for (UserVmJoinVO vm : vms) { for (UserVmJoinVO vm : vms) {
if (vm.getState() != VirtualMachine.State.Running) {
continue;
}
vmsData.append("vmName=").append(vm.getName()) vmsData.append("vmName=").append(vm.getName())
.append(",macAddress=").append(vm.getMacAddress()) .append(",macAddress=").append(vm.getMacAddress())
.append(",ip=").append(vm.getIpAddress()) .append(",ip=").append(vm.getIpAddress())