/** * Swaps the UUID's of the given nics's * @param oldNic * @param newNic */ private void swapUuids(NicVO oldNic, NicVO newNic) { final String realUuid = oldNic.getUuid(); final String dummyUuid = newNic.getUuid(); oldNic.setUuid(dummyUuid.replace("-", "+")); newNic.setUuid(realUuid); _nicDao.persist(oldNic); _nicDao.persist(newNic); oldNic.setUuid(dummyUuid); _nicDao.persist(oldNic); }
public VspNic buildVspNic(NicVO nic) { return buildVspNic(nic.getUuid(), nic.getMacAddress(), nic.getIPv4Address(), nic.getNetworkId(), null); }
@Override public boolean setExtraDhcpOptions(Network network, long nicId, Map<Integer, String> dhcpOptions) { if (network.isRollingRestart()) { return true; } VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network); HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId()); NicVO nic = _nicDao.findById(nicId); ExtraDhcpOptionsVspCommand extraDhcpOptionsVspCommand = new ExtraDhcpOptionsVspCommand(vspNetwork, nic.getUuid(), dhcpOptions); Answer answer = _agentMgr.easySend(nuageVspHost.getId(), extraDhcpOptionsVspCommand); if (isFailure(answer)) { s_logger.error("[setExtraDhcpOptions] setting extra DHCP options for nic " + nic.getUuid() + " failed."); return false; } return true; }
public VspNic buildVspNic(NicVO nic, NicSecondaryIpVO nicSecondaryIp) { return buildVspNic(nic.getUuid(), nic.getMacAddress(), nic.getIPv4Address(), nic.getNetworkId(), nicSecondaryIp); }
final NetworkGuruAdditionalFunctions guruFunctions = (NetworkGuruAdditionalFunctions) guru; final Map<String, ? extends Object> nsxParams = guruFunctions.listAdditionalNicParams(nic.getUuid()); if (nsxParams != null){ final String lswitchUuuid = nsxParams.containsKey(NetworkGuruAdditionalFunctions.NSX_LSWITCH_UUID)
private void buildNicResources(VirtualMachineModel vmModel, VMInstanceVO dbVm, StringBuffer syncLogMsg) throws IOException { List<NicVO> nics = _nicDao.listByVmId(dbVm.getId()); for (NicVO nic : nics) { VMInterfaceModel vmiModel = vmModel.getVMInterface(nic.getUuid()); if (vmiModel == null) { vmiModel = new VMInterfaceModel(nic.getUuid()); NetworkVO network = _networksDao.findById(nic.getNetworkId()); VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType()); if (vnModel == null) { s_logger.warn("Unable to locate virtual-network for network id " + network.getId()); continue; } vmiModel.addToVirtualMachine(vmModel); vmiModel.addToVirtualNetwork(vnModel); } vmiModel.build(_manager.getModelController(), dbVm, nic); } }
HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId()); NiciraNvpNicMappingVO nicMap = niciraNvpNicMappingDao.findByNicUuid(nicVO.getUuid()); if (nicMap == null) { s_logger.error("No mapping for nic " + nic.getName());
return true; VMInterfaceModel vmiModel = vmModel.getVMInterface(nic.getUuid()); if (vmiModel != null) { try {
return; VMInterfaceModel vmiModel = vmModel.getVMInterface(nicVO.getUuid()); if (vmiModel == null) { return;
@Override public NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result) { NicSecondaryIpResponse response = new NicSecondaryIpResponse(); NicVO nic = _entityMgr.findById(NicVO.class, result.getNicId()); NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId()); response.setId(result.getUuid()); setResponseIpAddress(result, response); response.setNicId(nic.getUuid()); response.setNwId(network.getUuid()); response.setObjectName("nicsecondaryip"); return response; }
HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId()); NiciraNvpNicMappingVO existingNicMap = niciraNvpNicMappingDao.findByNicUuid(nicVO.getUuid()); if (existingNicMap != null) { FindLogicalSwitchPortCommand findCmd = new FindLogicalSwitchPortCommand(existingNicMap.getLogicalSwitchUuid(), existingNicMap.getLogicalSwitchPortUuid()); UpdateLogicalSwitchPortCommand cmd = new UpdateLogicalSwitchPortCommand(existingNicMap.getLogicalSwitchPortUuid(), BroadcastDomainType.getValue(network.getBroadcastUri()), nicVO.getUuid(), context.getDomain().getName() + "-" + context.getAccount().getAccountName(), nic.getName()); agentMgr.easySend(niciraNvpHost.getId(), cmd); return true; new CreateLogicalSwitchPortCommand(BroadcastDomainType.getValue(network.getBroadcastUri()), nicVO.getUuid(), context.getDomain().getName() + "-" + context.getAccount().getAccountName(), nic.getName()); CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd); new NiciraNvpNicMappingVO(BroadcastDomainType.getValue(network.getBroadcastUri()), answer.getLogicalSwitchPortUuid(), nicVO.getUuid()); niciraNvpNicMappingDao.persist(nicMap);
.getDomainId(), network); VspVm vspVm = _nuageVspEntityBuilder.buildVspVm(virtualMachine, network); VspNic vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic); HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
/** Build VspDhcpVMOption to put on the VM interface */ public VspDhcpVMOption buildVmDhcpOption (NicVO userNic, boolean defaultHasDns, boolean networkHasDns) { VMInstanceVO userVm = _vmInstanceDao.findById(userNic.getInstanceId()); VspDhcpVMOption.Builder vspDhcpVMOptionBuilder = new VspDhcpVMOption.Builder() .nicUuid(userNic.getUuid()) .defaultHasDns(defaultHasDns) .hostname(userVm.getHostName()) .networkHasDns(networkHasDns) .isDefaultInterface(userNic.isDefaultNic()) .domainRouter(VirtualMachine.Type.DomainRouter.equals(userNic.getVmType())); return vspDhcpVMOptionBuilder.build(); }
VMInterfaceModel vmiModel = vmModel.getVMInterface(nicVO.getUuid()); if (vmiModel == null) { vmiModel = new VMInterfaceModel(nicVO.getUuid()); vmiModel.addToVirtualMachine(vmModel); vmiModel.addToVirtualNetwork(vnModel); MacAddressesType macs = vmi.getMacAddresses(); if (macs == null) { s_logger.debug("no mac address is allocated for Nic " + nicVO.getUuid()); } else { s_logger.info("VMI " + _manager.getVifNameByVmUuid(vm.getUuid(), nicVO.getDeviceId()) + " got mac address: " + macs.getMacAddress().get(0));
VspNic vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic); VspStaticNat vspStaticNat = null; if (staticNatIp != null) {
assert vmModel != null : "can not find vm model"; VMInterfaceModel vmiModel = vmModel.getVMInterface(nic.getUuid()); assert vmiModel != null && vmiModel.getVMInterface() != null : "can not find virtual machine interface";
to.setUuid(nicVO.getUuid());