Search in sources :

Example 76 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class StopRebalanceGlusterVolumeCommandTest method getVolumeWithRebalanceTask.

private GlusterVolumeEntity getVolumeWithRebalanceTask(Guid volumeId) {
    GlusterVolumeEntity volume = getVolume(volumeId);
    GlusterAsyncTask asyncTask = new GlusterAsyncTask();
    asyncTask.setStatus(JobExecutionStatus.STARTED);
    asyncTask.setType(GlusterTaskType.REBALANCE);
    volume.setAsyncTask(asyncTask);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)

Example 77 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class StopRemoveGlusterVolumeBricksCommandTest method getVolumeWithRemoveBricksTaskCompleted.

private Object getVolumeWithRemoveBricksTaskCompleted(Guid volumeId) {
    GlusterVolumeEntity volume = getVolumeWithRemoveBricksTask(volumeId);
    volume.getAsyncTask().setStatus(JobExecutionStatus.FINISHED);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 78 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class GlusterDBUtils method isVolumeSnapshotHardLimitReached.

public boolean isVolumeSnapshotHardLimitReached(Guid volumeId) {
    GlusterVolumeEntity volume = glusterVolumeDao.getById(volumeId);
    if (volume != null) {
        GlusterVolumeSnapshotConfig config = glusterVolumeSnapshotConfigDao.getConfigByVolumeIdAndName(volume.getClusterId(), volumeId, "snap-max-hard-limit");
        if (config != null) {
            int snapMaxHardLimit = Integer.parseInt(config.getParamValue());
            int snapshotCount = volume.getSnapshotsCount();
            return snapshotCount >= snapMaxHardLimit;
        }
    }
    return false;
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 79 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class GlusterVolumeDaoTest method testRemoveAccessProtocol.

@Test
public void testRemoveAccessProtocol() {
    Set<AccessProtocol> protocols = existingReplVol.getAccessProtocols();
    assertEquals(2, protocols.size());
    assertTrue(protocols.contains(AccessProtocol.NFS));
    dao.removeAccessProtocol(EXISTING_VOL_REPL_ID, AccessProtocol.NFS);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_REPL_ID);
    assertNotNull(volumeAfter);
    protocols = volumeAfter.getAccessProtocols();
    assertEquals(1, protocols.size());
    assertFalse(protocols.contains(AccessProtocol.NFS));
    assertFalse(volumeAfter.equals(existingReplVol));
    existingReplVol.removeAccessProtocol(AccessProtocol.NFS);
    assertEquals(volumeAfter, existingReplVol);
}
Also used : AccessProtocol(org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Test(org.junit.Test)

Example 80 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity 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)

Aggregations

GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)220 ArrayList (java.util.ArrayList)57 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)49 Test (org.junit.Test)47 Guid (org.ovirt.engine.core.compat.Guid)30 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)30 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)26 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)20 VDS (org.ovirt.engine.core.common.businessentities.VDS)19 HashMap (java.util.HashMap)16 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)16 List (java.util.List)15 Map (java.util.Map)15 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)15 ActionType (org.ovirt.engine.core.common.action.ActionType)13 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)13 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)13 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)13 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)12 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)12