Search in sources :

Example 1 with GlusterVolumeProfileInfo

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

the class BackendGlusterVolumeResource method getProfileStatistics.

@Override
public Response getProfileStatistics(Action action) {
    boolean nfsStats = isNfsStatistics();
    QueryReturnValue result = runQuery(QueryType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileParameters(Guid.createGuidFromString(parent.getParent().get().getId()), guid, nfsStats));
    if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
        GlusterVolumeProfileInfo info = result.getReturnValue();
        GlusterVolumeProfileDetails statistics = GlusterVolumeProfileInfoMapper.map(info, null);
        statistics = LinkHelper.addLinks(statistics);
        return Response.ok(statistics).build();
    } else {
        // throw exception
        throw new WebFaultException(null, localize(Messages.BACKEND_FAILED), Response.Status.INTERNAL_SERVER_ERROR);
    }
}
Also used : GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)

Example 2 with GlusterVolumeProfileInfo

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

the class GetGlusterVolumeProfileInfoQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), getParameters().isNfs()));
    GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) returnValue.getReturnValue();
    if (!getParameters().isNfs()) {
        populateBrickNames(profileInfo);
    }
    getQueryReturnValue().setReturnValue(profileInfo);
}
Also used : GlusterVolumeProfileInfoVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeProfileInfoVDSParameters) GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with GlusterVolumeProfileInfo

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

the class GetGlusterVolumeProfileInfoQueryTest method setupExpectedGlusterVolumeOptionInfo.

private void setupExpectedGlusterVolumeOptionInfo() {
    params = new GlusterVolumeProfileParameters(CLUSTER_ID, VOLUME_ID);
    expectedProfileInfo = new GlusterVolumeProfileInfo();
    expectedProfileInfo.setVolumeId(VOLUME_ID);
    expectedProfileInfo.setBrickProfileDetails(getBrickProfileDetails());
}
Also used : GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)

Example 4 with GlusterVolumeProfileInfo

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

the class GetGlusterVolumeProfileInfoQueryTest method testExecuteQueryCommand.

@Test
public void testExecuteQueryCommand() {
    doReturn(params.getClusterId()).when(getQueryParameters()).getClusterId();
    doReturn(params.getVolumeId()).when(getQueryParameters()).getVolumeId();
    doReturn(params.isNfs()).when(getQueryParameters()).isNfs();
    getQuery().executeQueryCommand();
    GlusterVolumeProfileInfo glusterVolumeProfileInfo = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(glusterVolumeProfileInfo);
    assertEquals(expectedProfileInfo, glusterVolumeProfileInfo);
}
Also used : GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 5 with GlusterVolumeProfileInfo

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

the class VolumeProfileStatisticsModel method queryBackend.

public void queryBackend(final boolean isBrickSelected) {
    startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    AsyncDataProvider.getInstance().getGlusterVolumeProfilingStatistics(new AsyncQuery<>(returnValue -> {
        stopProgress();
        GlusterVolumeProfileInfo profileInfoEntity = returnValue.getReturnValue();
        if ((profileInfoEntity == null) || !returnValue.getSucceeded()) {
            setSuccessfulProfileStatsFetch(false);
            if (!isBrickSelected) {
                showNfsProfileStats(profileInfoEntity);
            } else {
                showProfileStats(profileInfoEntity);
            }
        } else {
            GlusterVolumeProfileInfo aggregatedProfileInfo = new GlusterVolumeProfileInfo();
            aggregatedProfileInfo.setBrickProfileDetails((profileInfoEntity.getBrickProfileDetails() != null) ? profileInfoEntity.getBrickProfileDetails() : getProfileInfo().getBrickProfileDetails());
            aggregatedProfileInfo.setNfsProfileDetails((profileInfoEntity.getNfsProfileDetails() != null) ? profileInfoEntity.getNfsProfileDetails() : getProfileInfo().getNfsProfileDetails());
            setProfileExportUrl(formProfileUrl(clusterId.toString(), volumeId.toString(), isBrickSelected));
            setProfileInfo(aggregatedProfileInfo);
            setSuccessfulProfileStatsFetch(true);
            setTitle(ConstantsManager.getInstance().getMessages().volumeProfilingStatsTitle(volumeName));
            if (!isBrickSelected) {
                showNfsProfileStats(profileInfoEntity);
            } else {
                showProfileStats(profileInfoEntity);
            }
        }
    }), clusterId, volumeId, !isBrickSelected);
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) ArrayList(java.util.ArrayList) GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) SizeConverter(org.ovirt.engine.core.common.utils.SizeConverter) List(java.util.List) BrickProfileDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails) GlusterVolumeProfileStats(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats) FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) SizeUnit(org.ovirt.engine.core.common.utils.SizeConverter.SizeUnit) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StringFormat(org.ovirt.engine.core.compat.StringFormat) NumberFormat(com.google.gwt.i18n.client.NumberFormat) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Pair(org.ovirt.engine.core.common.utils.Pair) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) Model(org.ovirt.engine.ui.uicommonweb.models.Model) GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo)

Aggregations

GlusterVolumeProfileInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo)5 GlusterVolumeProfileParameters (org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)2 NumberFormat (com.google.gwt.i18n.client.NumberFormat)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.Test)1 GlusterVolumeProfileDetails (org.ovirt.engine.api.model.GlusterVolumeProfileDetails)1 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)1 BrickProfileDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails)1 FopStats (org.ovirt.engine.core.common.businessentities.gluster.FopStats)1 GlusterVolumeProfileStats (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats)1 StatsInfo (org.ovirt.engine.core.common.businessentities.gluster.StatsInfo)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 SizeConverter (org.ovirt.engine.core.common.utils.SizeConverter)1 SizeUnit (org.ovirt.engine.core.common.utils.SizeConverter.SizeUnit)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 GlusterVolumeProfileInfoVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeProfileInfoVDSParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 StringFormat (org.ovirt.engine.core.compat.StringFormat)1