Search in sources :

Example 1 with GlusterVolumeSizeInfo

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());
}
Also used : GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Test(org.junit.Test)

Example 2 with GlusterVolumeSizeInfo

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;
}
Also used : GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)

Example 3 with GlusterVolumeSizeInfo

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;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 4 with GlusterVolumeSizeInfo

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));
}
Also used : GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterGeoRepNonEligibilityReason(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 5 with GlusterVolumeSizeInfo

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));
}
Also used : GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterGeoRepNonEligibilityReason(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Aggregations

GlusterVolumeSizeInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)8 Test (org.junit.Test)5 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)5 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)3 GlusterGeoRepNonEligibilityReason (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason)3 Guid (org.ovirt.engine.core.compat.Guid)3 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)2 ArrayList (java.util.ArrayList)1 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)1 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1