Search in sources :

Example 91 with GlusterVolumeEntity

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

the class GlusterSyncJobTest method getFetchedVolumesList.

/**
 * Returns the list of volumes as if they were fetched from glusterfs. Changes from existing volumes are:<br>
 * - existingDistVol not fetched (means it was removed from gluster cli, and should be removed from db<br>
 * - option 'auth.allow' removed from the existingReplVol<br>
 * - new option 'auth.reject' added to existingReplVol<br>
 * - value of option 'nfs.disable' changed from 'off' ot 'on' in existingReplVol<br>
 * - new volume test-new-vol fetched from gluster (means it was added from gluster cli, and should be added to db<br>
 */
private Map<Guid, GlusterVolumeEntity> getFetchedVolumesList() {
    Map<Guid, GlusterVolumeEntity> volumes = new HashMap<>();
    GlusterVolumeEntity fetchedReplVol = createReplVol();
    // option removed
    fetchedReplVol.removeOption(OPTION_AUTH_ALLOW);
    // added
    fetchedReplVol.setOption(OPTION_AUTH_REJECT, AUTH_REJECT_IP);
    // changed
    fetchedReplVol.setOption(OPTION_NFS_DISABLE, OPTION_VALUE_ON);
    // brick changes
    removedBrickIds.add(GlusterCoreUtil.findBrick(existingReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R1D1).getId());
    removedBrickIds.add(GlusterCoreUtil.findBrick(existingReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R2D1).getId());
    GlusterBrickEntity brickToReplace = GlusterCoreUtil.findBrick(fetchedReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R1D1);
    replaceBrick(brickToReplace, SERVER_ID_1, REPL_BRICK_R1D1_NEW);
    brickToReplace = GlusterCoreUtil.findBrick(fetchedReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R2D1);
    replaceBrick(brickToReplace, SERVER_ID_1, REPL_BRICK_R2D1_NEW);
    volumes.put(fetchedReplVol.getId(), fetchedReplVol);
    // add a new volume
    newVolume = getNewVolume();
    volumes.put(newVolume.getId(), newVolume);
    return volumes;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) HashMap(java.util.HashMap) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Guid(org.ovirt.engine.core.compat.Guid)

Example 92 with GlusterVolumeEntity

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

the class GlusterVolumeRemoveBricksCommandTest method getSingleBrickVolume.

private GlusterVolumeEntity getSingleBrickVolume(Guid volumeId) {
    GlusterVolumeEntity volume = getGlusterVolume(volumeId);
    volume.setStatus(GlusterStatus.UP);
    volume.setBricks(getBricks(volumeId, 1));
    volume.setClusterId(CLUSTER_ID);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 93 with GlusterVolumeEntity

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

the class GlusterVolumeRemoveBricksCommandTest method getMultiBrickVolume.

private GlusterVolumeEntity getMultiBrickVolume(Guid volumeId) {
    GlusterVolumeEntity volume = getGlusterVolume(volumeId);
    volume.setStatus(GlusterStatus.UP);
    volume.setBricks(getBricks(volumeId, 2));
    volume.setClusterId(CLUSTER_ID);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 94 with GlusterVolumeEntity

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

the class RefreshGlusterVolumeDetailsCommandTest method getVolume.

private GlusterVolumeEntity getVolume(Guid id) {
    GlusterVolumeEntity volumeEntity = new GlusterVolumeEntity();
    volumeEntity.setId(id);
    volumeEntity.setName("test-vol");
    volumeEntity.addAccessProtocol(AccessProtocol.GLUSTER);
    volumeEntity.addTransportType(TransportType.TCP);
    return volumeEntity;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 95 with GlusterVolumeEntity

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

the class RefreshGlusterVolumeDetailsCommandTest method getDistributedVolume.

private GlusterVolumeEntity getDistributedVolume(Guid volumeId) {
    GlusterVolumeEntity volume = getVolume(volumeId);
    volume.setStatus((volumeId == volumeId1) ? GlusterStatus.UP : GlusterStatus.DOWN);
    volume.setBricks(getBricks(volumeId, 2));
    volume.setVolumeType(GlusterVolumeType.DISTRIBUTE);
    volume.setClusterId(CLUSTER_ID);
    return volume;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

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