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