Search in sources :

Example 11 with Statistic

use of org.ovirt.engine.api.model.Statistic in project ovirt-engine by oVirt.

the class BackendVmDiskResource method addStatistics.

private void addStatistics(Disk model, org.ovirt.engine.core.common.businessentities.storage.Disk entity) {
    model.setStatistics(new Statistics());
    DiskStatisticalQuery query = new DiskStatisticalQuery(newModel(model.getId()));
    List<Statistic> statistics = query.getStatistics(entity);
    for (Statistic statistic : statistics) {
        LinkHelper.addLinks(statistic, query.getParentType());
    }
    model.getStatistics().getStatistics().addAll(statistics);
}
Also used : Statistic(org.ovirt.engine.api.model.Statistic) Statistics(org.ovirt.engine.api.model.Statistics)

Example 12 with Statistic

use of org.ovirt.engine.api.model.Statistic in project ovirt-engine by oVirt.

the class BackendVmDisksResource method addStatistics.

private void addStatistics(Disk model, org.ovirt.engine.core.common.businessentities.storage.Disk entity) {
    model.setStatistics(new Statistics());
    DiskStatisticalQuery query = new DiskStatisticalQuery(newModel(model.getId()));
    List<Statistic> statistics = query.getStatistics(entity);
    for (Statistic statistic : statistics) {
        LinkHelper.addLinks(statistic, query.getParentType());
    }
    model.getStatistics().getStatistics().addAll(statistics);
}
Also used : Statistic(org.ovirt.engine.api.model.Statistic) Statistics(org.ovirt.engine.api.model.Statistics)

Example 13 with Statistic

use of org.ovirt.engine.api.model.Statistic in project ovirt-engine by oVirt.

the class BackendVmResource method addStatistics.

private void addStatistics(Vm model, org.ovirt.engine.core.common.businessentities.VM entity) {
    model.setStatistics(new Statistics());
    VmStatisticalQuery query = new VmStatisticalQuery(newModel(model.getId()));
    List<Statistic> statistics = query.getStatistics(entity);
    for (Statistic statistic : statistics) {
        LinkHelper.addLinks(statistic, query.getParentType());
    }
    model.getStatistics().getStatistics().addAll(statistics);
}
Also used : Statistic(org.ovirt.engine.api.model.Statistic) Statistics(org.ovirt.engine.api.model.Statistics)

Example 14 with Statistic

use of org.ovirt.engine.api.model.Statistic in project ovirt-engine by oVirt.

the class StepStatisticalQuery method getStatistics.

@Override
public List<Statistic> getStatistics(GlusterVolumeTaskStatusEntity entity) {
    List<Statistic> list = new ArrayList<>();
    if (entity == null) {
        return list;
    }
    for (GlusterVolumeTaskStatusForHost hostStatus : entity.getHostwiseStatusDetails()) {
        Guid hostId = hostStatus.getHostId();
        list.add(adopt(setHostDatum(FILES_MOVED, hostStatus.getFilesMoved(), hostId)));
        list.add(adopt(setHostDatum(SIZE_MOVED, hostStatus.getTotalSizeMoved(), hostId)));
        list.add(adopt(setHostDatum(FILES_SKIPPED, hostStatus.getFilesSkipped(), hostId)));
        list.add(adopt(setHostDatum(FILES_SCANNED, hostStatus.getFilesScanned(), hostId)));
        list.add(adopt(setHostDatum(FILES_FAILED, hostStatus.getFilesFailed(), hostId)));
        list.add(adopt(setHostDatum(RUN_TIME, hostStatus.getRunTime(), hostId)));
        list.add(adopt(setHostDatum(STATUS, hostStatus.getStatus().toString(), hostId)));
    }
    return list;
}
Also used : Statistic(org.ovirt.engine.api.model.Statistic) GlusterVolumeTaskStatusForHost(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid)

Example 15 with Statistic

use of org.ovirt.engine.api.model.Statistic in project ovirt-engine by oVirt.

the class StepStatisticalQuery method setHostDatum.

private Statistic setHostDatum(Statistic stat, String value, Guid hostId) {
    Statistic statistic = setDatum(clone(stat), value);
    statistic.setHost(getHost(hostId));
    return statistic;
}
Also used : Statistic(org.ovirt.engine.api.model.Statistic)

Aggregations

Statistic (org.ovirt.engine.api.model.Statistic)27 Statistics (org.ovirt.engine.api.model.Statistics)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 Values (org.ovirt.engine.api.model.Values)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 BigDecimal (java.math.BigDecimal)1 MathContext (java.math.MathContext)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Host (org.ovirt.engine.api.model.Host)1 Value (org.ovirt.engine.api.model.Value)1 Vm (org.ovirt.engine.api.model.Vm)1 V3Statistic (org.ovirt.engine.api.v3.types.V3Statistic)1 V3Values (org.ovirt.engine.api.v3.types.V3Values)1 VdsStatistics (org.ovirt.engine.core.common.businessentities.VdsStatistics)1 GlusterVolumeTaskStatusForHost (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost)1 Guid (org.ovirt.engine.core.compat.Guid)1