@@ -678,7 +678,7 @@ public void setKubernetesServiceHelpers(final List<KubernetesServiceHelper> kube
678678 "Wait Interval (in seconds) for shared network vm dhcp ip addr fetch for next iteration ", true);
679679
680680 private static final ConfigKey<Integer> VmIpFetchTrialMax = new ConfigKey<Integer>("Advanced", Integer.class, "externaldhcp.vmip.max.retry", "10",
681- "The max number of retrieval times for shared entwork vm dhcp ip fetch, in case of failures", true);
681+ "The max number of retrieval times for shared network vm dhcp ip fetch, in case of failures", true);
682682
683683 private static final ConfigKey<Integer> VmIpFetchThreadPoolMax = new ConfigKey<Integer>("Advanced", Integer.class, "externaldhcp.vmipFetch.threadPool.max", "10",
684684 "number of threads for fetching vms ip address", true);
@@ -2705,7 +2705,7 @@ protected void runInContext() {
27052705
27062706 if (vmIdAndCount.getRetrievalCount() <= 0) {
27072707 vmIdCountMap.remove(nicId);
2708- logger.debug("Vm " + vmId +" nic "+nicId + " count is zero .. removing vm nic from map ");
2708+ logger.debug("Vm {} nic {} count is zero .. removing vm nic from map ", vmId, nicId );
27092709
27102710 ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM,
27112711 Domain.ROOT_DOMAIN, EventTypes.EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH,
@@ -2714,12 +2714,15 @@ protected void runInContext() {
27142714 continue;
27152715 }
27162716
2717-
27182717 UserVm userVm = _vmDao.findById(vmId);
27192718 VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
27202719 NicVO nicVo = _nicDao.findById(nicId);
2721- NetworkVO network = _networkDao.findById(nicVo.getNetworkId());
2720+ if (ObjectUtils.anyNull(userVm, vmInstance, nicVo)) {
2721+ logger.warn("Couldn't fetch ip addr, Vm {} or nic {} doesn't exists", vmId, nicId);
2722+ continue;
2723+ }
27222724
2725+ NetworkVO network = _networkDao.findById(nicVo.getNetworkId());
27232726 VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(userVm);
27242727 VirtualMachine vm = vmProfile.getVirtualMachine();
27252728 boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
0 commit comments