use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotConfigDaoTest method testGetGlusterVolumeSnapshotConfigByClusterIdAndName.
@Test
public void testGetGlusterVolumeSnapshotConfigByClusterIdAndName() {
GlusterVolumeSnapshotConfig config = dao.getConfigByClusterIdAndName(CLUSTER_ID, PARAM_NAME_3);
assertNotNull(config);
assertEquals(config, existingConfig3);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJobTest method getClusterSnapMaxLimit.
private GlusterVolumeSnapshotConfig getClusterSnapMaxLimit() {
GlusterVolumeSnapshotConfig param = new GlusterVolumeSnapshotConfig();
param.setClusterId(CLUSTER_ID_1);
param.setVolumeId(null);
param.setParamName(PARAM_SNAP_MAX_LIMIT);
param.setParamValue("256");
return param;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJobTest method getVolumeSnapMaxLimit.
private GlusterVolumeSnapshotConfig getVolumeSnapMaxLimit() {
GlusterVolumeSnapshotConfig param = new GlusterVolumeSnapshotConfig();
param.setClusterId(CLUSTER_ID_1);
param.setVolumeId(VOLUME_ID_1);
param.setParamName(PARAM_SNAP_MAX_LIMIT);
param.setParamValue("20");
return param;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GetGlusterVolumeSnapshotConfigQuery method getConfigPair.
private Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> getConfigPair(List<GlusterVolumeSnapshotConfig> configs) {
List<GlusterVolumeSnapshotConfig> clusterCfgs = new ArrayList<>();
List<GlusterVolumeSnapshotConfig> volumeCfgs = new ArrayList<>();
for (GlusterVolumeSnapshotConfig config : configs) {
if (Guid.isNullOrEmpty(config.getVolumeId())) {
clusterCfgs.add(config);
} else if (getParameters().getVolumeId() != null && config.getVolumeId().equals(getParameters().getVolumeId())) {
volumeCfgs.add(config);
}
}
return new Pair<>(clusterCfgs, volumeCfgs);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterVolumeDaoImpl method fetchRelatedEntities.
/**
* Fetches and populates related entities like bricks, options, access protocols for the given volume
*/
private void fetchRelatedEntities(GlusterVolumeEntity volume) {
if (volume != null) {
volume.setOptions(glusterOptionDao.getOptionsOfVolume(volume.getId()));
volume.setAccessProtocols(new HashSet<>(getAccessProtocolsOfVolume(volume.getId())));
volume.setTransportTypes(new HashSet<>(getTransportTypesOfVolume(volume.getId())));
GlusterVolumeAdvancedDetails advancedDetails = fetchAdvancedDatails(volume.getId());
if (advancedDetails != null) {
volume.setAdvancedDetails(advancedDetails);
}
GlusterAsyncTask asyncTask = getAsyncTaskOfVolume(volume.getId());
if (asyncTask != null) {
volume.setAsyncTask(asyncTask);
}
List<GlusterBrickEntity> bricks = glusterBrickDao.getBricksOfVolume(volume.getId());
if (volume.getAsyncTask() != null && volume.getAsyncTask().getTaskId() != null) {
bricks.stream().filter(brick -> brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())).forEach(brick -> brick.setAsyncTask(volume.getAsyncTask()));
}
volume.setBricks(bricks);
GlusterVolumeSnapshotConfig config = glusterVolumeSnapshotConfigDao.getConfigByVolumeIdAndName(volume.getClusterId(), volume.getId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT);
if (config == null || StringUtils.isEmpty(config.getParamValue())) {
config = glusterVolumeSnapshotConfigDao.getConfigByClusterIdAndName(volume.getClusterId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT);
}
volume.setSnapMaxLimit(config != null ? Integer.parseInt(config.getParamValue()) : 0);
}
}
Aggregations