@@ -658,7 +658,7 @@ public void setKubernetesServiceHelpers(final List<KubernetesServiceHelper> kube
658658 "Wait Interval (in seconds) for shared network vm dhcp ip addr fetch for next iteration " , true );
659659
660660 private static final ConfigKey <Integer > VmIpFetchTrialMax = new ConfigKey <Integer >("Advanced" , Integer .class , "externaldhcp.vmip.max.retry" , "10" ,
661- "The max number of retrieval times for shared entwork vm dhcp ip fetch, in case of failures" , true );
661+ "The max number of retrieval times for shared network vm dhcp ip fetch, in case of failures" , true );
662662
663663 private static final ConfigKey <Integer > VmIpFetchThreadPoolMax = new ConfigKey <Integer >("Advanced" , Integer .class , "externaldhcp.vmipFetch.threadPool.max" , "10" ,
664664 "number of threads for fetching vms ip address" , true );
@@ -2674,7 +2674,7 @@ protected void runInContext() {
26742674
26752675 if (vmIdAndCount .getRetrievalCount () <= 0 ) {
26762676 vmIdCountMap .remove (nicId );
2677- logger .debug ("Vm " + vmId + " nic " + nicId + " count is zero .. removing vm nic from map " );
2677+ logger .debug ("Vm {} nic {} count is zero .. removing vm nic from map " , vmId , nicId );
26782678
26792679 ActionEventUtils .onActionEvent (User .UID_SYSTEM , Account .ACCOUNT_ID_SYSTEM ,
26802680 Domain .ROOT_DOMAIN , EventTypes .EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH ,
@@ -2683,12 +2683,15 @@ protected void runInContext() {
26832683 continue ;
26842684 }
26852685
2686-
26872686 UserVm userVm = _vmDao .findById (vmId );
26882687 VMInstanceVO vmInstance = _vmInstanceDao .findById (vmId );
26892688 NicVO nicVo = _nicDao .findById (nicId );
2690- NetworkVO network = _networkDao .findById (nicVo .getNetworkId ());
2689+ if (ObjectUtils .anyNull (userVm , vmInstance , nicVo )) {
2690+ logger .warn ("Couldn't fetch ip addr, Vm {} or nic {} doesn't exists" , vmId , nicId );
2691+ continue ;
2692+ }
26912693
2694+ NetworkVO network = _networkDao .findById (nicVo .getNetworkId ());
26922695 VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl (userVm );
26932696 VirtualMachine vm = vmProfile .getVirtualMachine ();
26942697 boolean isWindows = _guestOSCategoryDao .findById (_guestOSDao .findById (vm .getGuestOSId ()).getCategoryId ()).getName ().equalsIgnoreCase ("Windows" );
0 commit comments