Search in sources :

Example 81 with GlusterVolumeEntity

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

the class GlusterVolumeDaoTest method testUpdateAsyncTaskId.

@Test
public void testUpdateAsyncTaskId() {
    assertNotNull(existingDistVol.getAsyncTask());
    assertNull(existingDistVol.getAsyncTask().getTaskId());
    dao.updateVolumeTask(existingDistVol.getId(), REBALANCING_VOLUME_TASKID);
    GlusterVolumeEntity volume = dao.getAllWithQuery("select * from gluster_volumes_view where id = '" + existingDistVol.getId() + "'").get(0);
    assertNotNull("Volume : " + existingDistVol.getId() + " doesn't exists", volume);
    assertEquals("Task ID is not getting updated", REBALANCING_VOLUME_TASKID, volume.getAsyncTask().getTaskId());
    assertEquals("Invalid Task status", JobExecutionStatus.STARTED, volume.getAsyncTask().getStatus());
    assertEquals("Invalid Task type", GlusterTaskType.REBALANCE, volume.getAsyncTask().getType());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Test(org.junit.Test)

Example 82 with GlusterVolumeEntity

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

the class GlusterVolumeDaoTest method testGetVolumesByStatusAndTypes.

@Test
public void testGetVolumesByStatusAndTypes() {
    List<GlusterVolumeEntity> volumes = dao.getVolumesByStatusAndTypes(CLUSTER_ID, GlusterStatus.UP, Collections.singletonList(GlusterVolumeType.DISTRIBUTE));
    assertNotNull(volumes);
    assertTrue(volumes.contains(existingDistVol));
    for (GlusterVolumeEntity volume : volumes) {
        assertEquals(GlusterVolumeType.DISTRIBUTE, volume.getVolumeType());
    }
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Test(org.junit.Test)

Example 83 with GlusterVolumeEntity

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

the class GlusterVolumeDaoTest method testAddTransportType.

@Test
public void testAddTransportType() {
    Set<TransportType> transportTypes = existingDistVol.getTransportTypes();
    assertEquals(1, transportTypes.size());
    assertFalse(transportTypes.contains(TransportType.RDMA));
    dao.addTransportType(EXISTING_VOL_DIST_ID, TransportType.RDMA);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_DIST_ID);
    assertNotNull(volumeAfter);
    transportTypes = volumeAfter.getTransportTypes();
    assertEquals(2, transportTypes.size());
    assertTrue(transportTypes.contains(TransportType.RDMA));
    assertFalse(volumeAfter.equals(existingDistVol));
    existingDistVol.addTransportType(TransportType.RDMA);
    assertEquals(volumeAfter, existingDistVol);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Test(org.junit.Test)

Example 84 with GlusterVolumeEntity

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

the class GlusterVolumeDaoTest method testRemoveTransportType.

@Test
public void testRemoveTransportType() {
    Set<TransportType> transportTypes = existingReplVol.getTransportTypes();
    assertEquals(2, transportTypes.size());
    assertTrue(transportTypes.contains(TransportType.RDMA));
    dao.removeTransportType(EXISTING_VOL_REPL_ID, TransportType.RDMA);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_REPL_ID);
    assertNotNull(volumeAfter);
    transportTypes = volumeAfter.getTransportTypes();
    assertEquals(1, transportTypes.size());
    assertFalse(transportTypes.contains(TransportType.RDMA));
    assertFalse(volumeAfter.equals(existingReplVol));
    existingReplVol.removeTransportType(TransportType.RDMA);
    assertEquals(volumeAfter, existingReplVol);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Test(org.junit.Test)

Example 85 with GlusterVolumeEntity

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

the class GlusterVolumeDaoTest method insertTestVolume.

private GlusterVolumeEntity insertTestVolume() {
    Guid volumeId = Guid.newGuid();
    GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setName(NEW_VOL_NAME);
    volume.setClusterId(CLUSTER_ID);
    volume.setId(volumeId);
    volume.setVolumeType(GlusterVolumeType.DISTRIBUTE);
    volume.addTransportType(TransportType.TCP);
    volume.setReplicaCount(0);
    volume.setStripeCount(0);
    volume.setStatus(GlusterStatus.UP);
    volume.setOption("auth.allow", "*");
    volume.addAccessProtocol(AccessProtocol.GLUSTER);
    volume.addAccessProtocol(AccessProtocol.NFS);
    GlusterBrickEntity brick = new GlusterBrickEntity();
    brick.setVolumeId(volumeId);
    brick.setServerId(server.getId());
    brick.setServerName(server.getHostName());
    brick.setBrickDirectory("/export/testVol1");
    brick.setStatus(GlusterStatus.UP);
    brick.setBrickOrder(0);
    volume.addBrick(brick);
    volume.setSnapshotsCount(0);
    volume.setSnapMaxLimit(0);
    dao.save(volume);
    return volume;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Guid(org.ovirt.engine.core.compat.Guid)

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