private boolean getDefaultHasDns(Map<Long, Boolean> cache, Nic nic) { Long networkId = nic.isDefaultNic() ? Long.valueOf(nic.getNetworkId()) : getDefaultNetwork(nic.getInstanceId()); Boolean hasDns = cache.computeIfAbsent(networkId, k -> networkHasDns(_networkDao.findById(networkId))); return hasDns; }
@Override public long getEntityOwnerId() { Nic nic = _entityMgr.findById(Nic.class, nicId); if (nic == null) { throw new InvalidParameterValueException("Can't find nic for id specified"); } long vmId = nic.getInstanceId(); VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, vmId); return vm.getAccountId(); }
List<FirewallRuleVO> staticNatRules = _firewallDao.listStaticNatByVmId(nic.getInstanceId()); for (FirewallRuleVO rule : staticNatRules) { if (rule.getNetworkId() == nic.getNetworkId()) { for (IpAddress ip : staticNatIps) { if (ip.getVmIp() != null && ip.getVmIp().equals(nic.getIPv4Address())) { VMInstanceVO vm = _vmInstanceDao.findById(nic.getInstanceId()); List<LoadBalancerVMMapVO> lbMapList = _loadBalancerVMMapDao.listByInstanceId(nic.getInstanceId()); for (LoadBalancerVMMapVO lb : lbMapList) { FirewallRuleVO lbRule = _firewallDao.findById(lb.getLoadBalancerId());
NicResponse response = new NicResponse(); NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId()); VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId()); UserVmJoinVO userVm = _entityMgr.findById(UserVmJoinVO.class, result.getInstanceId()); List<NicExtraDhcpOptionVO> nicExtraDhcpOptionVOs = _nicExtraDhcpOptionDao.listByNicId(result.getId());
public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, Integer networkRate, boolean isSecurityGroupEnabled, String name) { id = nic.getId(); networkId = network.getId(); mode = network.getMode(); broadcastType = network.getBroadcastDomainType(); trafficType = network.getTrafficType(); format = nic.getAddressFormat(); iPv4Address = nic.getIPv4Address(); iPv4Netmask = nic.getIPv4Netmask(); iPv4Gateway = nic.getIPv4Gateway(); iPv6Address = nic.getIPv6Address(); iPv6Gateway = nic.getIPv6Gateway(); iPv6Cidr = nic.getIPv6Cidr(); macAddress = nic.getMacAddress(); reservationId = nic.getReservationId(); strategy = nic.getReservationStrategy(); deviceId = nic.getDeviceId(); defaultNic = nic.isDefaultNic(); this.broadcastUri = broadcastUri; this.isolationUri = isolationUri; this.isSecurityGroupEnabled = isSecurityGroupEnabled; vmId = nic.getInstanceId(); this.name = name; uuid = nic.getUuid(); if (networkRate != null) { this.networkRate = networkRate; } }