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;
}
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));
}
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));
}
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());
}
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));
}
Aggregations