本文整理汇总了Java中com.cloud.dc.ClusterDetailsVO类的典型用法代码示例。如果您正苦于以下问题:Java ClusterDetailsVO类的具体用法?Java ClusterDetailsVO怎么用?Java ClusterDetailsVO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClusterDetailsVO类属于com.cloud.dc包,在下文中一共展示了ClusterDetailsVO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClusterOverProvisioningFactor
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Override
public float getClusterOverProvisioningFactor(final Long clusterId, final short capacityType) {
final String capacityOverProvisioningName;
if (capacityType == Capacity.CAPACITY_TYPE_CPU) {
capacityOverProvisioningName = "cpuOvercommitRatio";
} else if (capacityType == Capacity.CAPACITY_TYPE_MEMORY) {
capacityOverProvisioningName = "memoryOvercommitRatio";
} else {
throw new CloudRuntimeException("Invalid capacityType - " + capacityType);
}
final ClusterDetailsVO clusterDetailCpu = _clusterDetailsDao.findDetail(clusterId, capacityOverProvisioningName);
final Float clusterOverProvisioningRatio = Float.parseFloat(clusterDetailCpu.getValue());
return clusterOverProvisioningRatio;
}
示例2: checkPlanWithNoHostInDC
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Test(expected = InsufficientServerCapacityException.class)
public void checkPlanWithNoHostInDC() throws InsufficientServerCapacityException {
ContainerClusterVO containerCluster = new ContainerClusterVO();
containerCluster.setServiceOfferingId(1L);
containerCluster.setNodeCount(5);
when(containerClusterDao.findById(1L)).thenReturn(containerCluster);
ServiceOfferingVO offering = new ServiceOfferingVO("test", 1, 500, 512, 0, 0, true, "test", null, false, true, "", true, VirtualMachine.Type.User, true);
when(srvOfferingDao.findById(1L)).thenReturn(offering);
List<HostVO> hl = new ArrayList<HostVO>();
when(resourceMgr.listAllHostsInAllZonesByType(Type.Routing)).thenReturn(hl);
ClusterVO cluster = new ClusterVO(1L);
when(clusterDao.findById(1L)).thenReturn(cluster);
ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(1L, "cpuOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio")).thenReturn(cluster_detail_cpu);
ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(1L, "memoryOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio")).thenReturn(cluster_detail_ram);
when(capacityMgr.checkIfHostHasCapacity(anyLong(), anyInt(), anyInt(), anyBoolean(), anyFloat(), anyFloat(), anyBoolean())).thenReturn(true);
ccManager.plan(1, 1);
}
示例3: getSupportsResigning
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Override
public boolean getSupportsResigning(long clusterId) {
ClusterVO cluster = findById(clusterId);
if (cluster == null || cluster.getAllocationState() != Grouping.AllocationState.Enabled) {
return false;
}
ClusterDetailsVO clusterDetailsVO = clusterDetailsDao.findDetail(clusterId, "supportsResign");
if (clusterDetailsVO != null) {
String value = clusterDetailsVO.getValue();
return Boolean.parseBoolean(value);
}
return false;
}
示例4: getClusterOverProvisioningFactor
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Override
public float getClusterOverProvisioningFactor(Long clusterId, short capacityType) {
String capacityOverProvisioningName = "";
if (capacityType == Capacity.CAPACITY_TYPE_CPU) {
capacityOverProvisioningName = "cpuOvercommitRatio";
} else if (capacityType == Capacity.CAPACITY_TYPE_MEMORY) {
capacityOverProvisioningName = "memoryOvercommitRatio";
} else {
throw new CloudRuntimeException("Invalid capacityType - " + capacityType);
}
ClusterDetailsVO clusterDetailCpu = _clusterDetailsDao.findDetail(clusterId, capacityOverProvisioningName);
Float clusterOverProvisioningRatio = Float.parseFloat(clusterDetailCpu.getValue());
return clusterOverProvisioningRatio;
}
示例5: getOrCreateCluster
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
private Long getOrCreateCluster(final DataCenterVO zone, final HostPodVO pod, Long clusterId, final String clusterName, final String hypervisorType) {
final Long dcId = zone.getId();
final Long podId = pod.getId();
if (clusterName != null) {
ClusterVO cluster = new ClusterVO(dcId, podId, clusterName);
cluster.setHypervisorType(hypervisorType);
try {
cluster = _clusterDao.persist(cluster);
} catch (final Exception e) {
cluster = _clusterDao.findBy(clusterName, podId);
if (cluster == null) {
final CloudRuntimeException ex =
new CloudRuntimeException("Unable to create cluster " + clusterName + " in pod with specified podId and data center with specified dcID", e);
ex.addProxyObject(pod.getUuid(), "podId");
ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
}
clusterId = cluster.getId();
if (_clusterDetailsDao.findDetail(clusterId, "cpuOvercommitRatio") == null) {
final ClusterDetailsVO cluster_cpu_detail = new ClusterDetailsVO(clusterId, "cpuOvercommitRatio", "1");
final ClusterDetailsVO cluster_memory_detail = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", "1");
_clusterDetailsDao.persist(cluster_cpu_detail);
_clusterDetailsDao.persist(cluster_memory_detail);
}
}
return clusterId;
}
示例6: findClusterDetails
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
public static String findClusterDetails(final long clusterId, final String name) {
final ClusterDetailsVO detailsVO = s_clusterDetailsDao.findDetail(clusterId, name);
if (detailsVO != null) {
return detailsVO.getValue();
}
return null;
}
示例7: checkPlanWithHostInDC
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Test
public void checkPlanWithHostInDC() throws InsufficientServerCapacityException {
ContainerClusterVO containerCluster = new ContainerClusterVO();
containerCluster.setServiceOfferingId(1L);
containerCluster.setNodeCount(0);
when(containerClusterDao.findById(1L)).thenReturn(containerCluster);
ServiceOfferingVO offering = new ServiceOfferingVO("test", 1, 500, 512, 0, 0, true, "test", null, false, true, "", true, null, true);
when(srvOfferingDao.findById(1L)).thenReturn(offering);
List<HostVO> hl = new ArrayList<HostVO>();
HostVO h1 = new HostVO(1L, "testHost1", Type.Routing, "", "", "", "", "", "", "", "", "", "", "", "", "", Status.Up, "1.0", "", new Date(), 1L, 1L, 1L, 1L, "", 1L,
StoragePoolType.Filesystem);
h1.setClusterId(1L);
h1.setUuid("uuid-test");
hl.add(h1);
when(resourceMgr.listAllHostsInOneZoneByType(Type.Routing, 1)).thenReturn(hl);
ClusterVO cluster = new ClusterVO(1L);
when(clusterDao.findById(1L)).thenReturn(cluster);
ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(1L, "cpuOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio")).thenReturn(cluster_detail_cpu);
ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(1L, "memoryOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio")).thenReturn(cluster_detail_ram);
when(capacityMgr.checkIfHostHasCapacity(anyLong(), anyInt(), anyInt(), anyBoolean(), anyFloat(), anyFloat(), anyBoolean())).thenReturn(true);
when(dcDao.findById(1L)).thenReturn(new DataCenterVO(1L, "test-dc", "test-desc", "", "", "", "", "", "", 1L, NetworkType.Advanced, "", ""));
DeployDestination dd = ccManager.plan(1, 1);
Assert.assertEquals(dd.getDataCenter().getId(), 1L);
}
示例8: checkPlanWithHostInDCNoCapacity
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Test(expected = InsufficientServerCapacityException.class)
public void checkPlanWithHostInDCNoCapacity() throws InsufficientServerCapacityException {
ContainerClusterVO containerCluster = new ContainerClusterVO();
containerCluster.setServiceOfferingId(1L);
containerCluster.setNodeCount(0);
when(containerClusterDao.findById(1L)).thenReturn(containerCluster);
ServiceOfferingVO offering = new ServiceOfferingVO("test", 1, 500, 512, 0, 0, true, "test", null, false, true, "", true, VirtualMachine.Type.User, true);
when(srvOfferingDao.findById(1L)).thenReturn(offering);
List<HostVO> hl = new ArrayList<HostVO>();
HostVO h1 = new HostVO(1L, "testHost1", Type.Routing, "", "", "", "", "", "", "", "", "", "", "", "", "", Status.Up, "1.0", "", new Date(), 1L, 1L, 1L, 1L, "", 1L,
StoragePoolType.Filesystem);
h1.setClusterId(1L);
h1.setUuid("uuid-test");
hl.add(h1);
when(resourceMgr.listAllHostsInAllZonesByType(Type.Routing)).thenReturn(hl);
ClusterVO cluster = new ClusterVO(1L);
when(clusterDao.findById(1L)).thenReturn(cluster);
ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(1L, "cpuOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio")).thenReturn(cluster_detail_cpu);
ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(1L, "memoryOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio")).thenReturn(cluster_detail_ram);
when(capacityMgr.checkIfHostHasCapacity(anyLong(), anyInt(), anyInt(), anyBoolean(), anyFloat(), anyFloat(), anyBoolean())).thenReturn(false);
when(dcDao.findById(1L)).thenReturn(new DataCenterVO(1L, "test-dc", "test-desc", "", "", "", "", "", "", 1L, NetworkType.Advanced, "", ""));
DeployDestination dd = ccManager.plan(1, 1);
}
示例9: isHAEnabledForCluster
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
private boolean isHAEnabledForCluster(final HAResource resource) {
if (resource == null || resource.getClusterId() == null) {
return true;
}
final ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(resource.getClusterId(), HA_ENABLED_DETAIL);
return clusterDetails == null || Strings.isNullOrEmpty(clusterDetails.getValue()) || Boolean.valueOf(clusterDetails.getValue());
}
示例10: isOutOfBandManagementEnabledForCluster
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
private boolean isOutOfBandManagementEnabledForCluster(Long clusterId) {
if (clusterId == null) {
return true;
}
final ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(clusterId, OOBM_ENABLED_DETAIL);
if (clusterDetails != null && !Strings.isNullOrEmpty(clusterDetails.getValue()) && !Boolean.valueOf(clusterDetails.getValue())) {
return false;
}
return true;
}
示例11: findClusterDetails
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
public static String findClusterDetails(long clusterId, String name) {
ClusterDetailsVO detailsVO = s_clusterDetailsDao.findDetail(clusterId, name);
if (detailsVO != null) {
return detailsVO.getValue();
}
return null;
}
示例12: getSolidFireVolumeAccessGroupId
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Override
public long getSolidFireVolumeAccessGroupId(String csClusterUuid, String storagePoolUuid) {
long csClusterId = util.getClusterIdForClusterUuid(csClusterUuid);
long storagePoolId = util.getStoragePoolIdForStoragePoolUuid(storagePoolUuid);
ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(csClusterId, SolidFireUtil.getVagKey(storagePoolId));
String sfVagId = clusterDetails.getValue();
return Long.parseLong(sfVagId);
}
示例13: placeVolumeInVolumeAccessGroup
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
public static long placeVolumeInVolumeAccessGroup(SolidFireConnection sfConnection, long sfVolumeId, long storagePoolId,
String vagUuid, List<HostVO> hosts, ClusterDetailsDao clusterDetailsDao) {
if (hosts == null || hosts.isEmpty()) {
throw new CloudRuntimeException("There must be at least one host in the cluster.");
}
long lVagId;
try {
lVagId = SolidFireUtil.createVag(sfConnection, "CloudStack-" + vagUuid,
SolidFireUtil.getIqnsFromHosts(hosts), new long[] { sfVolumeId });
}
catch (Exception ex) {
String iqnInVagAlready1 = "Exceeded maximum number of Volume Access Groups per initiator";
String iqnInVagAlready2 = "Exceeded maximum number of VolumeAccessGroups per Initiator";
if (!ex.getMessage().contains(iqnInVagAlready1) && !ex.getMessage().contains(iqnInVagAlready2)) {
throw new CloudRuntimeException(ex.getMessage());
}
// getCompatibleVag throws an exception if an existing VAG can't be located
SolidFireUtil.SolidFireVag sfVag = getCompatibleVag(sfConnection, hosts);
lVagId = sfVag.getId();
long[] volumeIds = getNewVolumeIds(sfVag.getVolumeIds(), sfVolumeId, true);
SolidFireUtil.modifyVag(sfConnection, lVagId, sfVag.getInitiators(), volumeIds);
}
ClusterDetailsVO clusterDetail = new ClusterDetailsVO(hosts.get(0).getClusterId(), getVagKey(storagePoolId), String.valueOf(lVagId));
clusterDetailsDao.persist(clusterDetail);
return lVagId;
}
示例14: testSetUp
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
@Before
public void testSetUp() {
Mockito.when(_configDao.isPremium()).thenReturn(true);
ComponentContext.initComponentsLifeCycle();
MockitoAnnotations.initMocks(this);
DataCenterVO zone =
new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", null, null, NetworkType.Basic, null, null, true,
true, null, null);
zoneId = 1L;
HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), zoneId, "192.168.56.1", "192.168.56.0/24", 8, "test");
podId = 1L;
AccountVO acct = new AccountVO(200L);
acct.setType(Account.ACCOUNT_TYPE_ADMIN);
acct.setAccountName("admin");
acct.setDomainId(domainId);
UserVO user1 = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user1, acct);
when(_accountDao.findByIdIncludingRemoved(0L)).thenReturn(acct);
dc = new VmwareDatacenterVO(guid, vmwareDcName, vCenterHost, user, password);
vmwareDcs = new ArrayList<VmwareDatacenterVO>();
vmwareDcs.add(dc);
vmwareDcId = dc.getId();
cluster = new ClusterVO(zone.getId(), pod.getId(), "vmwarecluster");
cluster.setHypervisorType(HypervisorType.VMware.toString());
cluster.setClusterType(ClusterType.ExternalManaged);
cluster.setManagedState(ManagedState.Managed);
clusterId = 1L;
clusterList = new ArrayList<ClusterVO>();
clusterList.add(cluster);
clusterDetails = new ClusterDetailsVO(clusterId, "url", url);
dcZoneMap = new VmwareDatacenterZoneMapVO(zoneId, vmwareDcId);
Mockito.when(_dcDao.persist(Matchers.any(DataCenterVO.class))).thenReturn(zone);
Mockito.when(_dcDao.findById(1L)).thenReturn(zone);
Mockito.when(_podDao.persist(Matchers.any(HostPodVO.class))).thenReturn(pod);
Mockito.when(_podDao.findById(1L)).thenReturn(pod);
Mockito.when(_clusterDao.persist(Matchers.any(ClusterVO.class))).thenReturn(cluster);
Mockito.when(_clusterDao.findById(1L)).thenReturn(cluster);
Mockito.when(_clusterDao.listByZoneId(1L)).thenReturn(null);
Mockito.when(_clusterDao.expunge(1L)).thenReturn(true);
Mockito.when(_clusterDetailsDao.persist(Matchers.any(ClusterDetailsVO.class))).thenReturn(clusterDetails);
Mockito.when(_clusterDetailsDao.expunge(1L)).thenReturn(true);
Mockito.when(_vmwareDcDao.persist(Matchers.any(VmwareDatacenterVO.class))).thenReturn(dc);
Mockito.when(_vmwareDcDao.findById(1L)).thenReturn(null);
Mockito.when(_vmwareDcDao.expunge(1L)).thenReturn(true);
Mockito.when(_vmwareDcDao.getVmwareDatacenterByNameAndVcenter(vmwareDcName, vCenterHost)).thenReturn(null);
Mockito.when(_vmwareDcZoneMapDao.persist(Matchers.any(VmwareDatacenterZoneMapVO.class))).thenReturn(dcZoneMap);
Mockito.when(_vmwareDcZoneMapDao.findByZoneId(1L)).thenReturn(null);
Mockito.when(_vmwareDcZoneMapDao.expunge(1L)).thenReturn(true);
Mockito.when(addCmd.getZoneId()).thenReturn(1L);
Mockito.when(addCmd.getVcenter()).thenReturn(vCenterHost);
Mockito.when(addCmd.getUsername()).thenReturn(user);
Mockito.when(addCmd.getPassword()).thenReturn(password);
Mockito.when(addCmd.getName()).thenReturn(vmwareDcName);
Mockito.when(removeCmd.getZoneId()).thenReturn(1L);
}
示例15: removeVolumeFromVag
import com.cloud.dc.ClusterDetailsVO; //导入依赖的package包/类
private void removeVolumeFromVag(long storagePoolId, long clusterId) {
long sfVolumeId = getVolumeId(storagePoolId);
ClusterDetailsVO clusterDetail = _clusterDetailsDao.findDetail(clusterId, SolidFireUtil.getVagKey(storagePoolId));
String vagId = clusterDetail != null ? clusterDetail.getValue() : null;
if (vagId != null) {
SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, _storagePoolDetailsDao);
SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getVag(sfConnection, Long.parseLong(vagId));
long[] volumeIds = SolidFireUtil.getNewVolumeIds(sfVag.getVolumeIds(), sfVolumeId, false);
SolidFireUtil.modifyVag(sfConnection, sfVag.getId(), sfVag.getInitiators(), volumeIds);
}
}