public VspNic buildVspNic(NicVO nic, NicSecondaryIpVO nicSecondaryIp) { return buildVspNic(nic.getUuid(), nic.getMacAddress(), nic.getIPv4Address(), nic.getNetworkId(), nicSecondaryIp); }
public VspNic buildVspNic(NicVO nic) { return buildVspNic(nic.getUuid(), nic.getMacAddress(), nic.getIPv4Address(), nic.getNetworkId(), null); }
network.getUuid(), network.getGateway(), nic.getMacAddress(), network.getCidr()); tiers.add(tier);
public void build(ModelController controller, VMInstanceVO instance, NicVO nic) throws IOException { setProperties(controller, instance, nic); InstanceIpModel ipModel = getInstanceIp(); String ipAddress = nic.getIPv4Address(); if (ipAddress != null) { if (ipModel == null) { ipModel = new InstanceIpModel(_vmName, _deviceId); ipModel.addToVMInterface(this); } ipModel.setAddress(ipAddress); } else if (ipModel != null) { removeSuccessor(ipModel); } _macAddress = nic.getMacAddress(); }
@Override public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) { List<NicVO> nics = _nicDao.listByVmId(vm.getId()); if (nics.size() != 1) { throw new CloudRuntimeException("Wrong nic number " + nics.size() + " of vm " + vm.getId()); } /* use last host id when VM stopped */ Long hostId = (vm.getHostId() == null ? vm.getLastHostId() : vm.getHostId()); HostVO host = _hostDao.findById(hostId); DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); NicVO nic = nics.get(0); String mask = nic.getIPv4Netmask(); String mac = nic.getMacAddress(); String ip = nic.getIPv4Address(); String gateway = nic.getIPv4Gateway(); String dns = dc.getDns1(); if (dns == null) { dns = dc.getDns2(); } try { PrepareCreateTemplateCommand cmd = new PrepareCreateTemplateCommand(ip, mac, mask, gateway, dns, templateUrl); Answer ans = _agentMgr.send(pxeServerId, cmd); return ans.getResult(); } catch (Exception e) { s_logger.debug("Prepare for creating baremetal template failed", e); return false; } }
s_logger.info("Use same MAC as previous RvR, the MAC is " + peerNic.getMacAddress()); defaultNic.setMacAddress(peerNic.getMacAddress());
final NetworkVO nw = _networkDao.findById(nic.getNetworkId()); if (nw.getTrafficType() == TrafficType.Public) { baseMac = nic.getMacAddress(); break;
public void createDhcpEntryCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final Commands cmds) { final DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIPv4Address(), vm.getHostName(), nic.getIPv6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd()); String gatewayIp = nic.getIPv4Gateway(); final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); dhcpCommand.setDefaultRouter(gatewayIp); dhcpCommand.setIp6Gateway(nic.getIPv6Gateway()); String ipaddress = null; final NicVO domrDefaultNic = findDefaultDnsIp(vm.getId()); if (domrDefaultNic != null) { ipaddress = domrDefaultNic.getIPv4Address(); } dhcpCommand.setDefaultDns(ipaddress); dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress())); dhcpCommand.setDefault(nic.isDefaultNic()); dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId())); dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(nic.getNetworkId(), router.getId())); dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString()); cmds.addCommand("dhcp", dhcpCommand); }
TopologyData.Port p = topo.new Port(); p.setAttachmentInfo(netData.new AttachmentInfo(nic.getUuid(),nic.getMacAddress())); p.setMac(nic.getMacAddress());
@Override public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) { UserVmVO userVm = _vmDao.findById(profile.getId()); List<NicVO> nics = _nicDao.listByVmId(userVm.getId()); for (NicVO nic : nics) { NetworkVO network = _networkDao.findById(nic.getNetworkId()); if (network.getTrafficType() == TrafficType.Guest || network.getTrafficType() == TrafficType.Public) { userVm.setPrivateIpAddress(nic.getIPv4Address()); userVm.setPrivateMacAddress(nic.getMacAddress()); _vmDao.update(userVm.getId(), userVm); } } List<VolumeVO> volumes = _volsDao.findByInstance(userVm.getId()); VmDiskStatisticsVO diskstats = null; for (VolumeVO volume : volumes) { diskstats = _vmDiskStatsDao.findBy(userVm.getAccountId(), userVm.getDataCenterId(), userVm.getId(), volume.getId()); if (diskstats == null) { diskstats = new VmDiskStatisticsVO(userVm.getAccountId(), userVm.getDataCenterId(), userVm.getId(), volume.getId()); _vmDiskStatsDao.persist(diskstats); } } finalizeCommandsOnStart(cmds, profile); return true; }
protected NicTO toNicTO(final NicVO nic, final NicProfile profile, final NetworkVO config) { final NicTO to = new NicTO(); to.setDeviceId(nic.getDeviceId()); to.setBroadcastType(config.getBroadcastDomainType()); to.setType(config.getTrafficType()); to.setIp(nic.getIPv4Address()); to.setNetmask(nic.getIPv4Netmask()); to.setMac(nic.getMacAddress()); to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); if (nic.getIPv4Gateway() != null) { to.setGateway(nic.getIPv4Gateway()); } else { to.setGateway(config.getGateway()); } if (nic.getVmType() != VirtualMachine.Type.User) { to.setPxeDisable(true); } to.setDefaultNic(nic.isDefaultNic()); to.setBroadcastUri(nic.getBroadcastUri()); to.setIsolationuri(nic.getIsolationUri()); if (profile != null) { to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); } final Integer networkRate = _networkModel.getNetworkRate(config.getId(), null); to.setNetworkRateMbps(networkRate); to.setUuid(config.getUuid()); return to; }
AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ); AllFieldsSearch.and("reserverName",AllFieldsSearch.entity().getReserver(),Op.EQ); AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ); AllFieldsSearch.done(); PeerRouterSearch.and("macAddress", PeerRouterSearch.entity().getMacAddress(), Op.EQ); PeerRouterSearch.and("vmType", PeerRouterSearch.entity().getVmType(), Op.EQ); PeerRouterSearch.done();