Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
Expand Down Expand Up @@ -658,7 +659,7 @@ public void setKubernetesServiceHelpers(final List<KubernetesServiceHelper> kube
"Wait Interval (in seconds) for shared network vm dhcp ip addr fetch for next iteration ", true);

private static final ConfigKey<Integer> VmIpFetchTrialMax = new ConfigKey<Integer>("Advanced", Integer.class, "externaldhcp.vmip.max.retry", "10",
"The max number of retrieval times for shared entwork vm dhcp ip fetch, in case of failures", true);
"The max number of retrieval times for shared network vm dhcp ip fetch, in case of failures", true);

private static final ConfigKey<Integer> VmIpFetchThreadPoolMax = new ConfigKey<Integer>("Advanced", Integer.class, "externaldhcp.vmipFetch.threadPool.max", "10",
"number of threads for fetching vms ip address", true);
Expand Down Expand Up @@ -2674,7 +2675,7 @@ protected void runInContext() {

if (vmIdAndCount.getRetrievalCount() <= 0) {
vmIdCountMap.remove(nicId);
logger.debug("Vm " + vmId +" nic "+nicId + " count is zero .. removing vm nic from map ");
logger.debug("Vm {} nic {} count is zero .. removing vm nic from map ", vmId, nicId);

ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM,
Domain.ROOT_DOMAIN, EventTypes.EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH,
Expand All @@ -2683,12 +2684,15 @@ protected void runInContext() {
continue;
}


UserVm userVm = _vmDao.findById(vmId);
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
NicVO nicVo = _nicDao.findById(nicId);
NetworkVO network = _networkDao.findById(nicVo.getNetworkId());
if (ObjectUtils.anyNull(userVm, vmInstance, nicVo)) {
logger.warn("Couldn't fetch ip addr, Vm {} or nic {} doesn't exists", vmId, nicId);
continue;
}

NetworkVO network = _networkDao.findById(nicVo.getNetworkId());
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(userVm);
VirtualMachine vm = vmProfile.getVirtualMachine();
boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
Expand Down
Loading