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


Java HostPodVO类代码示例

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


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

示例1: listClustersWithDisabledPods

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Override
public List<Long> listClustersWithDisabledPods(final long zoneId) {

    final GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
    disabledPodIdSearch.selectFields(disabledPodIdSearch.entity().getId());
    disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
    disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);

    final GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
    clusterIdSearch.selectFields(clusterIdSearch.entity().getId());
    clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(),
            JoinBuilder.JoinType.INNER);
    clusterIdSearch.done();

    final SearchCriteria<Long> sc = clusterIdSearch.create();
    sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId);
    sc.setJoinParameters("disabledPodIdSearch", "allocationState", AllocationState.Disabled);

    return customSearch(sc, null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:21,代码来源:ClusterDaoImpl.java

示例2: listByDataCenterIdVMTypeAndStates

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
/**
 * Lists all pods given a Data Center Id, a {@link VirtualMachine.Type} and
 * a list of {@link VirtualMachine.State}
 *
 * @param id
 * @param type
 * @param states
 * @return
 */
protected List<HostPodVO> listByDataCenterIdVMTypeAndStates(final long id, final VirtualMachine.Type type, final VirtualMachine.State... states) {
    final SearchBuilder<VMInstanceVO> vmInstanceSearch = vmDao.createSearchBuilder();
    vmInstanceSearch.and("type", vmInstanceSearch.entity().getType(), SearchCriteria.Op.EQ);
    vmInstanceSearch.and("states", vmInstanceSearch.entity().getState(), SearchCriteria.Op.IN);

    final SearchBuilder<HostPodVO> podIdSearch = podDao.createSearchBuilder();
    podIdSearch.and("dc", podIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    podIdSearch.select(null, SearchCriteria.Func.DISTINCT, podIdSearch.entity().getId());
    podIdSearch.join("vmInstanceSearch", vmInstanceSearch, podIdSearch.entity().getId(), vmInstanceSearch.entity().getPodIdToDeployIn(), JoinBuilder.JoinType.INNER);
    podIdSearch.done();

    final SearchCriteria<HostPodVO> sc = podIdSearch.create();
    sc.setParameters("dc", id);
    sc.setJoinParameters("vmInstanceSearch", "type", type);
    sc.setJoinParameters("vmInstanceSearch", "states", (Object[]) states);
    return podDao.search(sc, null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:27,代码来源:RouterDeploymentDefinition.java

示例3: listByDataCenter

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Override
public List<PodCluster> listByDataCenter(final long dcId) {
    final List<HostPodVO> pods = _podDao.listByDataCenterId(dcId);
    final ArrayList<PodCluster> pcs = new ArrayList<>();
    for (final HostPodVO pod : pods) {
        final List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId());
        if (clusters.size() == 0) {
            pcs.add(new PodCluster(pod, null));
        } else {
            for (final ClusterVO cluster : clusters) {
                pcs.add(new PodCluster(pod, cluster));
            }
        }
    }
    return pcs;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:ResourceManagerImpl.java

示例4: checkCIDR

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
private boolean checkCIDR(final HostPodVO pod, final String serverPrivateIP, final String serverPrivateNetmask) {
    if (serverPrivateIP == null) {
        return true;
    }
    // Get the CIDR address and CIDR size
    final String cidrAddress = pod.getCidrAddress();
    final long cidrSize = pod.getCidrSize();

    // If the server's private IP address is not in the same subnet as the
    // pod's CIDR, return false
    final String cidrSubnet = NetUtils.getCidrSubNet(cidrAddress, cidrSize);
    final String serverSubnet = NetUtils.getSubNet(serverPrivateIP, serverPrivateNetmask);
    if (!cidrSubnet.equals(serverSubnet)) {
        return false;
    }

    // If the server's private netmask is less inclusive than the pod's CIDR
    // netmask, return false
    final String cidrNetmask = NetUtils.getCidrSubNet("255.255.255.255", cidrSize);
    final long cidrNetmaskNumeric = NetUtils.ip2Long(cidrNetmask);
    final long serverNetmaskNumeric = NetUtils.ip2Long(serverPrivateNetmask);
    return serverNetmaskNumeric <= cidrNetmaskNumeric;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:ResourceManagerImpl.java

示例5: checkOverlapPrivateIpRange

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
private void checkOverlapPrivateIpRange(final Long zoneId, final String startIp, final String endIp) {

        final List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
        for (final HostPodVO hostPod : podsInZone) {
            final String[] IpRange = hostPod.getDescription().split("-");
            if (IpRange[0] == null || IpRange[1] == null) {
                continue;
            }
            if (!NetUtils.isValidIp4(IpRange[0]) || !NetUtils.isValidIp4(IpRange[1])) {
                continue;
            }
            if (NetUtils.ipRangesOverlap(startIp, endIp, IpRange[0], IpRange[1])) {
                throw new InvalidParameterValueException("The Start IP and endIP address range overlap with private IP :" + IpRange[0] + ":" + IpRange[1]);
            }
        }
    }
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:ConfigurationManagerImpl.java

示例6: test_checkIfPodIsUsable_whenPodBelongsToDataCenter

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test
public void test_checkIfPodIsUsable_whenPodBelongsToDataCenter() throws Exception {
    final DataCenterVO dataCenter = new DataCenterVO();
    dataCenter.setId(1L);
    dataCenter.setUuid("DataCenterUUID");
    final HostPodVO hostPod = new HostPodVO();
    hostPod.setDataCenterId(1L);
    hostPod.setUuid("HostPodUUID");
    final ResourceChecker resourceChecker = buildResourceChecker();

    try {
        resourceChecker.checkIfPodIsUsable(dataCenter, hostPod);
    } catch (final InvalidParameterValueException e) {
        fail("No InvalidParameterValueException should have been generated");
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:ResourceCheckerTest.java

示例7: checkIfPodIsDeletableFailureOnVolumeTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnVolumeTest() {
    final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
    Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);

    final VolumeVO volumeVO = Mockito.mock(VolumeVO.class);
    final ArrayList<VolumeVO> arrayList = new ArrayList<>();
    arrayList.add(volumeVO);
    Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(arrayList);
    Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());

    configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ConfigurationManagerTest.java

示例8: checkIfPodIsDeletableFailureOnHostTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnHostTest() {
    final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
    Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);

    final HostVO hostVO = Mockito.mock(HostVO.class);
    final ArrayList<HostVO> arrayList = new ArrayList<>();
    arrayList.add(hostVO);
    Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(arrayList);
    Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());

    configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ConfigurationManagerTest.java

示例9: checkIfPodIsDeletableFailureOnVmInstanceTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnVmInstanceTest() {
    final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
    Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);

    final VMInstanceVO vMInstanceVO = Mockito.mock(VMInstanceVO.class);
    final ArrayList<VMInstanceVO> arrayList = new ArrayList<>();
    arrayList.add(vMInstanceVO);
    Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(arrayList);
    Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());

    configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ConfigurationManagerTest.java

示例10: checkIfPodIsDeletableFailureOnClusterTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnClusterTest() {
    final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
    Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);

    final ClusterVO clusterVO = Mockito.mock(ClusterVO.class);
    final ArrayList<ClusterVO> arrayList = new ArrayList<>();
    arrayList.add(clusterVO);
    Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(arrayList);

    configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ConfigurationManagerTest.java

示例11: checkIfZoneIsDeletableFailureOnPodTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void checkIfZoneIsDeletableFailureOnPodTest() {
    final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    final ArrayList<HostPodVO> arrayList = new ArrayList<>();
    arrayList.add(hostPodVO);

    Mockito.when(_hostDao.listByDataCenterId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_podDao.listByDataCenterId(anyLong())).thenReturn(arrayList);
    Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_publicIpAddressDao.countIPs(anyLong(), anyBoolean())).thenReturn(0);
    Mockito.when(_vmInstanceDao.listByZoneId(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_volumeDao.findByDc(anyLong())).thenReturn(new ArrayList<>());
    Mockito.when(_physicalNetworkDao.listByZone(anyLong())).thenReturn(new ArrayList<>());

    configurationMgr.checkIfZoneIsDeletable(new Random().nextLong());
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:ConfigurationManagerTest.java

示例12: createHostVOForDirectConnectAgent

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Override
public HostVO createHostVOForDirectConnectAgent(final HostVO host, final StartupCommand[] startup, final ServerResource resource, final Map<String, String> details, final
List<String> hostTags) {
    final StartupCommand firstCmd = startup[0];
    if (!(firstCmd instanceof StartupRoutingCommand)) {
        return null;
    }

    final StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
    if (ssCmd.getHypervisorType() != HypervisorType.XenServer) {
        return null;
    }

    final HostPodVO pod = _podDao.findById(host.getPodId());
    final Zone zone = zoneRepository.findOne(host.getDataCenterId());

    s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.XenServer + ". Checking CIDR...");
    _resourceMgr.checkCIDR(pod, zone, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask());
    return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.XenServer, details, hostTags);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:21,代码来源:XcpServerDiscoverer.java

示例13: createDedicatePodResponse

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Override
public DedicatePodResponse createDedicatePodResponse(final DedicatedResources resource) {
    final DedicatePodResponse dedicatePodResponse = new DedicatePodResponse();
    final HostPodVO pod = _podDao.findById(resource.getPodId());
    final DomainVO domain = _domainDao.findById(resource.getDomainId());
    final AccountVO account = _accountDao.findById(resource.getAccountId());
    final AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
    dedicatePodResponse.setId(resource.getUuid());
    dedicatePodResponse.setPodId(pod.getUuid());
    dedicatePodResponse.setPodName(pod.getName());
    dedicatePodResponse.setDomainId(domain.getUuid());
    dedicatePodResponse.setDomainName(domain.getName());
    dedicatePodResponse.setAffinityGroupId(group.getUuid());
    if (account != null) {
        dedicatePodResponse.setAccountId(account.getUuid());
        dedicatePodResponse.setAccountName(account.getAccountName());
    }
    dedicatePodResponse.setObjectName("dedicatedpod");
    return dedicatePodResponse;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:21,代码来源:DedicatedResourceManagerImpl.java

示例14: executeSearchForAnotherRandomHostToStartSystemVmTest

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
private void executeSearchForAnotherRandomHostToStartSystemVmTest(Long hostId, int hostIdNullTimes, int hostIdNotNullTimes) {
    VMInstanceVO vmInstance = Mockito.mock(VMInstanceVO.class);
    HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
    HostVO host = Mockito.mock(HostVO.class);

    Mockito.when(vmInstance.getHostId()).thenReturn(hostId);
    Mockito.when(vmInstance.getPodIdToDeployIn()).thenReturn(0l);
    Mockito.doReturn(hostPodVO).when(podService).findPodById(Mockito.anyLong());
    Mockito.doReturn(host).when(spy).searchForRandomHostInPodToDeployAutonomiccsSystemVm(Mockito.any(HostPodVO.class));
    Mockito.doReturn(host).when(hostService).findHostById(Mockito.anyLong());
    Mockito.doReturn(host).when(spy).searchForAnotherRandomHostInTheClusterToStartSystemVmExcludingHost(Mockito.any(HostVO.class));

    HostVO result = spy.searchForAnotherRandomHostToStartSystemVm(vmInstance);

    Mockito.verify(vmInstance).getHostId();
    Mockito.verify(vmInstance, Mockito.times(hostIdNullTimes)).getPodIdToDeployIn();
    Mockito.verify(podService, Mockito.times(hostIdNullTimes)).findPodById(Mockito.anyLong());
    Mockito.verify(spy, Mockito.times(hostIdNullTimes)).searchForRandomHostInPodToDeployAutonomiccsSystemVm(Mockito.any(HostPodVO.class));
    Mockito.verify(hostService, Mockito.times(hostIdNotNullTimes)).findHostById(Mockito.anyLong());
    Mockito.verify(spy, Mockito.times(hostIdNotNullTimes)).searchForAnotherRandomHostInTheClusterToStartSystemVmExcludingHost(Mockito.any(HostVO.class));
    Assert.assertEquals(host, result);
}
 
开发者ID:Autonomiccs,项目名称:autonomiccs-platform,代码行数:23,代码来源:AutonomiccsSystemVmDeploymentServiceTest.java

示例15: listClustersWithDisabledPods

import com.cloud.dc.HostPodVO; //导入依赖的package包/类
@Override
public List<Long> listClustersWithDisabledPods(long zoneId) {

    GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = hostPodDao.createSearchBuilder(Long.class);
    disabledPodIdSearch.selectFields(disabledPodIdSearch.entity().getId());
    disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
    disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);

    GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
    clusterIdSearch.selectFields(clusterIdSearch.entity().getId());
    clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(),
        JoinBuilder.JoinType.INNER);
    clusterIdSearch.done();

    SearchCriteria<Long> sc = clusterIdSearch.create();
    sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId);
    sc.setJoinParameters("disabledPodIdSearch", "allocationState", Grouping.AllocationState.Disabled);

    return customSearch(sc, null);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:21,代码来源:ClusterDaoImpl.java


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