Search in sources :

Example 86 with GlusterBrickEntity

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

the class AbstractRemoveGlusterVolumeBricksCommandTest method getBricks.

protected List<GlusterBrickEntity> getBricks(Guid volumeId) {
    List<GlusterBrickEntity> bricks = new ArrayList<>();
    GlusterBrickEntity brick1 = new GlusterBrickEntity();
    brick1.setVolumeId(volumeId);
    brick1.setId(BRICK_UUID1);
    brick1.setBrickDirectory("/tmp/test-vol0");
    brick1.setServerId(SERVER_ID);
    brick1.setStatus(GlusterStatus.UP);
    bricks.add(brick1);
    GlusterBrickEntity brick2 = new GlusterBrickEntity();
    brick2.setVolumeId(volumeId);
    brick2.setId(BRICK_UUID1);
    brick2.setBrickDirectory("/tmp/test-vol1");
    brick2.setServerId(SERVER_ID);
    brick2.setStatus(GlusterStatus.UP);
    bricks.add(brick2);
    return bricks;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ArrayList(java.util.ArrayList)

Example 87 with GlusterBrickEntity

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

the class AddBricksToGlusterVolumeCommandTest method validateSucceedsonServerCheckIncreasingReplica.

@Test
public void validateSucceedsonServerCheckIncreasingReplica() {
    List<GlusterBrickEntity> bricks = new ArrayList<>();
    bricks.add(getBrick(volumeIdRepl, Guid.newGuid(), "/brick1"));
    bricks.add(getBrick(volumeIdRepl, Guid.newGuid(), "/brick2"));
    initTestCommand(volumeIdRepl, bricks, 3, 0, false);
    doReturn(getVdsStatic()).when(vdsStaticDao).get(any());
    GlusterVolumeEntity vol = getMultiBrickVolume(volumeIdRepl, 4);
    vol.setVolumeType(GlusterVolumeType.DISTRIBUTED_REPLICATE);
    vol.setReplicaCount(2);
    doReturn(vol).when(volumeDao).getById(volumeIdRepl);
    assertTrue(cmd.validate());
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 88 with GlusterBrickEntity

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

the class AddBricksToGlusterVolumeCommandTest method validateSucceedsonServerCheck.

@Test
public void validateSucceedsonServerCheck() {
    List<GlusterBrickEntity> bricks = new ArrayList<>();
    bricks.add(getBrick(volumeIdRepl, Guid.newGuid(), "/brick1"));
    bricks.add(getBrick(volumeIdRepl, Guid.newGuid(), "/brick2"));
    initTestCommand(volumeIdRepl, bricks, 2, 0, false);
    doReturn(getVdsStatic()).when(vdsStaticDao).get(any());
    GlusterVolumeEntity vol = getMultiBrickVolume(volumeIdRepl, 4);
    vol.setVolumeType(GlusterVolumeType.DISTRIBUTED_REPLICATE);
    vol.setReplicaCount(2);
    doReturn(vol).when(volumeDao).getById(volumeIdRepl);
    assertTrue(cmd.validate());
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 89 with GlusterBrickEntity

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

the class CreateGlusterVolumeCommandTest method getBricks.

private List<GlusterBrickEntity> getBricks(Guid volumeId, int max, boolean withDuplicates) {
    List<GlusterBrickEntity> bricks = new ArrayList<>();
    GlusterBrickEntity brick = null;
    for (Integer i = 0; i < max; i++) {
        brick = new GlusterBrickEntity();
        brick.setVolumeId(volumeId);
        brick.setServerId(serverId);
        brick.setServerName(serverName);
        brick.setBrickDirectory("/tmp/s" + i.toString());
        brick.setStatus(GlusterStatus.UP);
        bricks.add(brick);
    }
    if (max > 0 && withDuplicates) {
        bricks.add(brick);
    }
    return bricks;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ArrayList(java.util.ArrayList)

Example 90 with GlusterBrickEntity

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

the class GetGlusterBrickByIdQueryTest method testExecuteQueryCommnad.

@Test
public void testExecuteQueryCommnad() {
    getQuery().executeQueryCommand();
    GlusterBrickEntity actual = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals("wrong Gluster Brick", expected.getId(), actual.getId());
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Aggregations

GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)132 ArrayList (java.util.ArrayList)63 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)43 Test (org.junit.Test)28 Guid (org.ovirt.engine.core.compat.Guid)19 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)14 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)11 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11 List (java.util.List)10 HashMap (java.util.HashMap)9 Map (java.util.Map)9 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)9 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)9 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)7 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)7 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)7 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)7 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)7 Iterator (java.util.Iterator)5