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