Search in sources :

Example 16 with GlusterVolumeAdvancedDetails

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

Example 17 with GlusterVolumeAdvancedDetails

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

the class VolumeBrickListModel method onShowBrickAdvancedDetails.

private void onShowBrickAdvancedDetails(GlusterVolumeEntity volumeEntity) {
    final GlusterBrickEntity brickEntity = getSelectedItem();
    final BrickAdvancedDetailsModel brickModel = new BrickAdvancedDetailsModel();
    setWindow(brickModel);
    brickModel.setTitle(ConstantsManager.getInstance().getConstants().advancedDetailsBrickTitle());
    brickModel.setHelpTag(HelpTag.brick_advanced);
    // $NON-NLS-1$
    brickModel.setHashName("brick_advanced");
    brickModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterVolumeBrickDetails(new AsyncQuery<QueryReturnValue>(returnValue -> {
        brickModel.stopProgress();
        if (returnValue == null || !returnValue.getSucceeded()) {
            brickModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingBrickAdvancedDetails());
            return;
        }
        GlusterVolumeAdvancedDetails advDetails = returnValue.getReturnValue();
        brickModel.getBrick().setEntity(brickEntity.getQualifiedName());
        if (advDetails != null && advDetails.getBrickDetails() != null && advDetails.getBrickDetails().size() == 1) {
            BrickDetails brickDetails = advDetails.getBrickDetails().get(0);
            brickModel.getBrickProperties().setProperties(brickDetails.getBrickProperties());
            ArrayList<EntityModel<GlusterClientInfo>> clients = new ArrayList<>();
            for (GlusterClientInfo client : brickDetails.getClients()) {
                clients.add(new EntityModel<>(client));
            }
            brickModel.getClients().setItems(clients);
            brickModel.getMemoryStatistics().updateMemoryStatistics(brickDetails.getMemoryStatus().getMallInfo());
            ArrayList<EntityModel<Mempool>> memoryPools = new ArrayList<>();
            for (Mempool mempool : brickDetails.getMemoryStatus().getMemPools()) {
                memoryPools.add(new EntityModel<>(mempool));
            }
            brickModel.getMemoryPools().setItems(memoryPools);
        }
    }, true), volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId());
    // $NON-NLS-1$
    UICommand command = new UICommand("Cancel", this);
    command.setTitle(ConstantsManager.getInstance().getConstants().close());
    command.setIsCancel(true);
    brickModel.getCommands().add(command);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Example 18 with GlusterVolumeAdvancedDetails

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

the class VolumeCapacityCell method render.

@Override
public void render(Context context, GlusterVolumeEntity object, SafeHtmlBuilder sb, String id) {
    GlusterVolumeAdvancedDetails advancedDetails = object.getAdvancedDetails();
    GlusterVolumeSizeInfo sizeInfo = null;
    if (advancedDetails != null) {
        sizeInfo = advancedDetails.getCapacityInfo();
        if (sizeInfo != null) {
            setFreeSize(sizeInfo.getFreeSize().doubleValue());
            setTotalSize(sizeInfo.getTotalSize().doubleValue());
            setUsedSize(sizeInfo.getUsedSize().doubleValue());
            setInUnit(SizeUnit.BYTES);
        }
    }
    super.render(context, advancedDetails == null ? null : sizeInfo == null ? null : sizeInfo, sb, id);
}
Also used : GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)

Aggregations

GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)18 Test (org.junit.Test)6 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)6 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)5 GlusterBrickAdvancedDetails (org.ovirt.engine.api.model.GlusterBrickAdvancedDetails)4 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)4 Guid (org.ovirt.engine.core.compat.Guid)4 ArrayList (java.util.ArrayList)3 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)3 GlusterVolumeSizeInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)3 List (java.util.List)2 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)2 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)2 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)2 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)2 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 GlusterVolumeAdvancedDetailsParameters (org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1