Search in sources :

Example 51 with GlusterBrickEntity

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

the class GlusterGeoRepSyncJobTest method getVolume.

private GlusterVolumeEntity getVolume() {
    GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setName("VOL1");
    volume.setClusterId(Guid.newGuid());
    volume.setId(Guid.newGuid());
    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;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 52 with GlusterBrickEntity

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

the class GlusterHostValidatorTest method getGlusterBrick.

private GlusterBrickEntity getGlusterBrick(GlusterStatus status, Guid serverId) {
    GlusterBrickEntity brick = new GlusterBrickEntity();
    brick.setStatus(status);
    brick.setServerId(serverId);
    return brick;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)

Example 53 with GlusterBrickEntity

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

the class GlusterSyncJobTest method getVolumeAdvancedDetails.

private GlusterVolumeAdvancedDetails getVolumeAdvancedDetails(GlusterVolumeEntity volume) {
    GlusterVolumeAdvancedDetails volDetails = new GlusterVolumeAdvancedDetails();
    GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
    capacityInfo.setVolumeId(volume.getId());
    capacityInfo.setTotalSize(600000L);
    capacityInfo.setFreeSize(200000L);
    capacityInfo.setUsedSize(400000L);
    volDetails.setCapacityInfo(capacityInfo);
    List<BrickDetails> brickDetailsList = new ArrayList<>();
    for (GlusterBrickEntity brick : volume.getBricks()) {
        BrickDetails brickDetails = new BrickDetails();
        BrickProperties properties = new BrickProperties();
        properties.setBrickId(brick.getId());
        brickDetails.setBrickProperties(properties);
        properties.setStatus(brick.getStatus());
        if (volume == existingReplVol) {
            if (brick.getServerId().equals(SERVER_ID_1) && (brick.getBrickDirectory().equals(REPL_BRICK_R1D1) || brick.getBrickDirectory().equals(REPL_BRICK_R2D1))) {
                properties.setStatus(GlusterStatus.DOWN);
                bricksWithChangedStatus.add(brick);
            }
        }
        brickDetailsList.add(brickDetails);
    }
    volDetails.setBrickDetails(brickDetailsList);
    return volDetails;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 54 with GlusterBrickEntity

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

the class GlusterSyncJobTest method getNewVolume.

private GlusterVolumeEntity getNewVolume() {
    GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setName(NEW_VOL_NAME);
    volume.setClusterId(CLUSTER_ID);
    volume.setId(NEW_VOL_ID);
    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(NEW_VOL_ID);
    brick.setServerId(existingServer1.getId());
    brick.setServerName(existingServer1.getHostName());
    brick.setBrickDirectory("/export/testvol1");
    brick.setStatus(GlusterStatus.UP);
    brick.setBrickOrder(0);
    volume.addBrick(brick);
    return volume;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 55 with GlusterBrickEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity 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)

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