@Override public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst) { release(nic, vm, src.getReservationId()); } }
@Override public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst) { release(nic, vm, dst.getReservationId()); }
public void setPlan(DeploymentPlan plan) { if (plan != null) { dcId = plan.getDataCenterId(); podId = plan.getPodId(); clusterId = plan.getClusterId(); hostId = plan.getHostId(); poolId = plan.getPoolId(); physicalNetworkId = plan.getPhysicalNetworkId(); avoids = plan.getAvoids(); if (plan.getReservationContext() != null) reservationId = plan.getReservationContext().getReservationId(); } }
String reservationId = context.getReservationId(); List<SspUuidVO> tenantPortUuidVos = _sspUuidDao.listUUidVoByNicProfile(nic); for (SspUuidVO tenantPortUuidVo : tenantPortUuidVos) {
return false; String reservationId = context.getReservationId();
network.setReservationId(context.getReservationId()); if (isSharedNetworkWithServices(network)) { network.setState(Network.State.Implementing);
@Override public Network implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context) throws InsufficientVirtualNetworkCapacityException { assert network.getState() == State.Implementing : "Why are we implementing " + network; final long dcId = dest.getDataCenter().getId(); //get physical network id Long physicalNetworkId = network.getPhysicalNetworkId(); // physical network id can be null in Guest Network in Basic zone, so locate the physical network if (physicalNetworkId == null) { physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType()); } final NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, network.getDataCenterId(), physicalNetworkId, offering.isRedundantRouter()); allocateVnet(network, implemented, dcId, physicalNetworkId, context.getReservationId()); if (network.getGateway() != null) { implemented.setGateway(network.getGateway()); } if (network.getCidr() != null) { implemented.setCidr(network.getCidr()); } return implemented; }
@Override public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { Pod pod = dest.getPod(); boolean forSystemVms = vm.getType().equals(VirtualMachine.Type.ConsoleProxy) || vm.getType().equals(VirtualMachine.Type.SecondaryStorageVm); PrivateAllocationData result = _dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId(), forSystemVms); if (result == null) { throw new InsufficientAddressCapacityException("Unable to get a management ip address", Pod.class, pod.getId()); } Integer vlan = result.getVlan(); nic.setIPv4Address(result.getIpAddress()); nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(result.getMacAddress(), NetworkModel.MACIdentifier.value()))); nic.setIPv4Gateway(pod.getGateway()); nic.setFormat(AddressFormat.Ip4); String netmask = NetUtils.getCidrNetmask(pod.getCidrSize()); nic.setIPv4Netmask(netmask); nic.setBroadcastType(BroadcastDomainType.Native); if (vlan != null) { nic.setBroadcastUri(BroadcastDomainType.Native.toUri(vlan)); } else { nic.setBroadcastUri(null); } nic.setIsolationUri(null); s_logger.debug("Allocated a nic " + nic + " for " + vm); }
@Override public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapacityException { assert (network.getState() == State.Implementing) : "Why are we implementing " + network; long dcId = dest.getDataCenter().getId(); //get physical network id Long physicalNetworkId = network.getPhysicalNetworkId(); // physical network id can be null in Guest Network in Basic zone, so locate the physical network if (physicalNetworkId == null) { physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType()); } NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, network.getDataCenterId(), physicalNetworkId, offering.isRedundantRouter()); allocateVnet(network, implemented, dcId, physicalNetworkId, context.getReservationId()); if (network.getGateway() != null) { implemented.setGateway(network.getGateway()); } if (network.getCidr() != null) { implemented.setCidr(network.getCidr()); } return implemented; }
vnetId = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), context.getReservationId(), UseSystemGuestVlans.valueIn(network.getAccountId())); if (vnetId == null) { throw new InsufficientVirtualNetworkCapacityException("Unable to allocate vnet as a " +
if (config.getBroadcastUri() == null) { String vnet = _dcDao.allocateVnet(zone.getId(), config.getPhysicalNetworkId(), config.getAccountId(), context.getReservationId(), UseSystemGuestVlans.valueIn(config.getAccountId()));
String ip = _dcDao.allocateLinkLocalIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId()); if (ip == null) { throw new InsufficientAddressCapacityException("Insufficient link local address capacity", DataCenter.class, dest.getDataCenter().getId());
if (nic.getReservationStrategy() == Nic.ReservationStrategy.Start) { nic.setState(Nic.State.Reserving); nic.setReservationId(context.getReservationId()); _nicDao.update(nic.getId(), nic); URI broadcastUri = nic.getBroadcastUri();