Search in sources :

Example 1 with Statistics

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

the class BackendHostNicsResource method addStatistics.

private void addStatistics(HostNic model, VdsNetworkInterface entity) {
    model.setStatistics(new Statistics());
    HostNicStatisticalQuery query = new HostNicStatisticalQuery(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 2 with Statistics

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

the class GlusterVolumeProfileInfoMapper method mapProfileDetails.

private static void mapProfileDetails(List<StatsInfo> statsInfoList, EntityProfileDetail entityprofileDetail) {
    for (StatsInfo statsInfo : statsInfoList) {
        ProfileDetail profileDetail = new ProfileDetail();
        profileDetail.setProfileType(statsInfo.getProfileStatsType().name());
        profileDetail.setDuration(statsInfo.getDuration());
        profileDetail.setStatistics(new Statistics());
        profileDetail.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(TOTAL_READ), statsInfo.getTotalRead()));
        profileDetail.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(TOTAL_WRITE), statsInfo.getTotalWrite()));
        mapBlockStats(profileDetail, statsInfo);
        mapFopStats(profileDetail, statsInfo);
        entityprofileDetail.setProfileDetails(new ProfileDetails());
        entityprofileDetail.getProfileDetails().getProfileDetails().add(profileDetail);
    }
}
Also used : StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) BrickProfileDetail(org.ovirt.engine.api.model.BrickProfileDetail) NfsProfileDetail(org.ovirt.engine.api.model.NfsProfileDetail) ProfileDetail(org.ovirt.engine.api.model.ProfileDetail) EntityProfileDetail(org.ovirt.engine.api.model.EntityProfileDetail) BlockStatistics(org.ovirt.engine.api.model.BlockStatistics) Statistics(org.ovirt.engine.api.model.Statistics) FopStatistics(org.ovirt.engine.api.model.FopStatistics) BrickProfileDetails(org.ovirt.engine.api.model.BrickProfileDetails) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) NfsProfileDetails(org.ovirt.engine.api.model.NfsProfileDetails) ProfileDetails(org.ovirt.engine.api.model.ProfileDetails)

Example 3 with Statistics

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

the class GlusterVolumeProfileInfoMapper method mapBlockStats.

private static void mapBlockStats(ProfileDetail profileDetail, StatsInfo statsInfo) {
    for (BlockStats blockStat : statsInfo.getBlockStats()) {
        BlockStatistic bStat = new BlockStatistic();
        bStat.setStatistics(new Statistics());
        bStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(BLOCK_SIZE), blockStat.getSize()));
        bStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(BYTES_BLOCK_READ), blockStat.getBlockRead()));
        bStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(BYTES_BLOCK_WRITE), blockStat.getBlockWrite()));
        profileDetail.setBlockStatistics(new BlockStatistics());
        profileDetail.getBlockStatistics().getBlockStatistics().add(bStat);
    }
}
Also used : BlockStatistic(org.ovirt.engine.api.model.BlockStatistic) BlockStats(org.ovirt.engine.core.common.businessentities.gluster.BlockStats) BlockStatistics(org.ovirt.engine.api.model.BlockStatistics) BlockStatistics(org.ovirt.engine.api.model.BlockStatistics) Statistics(org.ovirt.engine.api.model.Statistics) FopStatistics(org.ovirt.engine.api.model.FopStatistics)

Example 4 with Statistics

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

the class V3NumaNodeInAdapter method adapt.

@Override
public NumaNode adapt(V3NumaNode from) {
    NumaNode to = new NumaNode();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCpu()) {
        to.setCpu(adaptIn(from.getCpu()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetIndex()) {
        to.setIndex(from.getIndex());
    }
    if (from.isSetMemory()) {
        to.setMemory(from.getMemory());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNodeDistance()) {
        to.setNodeDistance(from.getNodeDistance());
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    return to;
}
Also used : NumaNode(org.ovirt.engine.api.model.NumaNode) V3NumaNode(org.ovirt.engine.api.v3.types.V3NumaNode) Statistics(org.ovirt.engine.api.model.Statistics)

Example 5 with Statistics

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

the class V3NICInAdapter method adapt.

@Override
public Nic adapt(V3NIC from) {
    Nic to = new Nic();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBootProtocol()) {
        to.setBootProtocol(BootProtocol.fromValue(from.getBootProtocol()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptIn(from.getInstanceType()));
    }
    if (from.isSetInterface()) {
        to.setInterface(NicInterface.fromValue(from.getInterface()));
    }
    if (from.isSetLinked()) {
        to.setLinked(from.isLinked());
    }
    if (from.isSetMac()) {
        to.setMac(adaptIn(from.getMac()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNetwork()) {
        to.setNetwork(adaptIn(from.getNetwork()));
    }
    if (from.isSetOnBoot()) {
        to.setOnBoot(from.isOnBoot());
    }
    if (from.isSetPlugged()) {
        to.setPlugged(from.isPlugged());
    }
    if (from.isSetReportedDevices()) {
        to.setReportedDevices(new ReportedDevices());
        to.getReportedDevices().getReportedDevices().addAll(adaptIn(from.getReportedDevices().getReportedDevices()));
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new Vms());
        to.getVms().getVms().addAll(adaptIn(from.getVms().getVMs()));
    }
    if (from.isSetVnicProfile()) {
        to.setVnicProfile(adaptIn(from.getVnicProfile()));
    }
    // In V3 the "active" property used to be a synonym of "plugged":
    if (from.isSetActive() && to.isSetPlugged()) {
        to.setPlugged(from.isActive());
    }
    return to;
}
Also used : Nic(org.ovirt.engine.api.model.Nic) ReportedDevices(org.ovirt.engine.api.model.ReportedDevices) Statistics(org.ovirt.engine.api.model.Statistics) Vms(org.ovirt.engine.api.model.Vms)

Aggregations

Statistics (org.ovirt.engine.api.model.Statistics)24 Statistic (org.ovirt.engine.api.model.Statistic)6 BlockStatistics (org.ovirt.engine.api.model.BlockStatistics)4 FopStatistics (org.ovirt.engine.api.model.FopStatistics)4 Vms (org.ovirt.engine.api.model.Vms)3 BlockStatistic (org.ovirt.engine.api.model.BlockStatistic)2 FopStatistic (org.ovirt.engine.api.model.FopStatistic)2 KatelloErrata (org.ovirt.engine.api.model.KatelloErrata)2 ProfileDetail (org.ovirt.engine.api.model.ProfileDetail)2 ReportedDevices (org.ovirt.engine.api.model.ReportedDevices)2 StorageDomains (org.ovirt.engine.api.model.StorageDomains)2 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)2 Test (org.junit.Test)1 BrickProfileDetail (org.ovirt.engine.api.model.BrickProfileDetail)1 BrickProfileDetails (org.ovirt.engine.api.model.BrickProfileDetails)1 Cdroms (org.ovirt.engine.api.model.Cdroms)1 CustomProperties (org.ovirt.engine.api.model.CustomProperties)1 Disk (org.ovirt.engine.api.model.Disk)1 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)1 DiskAttachments (org.ovirt.engine.api.model.DiskAttachments)1