Search in sources :

Example 16 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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 17 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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 18 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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 19 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class GlusterBrickValidatorTest method canRemoveBrickEmptyList.

@Test
public void canRemoveBrickEmptyList() {
    ValidationResult validationResult = brickValidator.canRemoveBrick(Collections.emptyList(), getDistributedVolume(volumeId1, 1), 3, false);
    assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED));
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 20 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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

ValidationResult (org.ovirt.engine.core.bll.ValidationResult)239 Test (org.junit.Test)132 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)49 Guid (org.ovirt.engine.core.compat.Guid)40 ArrayList (java.util.ArrayList)31 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)31 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)30 Network (org.ovirt.engine.core.common.businessentities.network.Network)21 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)19 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)16 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)15 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)12 List (java.util.List)11 VM (org.ovirt.engine.core.common.businessentities.VM)11 HashSet (java.util.HashSet)10 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)10 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)9 StorageDomainValidator (org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator)7 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)7