Search in sources :

Example 11 with GlusterVolumeSnapshotConfig

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);
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) Test(org.junit.Test)

Example 12 with GlusterVolumeSnapshotConfig

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;
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)

Example 13 with GlusterVolumeSnapshotConfig

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;
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)

Example 14 with GlusterVolumeSnapshotConfig

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);
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ArrayList(java.util.ArrayList) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 15 with GlusterVolumeSnapshotConfig

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);
    }
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) StringUtils(org.apache.commons.lang.StringUtils) StepEnum(org.ovirt.engine.core.common.job.StepEnum) MassOperationsGenericDao(org.ovirt.engine.core.dao.MassOperationsGenericDao) Guid(org.ovirt.engine.core.compat.Guid) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Singleton(javax.inject.Singleton) HashSet(java.util.HashSet) Inject(javax.inject.Inject) AccessProtocol(org.ovirt.engine.core.common.businessentities.gluster.AccessProtocol) GlusterConstants(org.ovirt.engine.core.common.constants.gluster.GlusterConstants) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) EnumUtils(org.ovirt.engine.core.common.utils.EnumUtils) GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Named(javax.inject.Named) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) Collection(java.util.Collection) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) RowMapper(org.springframework.jdbc.core.RowMapper) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)

Aggregations

GlusterVolumeSnapshotConfig (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)23 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)5 HashMap (java.util.HashMap)4 Guid (org.ovirt.engine.core.compat.Guid)3 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)3 List (java.util.List)2 UpdateGlusterVolumeSnapshotConfigParameters (org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)2 GlusterClusterSnapshotConfigModel (org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel)2 TextInputCell (com.google.gwt.cell.client.TextInputCell)1 Column (com.google.gwt.user.cellview.client.Column)1 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Inject (javax.inject.Inject)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 StringUtils (org.apache.commons.lang.StringUtils)1