protected NicProfile getNicProfileByTrafficType(final VirtualMachineProfile profile, final TrafficType trafficType) { for (final NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == trafficType && nic.getIPv4Address() != null) { return nic; } } return null; }
@Override public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) { //NetScalerLB vm starts up with 3 Nics //Nic #1 - NS IP //Nic #2 - locallink(guest network) //Nic #3 - public nic for (final NicProfile nic : profile.getNics()) { if(nic.getTrafficType() == TrafficType.Control) { nic.setTrafficType(TrafficType.Guest); } } return true; }
while (it.hasNext()) { final NicProfile nic = it.next(); if (nic.getTrafficType() == TrafficType.Public || nic.getTrafficType() == TrafficType.Guest) { if (nic.getTrafficType() == TrafficType.Public) { defaultDns1 = nic.getIPv4Dns1(); defaultDns2 = nic.getIPv4Dns2(); s_logger.debug("Removing nic " + nic + " of type " + nic.getTrafficType() + " from the nics passed on vm start. " + "The nic will be plugged later"); it.remove();
if (nic.getTrafficType() == TrafficType.Guest) { guestNetwork = _ntwkModel.getNetwork(nic.getNetworkId()); } else if (nic.getTrafficType() == TrafficType.Management) { buf.append(" localgw=").append(dest.getPod().getGateway()); } else if (nic.getTrafficType() == TrafficType.Control) { controlNic = nic;
@Override public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) { NicProfile managementNic = null; NicProfile controlNic = null; for (NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == TrafficType.Management) { managementNic = nic; } else if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) { controlNic = nic; } } if (controlNic == null) { if (managementNic == null) { s_logger.error("Management network doesn't exist for the console proxy vm " + profile.getVirtualMachine()); return false; } controlNic = managementNic; } // verify ssh access on management nic for system vm running on HyperV if(profile.getHypervisorType() == HypervisorType.Hyperv) { controlNic = managementNic; } CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922); cmds.addCommand("checkSsh", check); return true; }
if (nic.getTrafficType() == TrafficType.Management) { String mgmt_cidr = _configDao.getValue(Config.ManagementNetwork.key()); if (NetUtils.isValidIp4Cidr(mgmt_cidr)) {
Long guestNtwkId = null; for (NicProfile routerNic : elbNics) { if (routerNic.getTrafficType() == TrafficType.Guest) { guestNtwkId = routerNic.getNetworkId(); break; defaultDns2 = nic.getIPv4Dns2(); if (nic.getTrafficType() == TrafficType.Management) { buf.append(" localgw=").append(dest.getPod().getGateway()); } else if (nic.getTrafficType() == TrafficType.Control) {
@Override public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) { assert nic.getTrafficType() == TrafficType.Control; HypervisorType hType = vm.getHypervisorType(); if ( ( (hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv) )&& isRouterVm(vm)) { long dcId = vm.getVirtualMachine().getDataCenterId(); DataCenterVO dcVo = _dcDao.findById(dcId); if (dcVo.getNetworkType() != NetworkType.Basic) { super.release(nic, vm, reservationId); if (s_logger.isDebugEnabled()) { s_logger.debug("Released nic: " + nic); } return true; } else { nic.deallocate(); if (s_logger.isDebugEnabled()) { s_logger.debug("Released nic: " + nic); } return true; } } _dcDao.releaseLinkLocalIpAddress(nic.getId(), reservationId); nic.deallocate(); if (s_logger.isDebugEnabled()) { s_logger.debug("Released nic: " + nic); } return true; }
protected NicProfile getControlNic(final VirtualMachineProfile profile) { final DomainRouterVO router = _routerDao.findById(profile.getId()); final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); NicProfile controlNic = null; if (profile.getHypervisorType() == HypervisorType.VMware && dcVo.getNetworkType() == NetworkType.Basic) { // TODO this is a ugly to test hypervisor type here // for basic network mode, we will use the guest NIC for control NIC for (final NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) { controlNic = nic; } } } else { for (final NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) { controlNic = nic; } } } return controlNic; }
@Override public boolean prepareMigration(final NicProfile nic, final Network network, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context) { if (!canHandle(network, Service.Connectivity)) { return false; } if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) { return false; } if (nic.getTrafficType() != Networks.TrafficType.Guest) { return false; } if (vm.getType() != VirtualMachine.Type.User && vm.getType() != VirtualMachine.Type.DomainRouter) { return false; } // prepare the tunnel network on the host, in order for VM to get launched _ovsTunnelMgr.checkAndPrepareHostForTunnelNetwork(network, dest.getHost()); return true; }
@Override public boolean release(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { if (!canHandle(network, Service.Connectivity)) { return false; } if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) { return false; } if (nic.getTrafficType() != Networks.TrafficType.Guest) { return false; } final HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); _ovsTunnelMgr.checkAndRemoveHostFromTunnelNetwork(network, host); return true; }
@Override public boolean prepare(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final DeployDestination dest, final ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { if (!canHandle(network, Service.Connectivity)) { return false; } if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) { return false; } if (nic.getTrafficType() != Networks.TrafficType.Guest) { return false; } if (vm.getType() != VirtualMachine.Type.User && vm.getType() != VirtualMachine.Type.DomainRouter) { return false; } // prepare the tunnel network on the host, in order for VM to get launched _ovsTunnelMgr.checkAndPrepareHostForTunnelNetwork(network, dest.getHost()); return true; }
@Override public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) { finalizeCommandsOnStart(cmds, profile); ConsoleProxyVO proxy = _consoleProxyDao.findById(profile.getId()); DataCenter dc = dest.getDataCenter(); List<NicProfile> nics = profile.getNics(); for (NicProfile nic : nics) { if ((nic.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) || (nic.getTrafficType() == TrafficType.Guest && (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()))) { proxy.setPublicIpAddress(nic.getIPv4Address()); proxy.setPublicNetmask(nic.getIPv4Netmask()); proxy.setPublicMacAddress(nic.getMacAddress()); } else if (nic.getTrafficType() == TrafficType.Management) { proxy.setPrivateIpAddress(nic.getIPv4Address()); proxy.setPrivateMacAddress(nic.getMacAddress()); } } _consoleProxyDao.update(proxy.getId(), proxy); return true; }
if (nic.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) { controlNic = nic; guestNetworkId = nic.getNetworkId(); if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) { controlNic = nic; } else if (nic.getTrafficType() == TrafficType.Guest) { guestNetworkId = nic.getNetworkId();
@Override public boolean finalizeDeployment(final Commands cmds, final VirtualMachineProfile profile, final DeployDestination dest, final ReservationContext context) throws ResourceUnavailableException { final DomainRouterVO router = _routerDao.findById(profile.getId()); final List<NicProfile> nics = profile.getNics(); for (final NicProfile nic : nics) { if (nic.getTrafficType() == TrafficType.Public) { router.setPublicIpAddress(nic.getIPv4Address()); router.setPublicNetmask(nic.getIPv4Netmask()); router.setPublicMacAddress(nic.getMacAddress()); } else if (nic.getTrafficType() == TrafficType.Control) { router.setPrivateIpAddress(nic.getIPv4Address()); router.setPrivateMacAddress(nic.getMacAddress()); } } _routerDao.update(router.getId(), router); finalizeCommandsOnStart(cmds, profile); return true; }
@Override public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException { DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId()); List<NicProfile> nics = profile.getNics(); for (NicProfile nic : nics) { if (nic.getTrafficType() == TrafficType.Public) { elbVm.setPublicIpAddress(nic.getIPv4Address()); elbVm.setPublicNetmask(nic.getIPv4Netmask()); elbVm.setPublicMacAddress(nic.getMacAddress()); } else if (nic.getTrafficType() == TrafficType.Control) { elbVm.setPrivateIpAddress(nic.getIPv4Address()); elbVm.setPrivateMacAddress(nic.getMacAddress()); } } _routerDao.update(elbVm.getId(), elbVm); finalizeCommandsOnStart(cmds, profile); return true; }
@Override public boolean finalizeDeployment(final Commands cmds, final VirtualMachineProfile profile, final DeployDestination dest, final ReservationContext context) throws ResourceUnavailableException { final DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId()); final List<NicProfile> nics = profile.getNics(); for (final NicProfile nic : nics) { if (nic.getTrafficType() == TrafficType.Control) { internalLbVm.setPrivateIpAddress(nic.getIPv4Address()); internalLbVm.setPrivateMacAddress(nic.getMacAddress()); } } _internalLbVmDao.update(internalLbVm.getId(), internalLbVm); finalizeCommandsOnStart(cmds, profile); return true; }
NicProfile profile = null; for(NicProfile nicProfile : nicProfiles) { if(nicProfile.getTrafficType() == TrafficType.Public) { publicNicProfile = nicProfile; break; else if (nicProfile.getTrafficType() == TrafficType.Control) { controlNicProfile = nicProfile;
to.setDeviceId(profile.getDeviceId()); to.setBroadcastType(profile.getBroadcastType()); to.setType(profile.getTrafficType()); to.setIp(profile.getIPv4Address()); to.setNetmask(profile.getIPv4Netmask());
@Override public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { assert nic.getTrafficType() == TrafficType.Control;