use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GetNonEligibilityReasonsOfVolumeForGeoRepSessionQueryTest method testExecuteQueryCommnadOnVolume1.
@Test
public void testExecuteQueryCommnadOnVolume1() {
GlusterVolumeEntity slaveVolume = baseTest.getGlusterVolume(baseTest.getSLAVE_VOLUME_1_ID(), baseTest.getSLAVE_CLUSTER_ID(), GlusterStatus.UP, new GlusterVolumeSizeInfo(10000L, 4000L, 6000L));
Guid slaveUpServerId = Guid.newGuid();
doReturn(slaveUpServerId).when(geoRepUtil).getUpServerId(any());
doReturn(true).when(geoRepUtil).checkEmptyGlusterVolume(slaveUpServerId, slaveVolume.getName());
List<GlusterGeoRepNonEligibilityReason> actualNonEligibilityReasons = getQuery().getNonEligibilityReasons(baseTest.getGlusterVolume(baseTest.getMASTER_VOLUME_ID(), baseTest.getMASTER_CLUSTER_ID(), GlusterStatus.UP, new GlusterVolumeSizeInfo(10000L, 4000L, 6000L)), slaveVolume);
assertTrue(actualNonEligibilityReasons.isEmpty());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testAddVolumeCapacityInfo.
@Test
public void testAddVolumeCapacityInfo() {
GlusterVolumeEntity volumeBefore = dao.getById(EXISTING_VOL_REPL_ID);
assertNotNull(volumeBefore);
assertNull(volumeBefore.getAdvancedDetails().getCapacityInfo());
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(EXISTING_VOL_REPL_ID);
capacityInfo.setTotalSize(Long.valueOf("250000"));
capacityInfo.setUsedSize(Long.valueOf("175000"));
capacityInfo.setFreeSize(Long.valueOf("75000"));
dao.addVolumeCapacityInfo(capacityInfo);
GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_REPL_ID);
assertNotNull(volumeAfter);
assertNotNull(volumeAfter.getAdvancedDetails().getCapacityInfo());
assertTrue(volumeAfter.getAdvancedDetails().getCapacityInfo().getTotalSize() == 250000);
assertTrue(volumeAfter.getAdvancedDetails().getCapacityInfo().getUsedSize() == 175000);
assertTrue(volumeAfter.getAdvancedDetails().getCapacityInfo().getFreeSize() == 75000);
assertNotNull(volumeAfter.getAdvancedDetails().getUpdatedAt());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class VolumeCapacityCell method render.
@Override
public void render(Context context, GlusterVolumeEntity object, SafeHtmlBuilder sb, String id) {
GlusterVolumeAdvancedDetails advancedDetails = object.getAdvancedDetails();
GlusterVolumeSizeInfo sizeInfo = null;
if (advancedDetails != null) {
sizeInfo = advancedDetails.getCapacityInfo();
if (sizeInfo != null) {
setFreeSize(sizeInfo.getFreeSize().doubleValue());
setTotalSize(sizeInfo.getTotalSize().doubleValue());
setUsedSize(sizeInfo.getUsedSize().doubleValue());
setInUnit(SizeUnit.BYTES);
}
}
super.render(context, advancedDetails == null ? null : sizeInfo == null ? null : sizeInfo, sb, id);
}
Aggregations