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