use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRemoveNonExistentBrick.
@Test
public void canRemoveNonExistentBrick() {
GlusterVolumeEntity volumeEntity = getDistributedVolume(volumeId1, 4);
List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
bricksToRemove.addAll(getBricks(volumeEntity.getId(), 1));
bricksToRemove.get(0).setBrickDirectory("NewServer:/NewExport");
ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 1, false);
assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_BRICK_INVALID));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRemoveAllBricksFromSubVolume.
@Test
public void canRemoveAllBricksFromSubVolume() {
GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 9, 3);
List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
bricksToRemove.add(volumeEntity.getBricks().get(6));
bricksToRemove.add(volumeEntity.getBricks().get(7));
bricksToRemove.add(volumeEntity.getBricks().get(8));
ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 3, false);
assertThat(validationResult, isValid());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRemoveIncreaseReplica.
@Test
public void canRemoveIncreaseReplica() {
GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
bricksToRemove.add(volumeEntity.getBricks().get(0));
ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 5, false);
assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRemoveBrickUpdatesBrickDetalis.
@Test
public void canRemoveBrickUpdatesBrickDetalis() {
GlusterVolumeEntity volumeEntity = getDistributedVolume(volumeId1, 4);
List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
bricksToRemove.addAll(getBricks(volumeEntity.getId(), 1));
bricksToRemove.get(0).setId(volumeEntity.getBricks().get(2).getId());
bricksToRemove.get(0).setServerName(null);
bricksToRemove.get(0).setBrickDirectory(null);
ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 1, false);
assertThat(validationResult, isValid());
assertThat(bricksToRemove.get(0).getServerName(), notNullValue());
assertThat(bricksToRemove.get(0).getBrickDirectory(), notNullValue());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJobTest method getVolume.
private GlusterVolumeEntity getVolume(Guid clusterId, Guid volumeId, String volumeName) {
GlusterVolumeEntity volume = new GlusterVolumeEntity();
volume.setName(volumeName);
volume.setClusterId(clusterId);
volume.setId(volumeId);
volume.setReplicaCount(2);
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setVolumeId(volume.getId());
brick.setBrickDirectory("/export/testvol1");
brick.setStatus(GlusterStatus.UP);
brick.setBrickOrder(0);
volume.addBrick(brick);
GlusterBrickEntity brick2 = new GlusterBrickEntity();
brick2.setVolumeId(volume.getId());
brick2.setBrickDirectory("/export/testvol1");
brick2.setStatus(GlusterStatus.UP);
brick2.setBrickOrder(1);
volume.addBrick(brick2);
return volume;
}
Aggregations