Search in sources :

Example 26 with GlusterVolumeEntity

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

the class GetGlusterVolumeAdvancedDetailsQuery method getServiceInfo.

/**
 * To get the service info, the UI will not pass the volume name, in that case engine will fetch the volume name in
 * the database.
 *
 * NFS volume name should be passed to get nfs service details, similarly REPLICATE/DISTRIBUTED_REPLICATE volume
 * name should be passed as an argument to get the SHD details.
 *
 * So to get volume name from database engine will do the following steps.<br>
 * 1. First fetch NFS + REPLICATE/DISTRIBUTED_REPLICATE volume name<br>
 * 2. If not found then fetch the nfs volume name and then fetch REPLICATE/DISTRIBUTED_REPLICATE volume name<br>
 * 3. The VDS query will be called twice, one with nfs volume name and another with replicate volume name, finally
 * combine the service details.
 */
private GlusterVolumeAdvancedDetails getServiceInfo() {
    // Get Nfs + Replicated/Distributed Replicate volume.
    GlusterVolumeEntity nfsReplicateVolume = getNfsReplicateVolume(clusterId);
    if (nfsReplicateVolume != null) {
        return fetchAdvancedDetails(nfsReplicateVolume.getName());
    }
    // Get Nfs enabled volume
    GlusterVolumeEntity nfsVolume = getNfsVolume(clusterId);
    // Get Replicated volume
    GlusterVolumeEntity replicateVolume = getReplicateVolume(clusterId);
    // If there is no volume present in the cluster, then return empty Volume Advanced Details
    if (nfsVolume == null && replicateVolume == null) {
        log.error("To get service details, no Nfs or Replicated volumes found in the cluster.");
        return new GlusterVolumeAdvancedDetails();
    }
    GlusterVolumeAdvancedDetails nfsServiceInfo = null;
    GlusterVolumeAdvancedDetails shdServiceInfo = null;
    if (nfsVolume != null) {
        nfsServiceInfo = fetchAdvancedDetails(nfsVolume.getName());
    }
    if (replicateVolume != null) {
        shdServiceInfo = fetchAdvancedDetails(replicateVolume.getName());
    }
    if (nfsServiceInfo == null && shdServiceInfo != null) {
        return shdServiceInfo;
    } else if (nfsServiceInfo != null && shdServiceInfo != null) {
        // combine the Nfs + Shd status
        nfsServiceInfo.getServiceInfo().addAll(shdServiceInfo.getServiceInfo());
    }
    return nfsServiceInfo;
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)

Example 27 with GlusterVolumeEntity

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

the class GetNonEligibilityReasonsOfVolumeForGeoRepSessionQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    GlusterVolumeEntity masterVolume = glusterVolumeDao.getById(getParameters().getId());
    GlusterVolumeEntity slaveVolume = glusterVolumeDao.getById(getParameters().getSlaveVolumeId());
    getQueryReturnValue().setReturnValue(getNonEligibilityReasons(masterVolume, slaveVolume));
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 28 with GlusterVolumeEntity

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

the class GetGlusterGeoReplicationEligibleVolumesQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Guid masterVolumeId = getParameters().getId();
    GlusterVolumeEntity masterVolume = glusterVolumeDao.getById(masterVolumeId);
    getQueryReturnValue().setReturnValue(getEligibleVolumes(masterVolume));
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Guid(org.ovirt.engine.core.compat.Guid)

Example 29 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRebalanceOnDistributeReplicateVolumeWithFewBrickDown.

@Test
public void canRebalanceOnDistributeReplicateVolumeWithFewBrickDown() {
    GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
    volumeEntity.getBricks().get(0).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(1).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(2).setStatus(GlusterStatus.DOWN);
    ValidationResult validationResult = brickValidator.canRebalance(volumeEntity);
    assertThat(validationResult, isValid());
    volumeEntity.getBricks().get(4).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(5).setStatus(GlusterStatus.DOWN);
    volumeEntity.getBricks().get(6).setStatus(GlusterStatus.DOWN);
    validationResult = brickValidator.canRebalance(volumeEntity);
    assertThat(validationResult, isValid());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 30 with GlusterVolumeEntity

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

the class GlusterBrickValidatorTest method canRemoveBrickReduceReplicaMoreThanOne.

@Test
public void canRemoveBrickReduceReplicaMoreThanOne() {
    GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
    List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
    bricksToRemove.add(volumeEntity.getBricks().get(0));
    bricksToRemove.add(volumeEntity.getBricks().get(4));
    bricksToRemove.add(volumeEntity.getBricks().get(8));
    bricksToRemove.add(volumeEntity.getBricks().get(1));
    bricksToRemove.add(volumeEntity.getBricks().get(5));
    bricksToRemove.add(volumeEntity.getBricks().get(9));
    ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 2, false);
    assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

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