Search in sources :

Example 31 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method getDistributedReplicatedVolume.

private GlusterVolumeEntity getDistributedReplicatedVolume(Guid volumeId, int brickCount, int replicaCount) {
    GlusterVolumeEntity volumeEntity = new GlusterVolumeEntity();
    volumeEntity.setId(volumeId);
    volumeEntity.setName("test-vol");
    volumeEntity.addAccessProtocol(AccessProtocol.GLUSTER);
    volumeEntity.addTransportType(TransportType.TCP);
    volumeEntity.setVolumeType(GlusterVolumeType.DISTRIBUTED_REPLICATE);
    volumeEntity.setBricks(getBricks(volumeId, brickCount));
    volumeEntity.setReplicaCount(replicaCount);
    return volumeEntity;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 32 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRemoveBrickIfSomeBricksAreDown.

@Test
public void canRemoveBrickIfSomeBricksAreDown() {
    GlusterVolumeEntity volumeEntity = getDistributedVolume(volumeId1, 4);
    List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
    bricksToRemove.add(volumeEntity.getBricks().get(1));
    volumeEntity.getBricks().get(0).setStatus(GlusterStatus.DOWN);
    ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 1, false);
    assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 33 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRebalanceOnDistributeReplicateVolumeWithTwoReplicaPairDown.

@Test
public void canRebalanceOnDistributeReplicateVolumeWithTwoReplicaPairDown() {
    GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
    volumeEntity.getBricks().get(0).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(2).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(3).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(4).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(5).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(6).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(7).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(8).setStatus(GlusterStatus.DOWN);
    ValidationResult validationResult = brickValidator.canRebalance(volumeEntity);
    assertThat(validationResult, not(isValid()));
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 34 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRemoveWithOutforceAndReduceReplicaCount.

@Test
public void canRemoveWithOutforceAndReduceReplicaCount() {
    GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
    List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
    bricksToRemove.add(volumeEntity.getBricks().get(0));
    bricksToRemove.add(volumeEntity.getBricks().get(4));
    bricksToRemove.add(volumeEntity.getBricks().get(8));
    ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 3, false);
    assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_WITH_DATA_MIGRATION));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 35 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRemoveLastBrick.

@Test
public void canRemoveLastBrick() {
    GlusterVolumeEntity volumeEntity = getDistributedVolume(volumeId1, 1);
    ValidationResult validationResult = brickValidator.canRemoveBrick(volumeEntity.getBricks(), volumeEntity, 1, false);
    assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REMOVE_ALL_BRICKS_FROM_VOLUME));
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) 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