use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testUpdateVolumeCapacityInfo.
@Test
public void testUpdateVolumeCapacityInfo() {
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(existingDistVol.getId());
capacityInfo.setTotalSize(Long.valueOf("500000"));
capacityInfo.setFreeSize(Long.valueOf("300000"));
capacityInfo.setUsedSize(Long.valueOf("200000"));
dao.updateVolumeCapacityInfo(capacityInfo);
GlusterVolumeEntity volume = dao.getById(existingDistVol.getId());
assertNotNull(volume);
assertFalse(volume.equals(existingDistVol));
assertNotNull("volume capacity info is not available", volume.getAdvancedDetails().getCapacityInfo());
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getTotalSize() == 500000);
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getUsedSize() == 200000);
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getFreeSize() == 300000);
assertNotNull(volume.getAdvancedDetails().getUpdatedAt());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getCapacityInfo.
private GlusterVolumeSizeInfo getCapacityInfo(Guid volId) {
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(volId);
capacityInfo.setTotalSize(90000L);
capacityInfo.setUsedSize(90000L);
capacityInfo.setFreeSize(10000L);
return capacityInfo;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getVolumeAdvancedDetails.
private GlusterVolumeAdvancedDetails getVolumeAdvancedDetails(GlusterVolumeEntity volume) {
GlusterVolumeAdvancedDetails volDetails = new GlusterVolumeAdvancedDetails();
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(volume.getId());
capacityInfo.setTotalSize(600000L);
capacityInfo.setFreeSize(200000L);
capacityInfo.setUsedSize(400000L);
volDetails.setCapacityInfo(capacityInfo);
List<BrickDetails> brickDetailsList = new ArrayList<>();
for (GlusterBrickEntity brick : volume.getBricks()) {
BrickDetails brickDetails = new BrickDetails();
BrickProperties properties = new BrickProperties();
properties.setBrickId(brick.getId());
brickDetails.setBrickProperties(properties);
properties.setStatus(brick.getStatus());
if (volume == existingReplVol) {
if (brick.getServerId().equals(SERVER_ID_1) && (brick.getBrickDirectory().equals(REPL_BRICK_R1D1) || brick.getBrickDirectory().equals(REPL_BRICK_R2D1))) {
properties.setStatus(GlusterStatus.DOWN);
bricksWithChangedStatus.add(brick);
}
}
brickDetailsList.add(brickDetails);
}
volDetails.setBrickDetails(brickDetailsList);
return volDetails;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GetNonEligibilityReasonsOfVolumeForGeoRepSessionQueryTest method testExecuteQueryCommnadOnVolume3.
@Test
public void testExecuteQueryCommnadOnVolume3() {
GlusterVolumeEntity slaveVolume = baseTest.getGlusterVolume(baseTest.getSLAVE_VOLUME_3_ID(), baseTest.getMASTER_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> actual = getQuery().getNonEligibilityReasons(baseTest.getGlusterVolume(baseTest.getMASTER_VOLUME_ID(), baseTest.getMASTER_CLUSTER_ID(), GlusterStatus.UP, new GlusterVolumeSizeInfo(10000L, 4000L, 6000L)), slaveVolume);
assertEquals(actual.size(), getNonEligibilityReasonsForSlaveVolume3().size());
assertTrue(getNonEligibilityReasonsForSlaveVolume3().containsAll(actual));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo in project ovirt-engine by oVirt.
the class GetNonEligibilityReasonsOfVolumeForGeoRepSessionQueryTest method testExecuteQueryCommnadOnVolume2.
@Test
public void testExecuteQueryCommnadOnVolume2() {
GlusterVolumeEntity slaveVolume = baseTest.getGlusterVolume(baseTest.getSLAVE_VOLUME_2_ID(), baseTest.getSLAVE_CLUSTER_ID(), GlusterStatus.DOWN, new GlusterVolumeSizeInfo(4000L, 0L, 0L));
Guid slaveUpServerID = Guid.newGuid();
doReturn(slaveUpServerID).when(geoRepUtil).getUpServerId(any());
doReturn(false).when(geoRepUtil).checkEmptyGlusterVolume(slaveUpServerID, slaveVolume.getName());
List<GlusterGeoRepNonEligibilityReason> actual = getQuery().getNonEligibilityReasons(baseTest.getGlusterVolume(baseTest.getMASTER_VOLUME_ID(), baseTest.getMASTER_CLUSTER_ID(), GlusterStatus.UP, new GlusterVolumeSizeInfo(10000L, 4000L, 6000L)), slaveVolume);
assertEquals(actual.size(), getNonEligibilityReasonsForSlaveVolume2().size());
assertTrue(getNonEligibilityReasonsForSlaveVolume2().containsAll(actual));
}
Aggregations