Search in sources :

Example 6 with GlusterVolumeSizeInfo

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());
}
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 7 with GlusterVolumeSizeInfo

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());
}
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 8 with GlusterVolumeSizeInfo

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

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