当前位置: 首页>>代码示例>>Java>>正文


Java Pod类代码示例

本文整理汇总了Java中com.cloud.dc.Pod的典型用法代码示例。如果您正苦于以下问题:Java Pod类的具体用法?Java Pod怎么用?Java Pod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pod类属于com.cloud.dc包,在下文中一共展示了Pod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: add

import com.cloud.dc.Pod; //导入依赖的package包/类
public boolean add(final InsufficientCapacityException e) {
    final Class<?> scope = e.getScope();

    if (scope == null) {
        return false;
    }

    if (Host.class.isAssignableFrom(scope)) {
        addHost(e.getId());
    } else if (Pod.class.isAssignableFrom(scope)) {
        addPod(e.getId());
    } else if (Zone.class.isAssignableFrom(scope)) {
        addZone(e.getId());
    } else if (Cluster.class.isAssignableFrom(scope)) {
        addCluster(e.getId());
    } else if (StoragePool.class.isAssignableFrom(scope)) {
        addPool(e.getId());
    } else {
        return false;
    }

    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:DeploymentPlanner.java

示例2: getDeployDestination

import com.cloud.dc.Pod; //导入依赖的package包/类
public DeployDestination getDeployDestination() {
    final Zone zone = zoneId != null ? s_zoneRepository.findOne(zoneId) : null;
    final Pod pod = podId != null ? s_entityMgr.findById(Pod.class, podId) : null;
    final Cluster cluster = clusterId != null ? s_entityMgr.findById(Cluster.class, clusterId) : null;
    final Host host = hostId != null ? s_entityMgr.findById(Host.class, hostId) : null;

    Map<Volume, StoragePool> vols = null;

    if (storage != null) {
        vols = new HashMap<>(storage.size());
        for (final Map.Entry<String, String> entry : storage.entrySet()) {
            vols.put(s_entityMgr.findByUuid(Volume.class, entry.getKey()), s_entityMgr.findByUuid(StoragePool.class, entry.getValue()));
        }
    }

    final DeployDestination dest = new DeployDestination(zone, pod, cluster, host, vols);
    return dest;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:VmWorkMigrate.java

示例3: moveVolume

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public VolumeInfo moveVolume(final VolumeInfo volume, final long destPoolDcId, final Long destPoolPodId, final Long destPoolClusterId, final HypervisorType dataDiskHyperType)
        throws ConcurrentOperationException, StorageUnavailableException {

    // Find a destination storage pool with the specified criteria
    final DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId());
    final DiskProfile dskCh = new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), diskOffering.getDiskSize(),
            diskOffering.getTagsArray(), diskOffering.getUseLocalStorage(), diskOffering.isRecreatable(), null);
    dskCh.setHyperType(dataDiskHyperType);
    final DataCenter destPoolDataCenter = _entityMgr.findById(DataCenter.class, destPoolDcId);
    final Pod destPoolPod = _entityMgr.findById(Pod.class, destPoolPodId);

    final StoragePool destPool = findStoragePool(dskCh, destPoolDataCenter, destPoolPod, destPoolClusterId, null, null, new HashSet<>());

    if (destPool == null) {
        throw new CloudRuntimeException("Failed to find a storage pool with enough capacity to move the volume to.");
    }

    final Volume newVol = migrateVolume(volume, destPool);
    return volFactory.getVolume(newVol.getId());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:22,代码来源:VolumeOrchestrator.java

示例4: isEnabledForAllocation

import com.cloud.dc.Pod; //导入依赖的package包/类
private boolean isEnabledForAllocation(final long zoneId, final Long podId, final Long clusterId) {
    // Check if the zone exists in the system
    final Zone zone = zoneRepository.findOne(zoneId);
    if (zone != null && AllocationState.Disabled == zone.getAllocationState()) {
        s_logger.info("Zone is currently disabled, cannot allocate to this zone: " + zoneId);
        return false;
    }

    final Pod pod = _podDao.findById(podId);
    if (pod != null && AllocationState.Disabled == pod.getAllocationState()) {
        s_logger.info("Pod is currently disabled, cannot allocate to this pod: " + podId);
        return false;
    }

    final Cluster cluster = _clusterDao.findById(clusterId);
    if (cluster != null && AllocationState.Disabled == cluster.getAllocationState()) {
        s_logger.info("Cluster is currently disabled, cannot allocate to this cluster: " + clusterId);
        return false;
    }

    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:23,代码来源:DeploymentPlanningManagerImpl.java

示例5: createPod

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public Pod createPod(final long zoneId, final String name, final String startIp, final String endIp, final String gateway, final String netmask, String allocationState) {
    // Check if the gateway is a valid IP address
    if (!NetUtils.isValidIp4(gateway)) {
        throw new InvalidParameterValueException("The gateway is invalid");
    }

    if (!NetUtils.isValidIp4Netmask(netmask)) {
        throw new InvalidParameterValueException("The netmask is invalid");
    }

    final String cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask);

    final Long userId = CallContext.current().getCallingUserId();

    if (allocationState == null) {
        allocationState = AllocationState.Enabled.toString();
    }
    return createPod(userId.longValue(), name, zoneId, gateway, cidr, startIp, endIp, allocationState, false);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:21,代码来源:ConfigurationManagerImpl.java

示例6: add

import com.cloud.dc.Pod; //导入依赖的package包/类
public boolean add(InsufficientCapacityException e) {
    Class<?> scope = e.getScope();

    if (scope == null) {
        return false;
    }

    if (Host.class.isAssignableFrom(scope)) {
        addHost(e.getId());
    } else if (Pod.class.isAssignableFrom(scope)) {
        addPod(e.getId());
    } else if (DataCenter.class.isAssignableFrom(scope)) {
        addDataCenter(e.getId());
    } else if (Cluster.class.isAssignableFrom(scope)) {
        addCluster(e.getId());
    } else if (StoragePool.class.isAssignableFrom(scope)) {
        addPool(e.getId());
    } else {
        return false;
    }

    return true;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:24,代码来源:DeploymentPlanner.java

示例7: moveVolume

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType)
        throws ConcurrentOperationException, StorageUnavailableException {

    // Find a destination storage pool with the specified criteria
    DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId());
    DiskProfile dskCh = new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), diskOffering.getDiskSize(),
            diskOffering.getTagsArray(), diskOffering.getUseLocalStorage(), diskOffering.isRecreatable(), null);
    dskCh.setHyperType(dataDiskHyperType);
    storageMgr.setDiskProfileThrottling(dskCh, null, diskOffering);

    DataCenter destPoolDataCenter = _entityMgr.findById(DataCenter.class, destPoolDcId);
    Pod destPoolPod = _entityMgr.findById(Pod.class, destPoolPodId);

    StoragePool destPool = findStoragePool(dskCh, destPoolDataCenter, destPoolPod, destPoolClusterId, null, null, new HashSet<StoragePool>());

    if (destPool == null) {
        throw new CloudRuntimeException("Failed to find a storage pool with enough capacity to move the volume to.");
    }

    Volume newVol = migrateVolume(volume, destPool);
    return volFactory.getVolume(newVol.getId());
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:24,代码来源:VolumeOrchestrator.java

示例8: getDeployDestination

import com.cloud.dc.Pod; //导入依赖的package包/类
public DeployDestination getDeployDestination() {
    DataCenter zone = zoneId != null ? s_entityMgr.findById(DataCenter.class, zoneId) : null;
    Pod pod = podId != null ? s_entityMgr.findById(Pod.class, podId) : null;
    Cluster cluster = clusterId != null ? s_entityMgr.findById(Cluster.class, clusterId) : null;
    Host host = hostId != null ? s_entityMgr.findById(Host.class, hostId) : null;

    Map<Volume, StoragePool> vols = null;

    if (storage != null) {
        vols = new HashMap<Volume, StoragePool>(storage.size());
        for (Map.Entry<String, String> entry : storage.entrySet()) {
            vols.put(s_entityMgr.findByUuid(Volume.class, entry.getKey()), s_entityMgr.findByUuid(StoragePool.class, entry.getValue()));
        }
    }

    DeployDestination dest = new DeployDestination(zone, pod, cluster, host, vols);
    return dest;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:19,代码来源:VmWorkMigrate.java

示例9: isEnabledForAllocation

import com.cloud.dc.Pod; //导入依赖的package包/类
private boolean isEnabledForAllocation(long zoneId, Long podId, Long clusterId) {
    // Check if the zone exists in the system
    DataCenterVO zone = _dcDao.findById(zoneId);
    if (zone != null && Grouping.AllocationState.Disabled == zone.getAllocationState()) {
        s_logger.info("Zone is currently disabled, cannot allocate to this zone: " + zoneId);
        return false;
    }

    Pod pod = _podDao.findById(podId);
    if (pod != null && Grouping.AllocationState.Disabled == pod.getAllocationState()) {
        s_logger.info("Pod is currently disabled, cannot allocate to this pod: " + podId);
        return false;
    }

    Cluster cluster = _clusterDao.findById(clusterId);
    if (cluster != null && Grouping.AllocationState.Disabled == cluster.getAllocationState()) {
        s_logger.info("Cluster is currently disabled, cannot allocate to this cluster: " + clusterId);
        return false;
    }

    return true;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:23,代码来源:DeploymentPlanningManagerImpl.java

示例10: createPod

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public Pod createPod(final long zoneId, final String name, final String startIp, final String endIp, final String gateway, final String netmask, String allocationState) {
    // Check if the gateway is a valid IP address
    if (!NetUtils.isValidIp4(gateway)) {
        throw new InvalidParameterValueException("The gateway is invalid");
    }

    if (!NetUtils.isValidIp4Netmask(netmask)) {
        throw new InvalidParameterValueException("The netmask is invalid");
    }

    final String cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask);

    final Long userId = CallContext.current().getCallingUserId();

    if (allocationState == null) {
        allocationState = Grouping.AllocationState.Enabled.toString();
    }
    return createPod(userId.longValue(), name, zoneId, gateway, cidr, startIp, endIp, allocationState, false);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:21,代码来源:ConfigurationManagerImpl.java

示例11: getBaremetalIp

import com.cloud.dc.Pod; //导入依赖的package包/类
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());
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:22,代码来源:BaremetaNetworkGuru.java

示例12: deployLoadBalancerVM

import com.cloud.dc.Pod; //导入依赖的package包/类
private DomainRouterVO deployLoadBalancerVM(final Long networkId, final IPAddressVO ipAddr) {
    final NetworkVO network = _networkDao.findById(networkId);
    final DataCenter dc = _dcDao.findById(network.getDataCenterId());
    final Long podId = getPodIdForDirectIp(ipAddr);
    final Pod pod = podId == null ? null : _podDao.findById(podId);
    final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
    params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
    final Account owner = _accountService.getActiveAccountByName("system", new Long(1));
    final DeployDestination dest = new DeployDestination(dc, pod, null, null);
    s_logger.debug("About to deploy ELB vm ");

    try {
        final DomainRouterVO elbVm = deployELBVm(network, dest, owner, params);
        if (elbVm == null) {
            throw new InvalidParameterValueException("Could not deploy or find existing ELB VM");
        }
        s_logger.debug("Deployed ELB  vm = " + elbVm);

        return elbVm;

    } catch (final Throwable t) {
        s_logger.warn("Error while deploying ELB VM:  ", t);
        return null;
    }

}
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:LoadBalanceRuleHandler.java

示例13: execute

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public void execute() {
    final Pair<List<? extends Pod>, Integer> result = _mgr.searchForPods(this);
    final ListResponse<PodResponse> response = new ListResponse<>();
    final List<PodResponse> podResponses = new ArrayList<>();
    for (final Pod pod : result.first()) {
        final PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
        podResponse.setObjectName("pod");
        podResponses.add(podResponse);
    }

    response.setResponses(podResponses, result.second());
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:16,代码来源:ListPodsByCmd.java

示例14: execute

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public void execute() {
    final Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
    if (result != null) {
        final PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod");
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:12,代码来源:CreatePodCmd.java

示例15: execute

import com.cloud.dc.Pod; //导入依赖的package包/类
@Override
public void execute() {
    final Pod result = _configService.editPod(this);
    if (result != null) {
        final PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod");
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:12,代码来源:UpdatePodCmd.java


注:本文中的com.cloud.dc.Pod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。