public Long getPodId() { return dest.getPod() == null ? null : dest.getPod().getId(); }
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; s_logger.info("Check if we need to add management server explicit route to Internal LB. pod cidr: " + dest.getPod().getCidrAddress() + "/" + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + _mgmtHost); buf.append(" localgw=").append(dest.getPod().getGateway());
if (pod.getDescription() != null && pod.getDescription().length() > 0) { final String[] existingPodIpRanges = pod.getDescription().split(","); podResponse.setId(pod.getUuid()); podResponse.setName(pod.getName()); DataCenter zone = ApiDBUtils.findZoneById(pod.getDataCenterId()); if (zone != null) { podResponse.setZoneId(zone.getUuid()); podResponse.setZoneName(zone.getName()); podResponse.setNetmask(NetUtils.getCidrNetmask(pod.getCidrSize())); podResponse.setStartIp(startIp); podResponse.setEndIp(endIp); podResponse.setForSystemVms(forSystemVms); podResponse.setVlanId(vlanIds); podResponse.setGateway(pod.getGateway()); podResponse.setAllocationState(pod.getAllocationState().toString()); if (showCapacities != null && showCapacities) { List<SummedCapacity> capacities = ApiDBUtils.getCapacityByClusterPodZone(null, pod.getId(), null); Set<CapacityResponse> capacityResponses = new HashSet<CapacityResponse>(); for (SummedCapacity capacity : capacities) { capacityResponse.setCapacityUsed(capacity.getUsedCapacity() + capacity.getReservedCapacity()); if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) { List<SummedCapacity> c = ApiDBUtils.findNonSharedStorageForClusterPodZone(null, pod.getId(), null); capacityResponse.setCapacityTotal(capacity.getTotalCapacity() - c.get(0).getTotalCapacity()); capacityResponse.setCapacityUsed(capacity.getUsedCapacity() - c.get(0).getUsedCapacity()); capacityResponses.addAll(getStatsCapacityresponse(null, null, pod.getId(), pod.getDataCenterId()));
public boolean shouldAvoid(Pod pod) { if (_dcIds != null && _dcIds.contains(pod.getDataCenterId())) { return true; } if (_podIds != null && _podIds.contains(pod.getId())) { return true; } return false; }
@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); }
buf.append(" pod=").append(dest.getPod().getId()); buf.append(" guid=Proxy.").append(profile.getId()); buf.append(" proxy_vm=").append(profile.getId()); buf.append(" mgmtcidr=").append(mgmt_cidr); buf.append(" localgw=").append(dest.getPod().getGateway());
if (pod.getAllocationState() == Grouping.AllocationState.Enabled ) { s_logger.debug("The cluster is in a disabled pod : " + pod.getId());
String netmask = NetUtils.getCidrNetmask(pod.getCidrSize()); String gateway = pod.getGateway();
@DB protected void getIp(final NicProfile nic, final Pod pod, final VirtualMachineProfile vm, final Network network) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException { final DataCenter dc = _dcDao.findById(pod.getDataCenterId()); Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientAddressCapacityException>() { @Override
dest.getPod().getName(), "Migrate Command failed. Please check logs."); try { _agentMgr.send(dstHostId, new Commands(cleanup(vm.getInstanceName())), null);
private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp) throws InsufficientAddressCapacityException, ConcurrentOperationException { DataCenter dc = _dcDao.findById(pod.getDataCenterId()); if (nic.getIPv4Address() == null) { s_logger.debug(String.format("Requiring ip address: %s", nic.getIPv4Address())); PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), requiredIp, false, false); nic.setIPv4Address(ip.getAddress().toString()); nic.setFormat(AddressFormat.Ip4); nic.setIPv4Gateway(ip.getGateway()); nic.setIPv4Netmask(ip.getNetmask()); if (ip.getVlanTag() != null && ip.getVlanTag().equalsIgnoreCase(Vlan.UNTAGGED)) { nic.setIsolationUri(IsolationType.Ec2.toUri(Vlan.UNTAGGED)); nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(Vlan.UNTAGGED)); nic.setBroadcastType(BroadcastDomainType.Native); } nic.setReservationId(String.valueOf(ip.getVlanTag())); nic.setMacAddress(ip.getMacAddress()); } nic.setIPv4Dns1(dc.getDns1()); nic.setIPv4Dns2(dc.getDns2()); } }
if (pod.getAllocationState() != Grouping.AllocationState.Enabled) { s_logger.warn("The Pod containing this host is in disabled state, PodId= " + pod.getId()); return null;
throw new InvalidParameterValueException("Please specify a valid pod."); if (pod.getDataCenterId() != zoneId) { throw new InvalidParameterValueException("Pod id=" + podId + " doesn't belong to zone id=" + zoneId);
dest.getPod().getName(), "Migrate Command failed. Please check logs."); try { _agentMgr.send(dstHostId, new Commands(cleanup(vm)), null);
podId = _pod.getId();
buf.append(" localgw=").append(dest.getPod().getGateway()); } else if (nic.getTrafficType() == TrafficType.Control) { s_logger.info("Check if we need to add management server explicit route to ELB vm. pod cidr: " + dest.getPod().getCidrAddress() + "/" + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + ApiServiceConfiguration.ManagementServerAddresses.value()); buf.append(" localgw=").append(dest.getPod().getGateway());
buf.append(" localgw=").append(dest.getPod().getGateway()); } else if (nic.getTrafficType() == TrafficType.Control) { controlNic = nic; s_logger.info("Check if we need to add management server explicit route to DomR. pod cidr: " + dest.getPod().getCidrAddress() + "/" + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + ApiServiceConfiguration.ManagementServerAddresses.value()); if (NetUtils.isValidIp4Cidr(_mgmtCidr)) { buf.append(" mgmtcidr=").append(_mgmtCidr); buf.append(" localgw=").append(dest.getPod().getGateway());
public VmWorkMigrate(long userId, long accountId, long vmId, String handlerName, long srcHostId, DeployDestination dst) { super(userId, accountId, vmId, handlerName); this.srcHostId = srcHostId; zoneId = dst.getDataCenter() != null ? dst.getDataCenter().getId() : null; podId = dst.getPod() != null ? dst.getPod().getId() : null; clusterId = dst.getCluster() != null ? dst.getCluster().getId() : null; hostId = dst.getHost() != null ? dst.getHost().getId() : null; if (dst.getStorageForDisks() != null) { storage = new HashMap<String, String>(dst.getStorageForDisks().size()); for (Map.Entry<Volume, StoragePool> entry : dst.getStorageForDisks().entrySet()) { storage.put(entry.getKey().getUuid(), entry.getValue().getUuid()); } } else { storage = null; } }
private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) { Pod pod = dest.getPod(); if (pod != null && trafficType == TrafficType.Guest) { QueryBuilder<BaremetalPxeVO> sc = QueryBuilder.create(BaremetalPxeVO.class); sc.and(sc.entity().getPodId(), Op.EQ, pod.getId()); return sc.find() != null; } return false; }