use of org.ovirt.engine.api.model.Statistics 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);
}
use of org.ovirt.engine.api.model.Statistics 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);
}
use of org.ovirt.engine.api.model.Statistics 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);
}
use of org.ovirt.engine.api.model.Statistics in project ovirt-engine by oVirt.
the class V3DiskInAdapter method adapt.
@Override
public Disk adapt(V3Disk from) {
Disk to = new Disk();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.isActive());
}
if (from.isSetActualSize()) {
to.setActualSize(from.getActualSize());
}
if (from.isSetAlias()) {
to.setAlias(from.getAlias());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDiskProfile()) {
to.setDiskProfile(adaptIn(from.getDiskProfile()));
}
if (from.isSetFormat()) {
to.setFormat(DiskFormat.fromValue(from.getFormat()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetImageId()) {
to.setImageId(from.getImageId());
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptIn(from.getInstanceType()));
}
if (from.isSetLogicalName()) {
to.setLogicalName(from.getLogicalName());
}
if (from.isSetLunStorage()) {
to.setLunStorage(adaptIn(from.getLunStorage()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOpenstackVolumeType()) {
to.setOpenstackVolumeType(adaptIn(from.getOpenstackVolumeType()));
}
if (from.isSetPropagateErrors()) {
to.setPropagateErrors(from.isPropagateErrors());
}
if (from.isSetProvisionedSize()) {
to.setProvisionedSize(from.getProvisionedSize());
}
if (from.isSetQuota()) {
to.setQuota(adaptIn(from.getQuota()));
}
if (from.isSetReadOnly()) {
to.setReadOnly(from.isReadOnly());
}
if (from.isSetSgio()) {
to.setSgio(ScsiGenericIO.fromValue(from.getSgio()));
}
if (from.isSetShareable()) {
to.setShareable(from.isShareable());
}
if (from.isSetSnapshot()) {
to.setSnapshot(adaptIn(from.getSnapshot()));
}
if (from.isSetSparse()) {
to.setSparse(from.isSparse());
}
if (from.isSetStatistics()) {
to.setStatistics(new Statistics());
to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
}
if (from.isSetStatus() && from.getStatus().isSetState()) {
to.setStatus(DiskStatus.fromValue(from.getStatus().getState()));
}
if (from.isSetStorageDomain()) {
to.setStorageDomain(adaptIn(from.getStorageDomain()));
}
if (from.isSetStorageDomains()) {
to.setStorageDomains(new StorageDomains());
to.getStorageDomains().getStorageDomains().addAll(adaptIn(from.getStorageDomains().getStorageDomains()));
}
if (from.isSetStorageType()) {
to.setStorageType(DiskStorageType.fromValue(from.getStorageType()));
}
if (from.isSetTemplate()) {
to.setTemplate(adaptIn(from.getTemplate()));
}
if (from.isSetUsesScsiReservation()) {
to.setUsesScsiReservation(from.isUsesScsiReservation());
}
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.isSetWipeAfterDelete()) {
to.setWipeAfterDelete(from.isWipeAfterDelete());
}
if (from.isSetBootable()) {
to.setBootable(from.isBootable());
}
if (from.isSetInterface()) {
to.setInterface(DiskInterface.fromValue(from.getInterface()));
}
// In V3 "size" used to be a synonym of "provisioned_size":
if (from.isSetSize() && !to.isSetProvisionedSize()) {
to.setProvisionedSize(from.getSize());
}
return to;
}
use of org.ovirt.engine.api.model.Statistics in project ovirt-engine by oVirt.
the class V3HostInAdapter method adapt.
@Override
public Host adapt(V3Host from) {
Host to = new Host();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetAddress()) {
to.setAddress(from.getAddress());
}
if (from.isSetAutoNumaStatus()) {
to.setAutoNumaStatus(AutoNumaStatus.fromValue(from.getAutoNumaStatus()));
}
if (from.isSetCertificate()) {
to.setCertificate(adaptIn(from.getCertificate()));
}
if (from.isSetCluster()) {
to.setCluster(adaptIn(from.getCluster()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetCpu()) {
to.setCpu(adaptIn(from.getCpu()));
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDevicePassthrough()) {
to.setDevicePassthrough(adaptIn(from.getDevicePassthrough()));
}
if (from.isSetDisplay()) {
to.setDisplay(adaptIn(from.getDisplay()));
}
if (from.isSetExternalHostProvider()) {
to.setExternalHostProvider(adaptIn(from.getExternalHostProvider()));
}
if (from.isSetExternalStatus() && from.getExternalStatus().isSetState()) {
to.setExternalStatus(ExternalStatus.fromValue(from.getExternalStatus().getState()));
}
if (from.isSetHardwareInformation()) {
to.setHardwareInformation(adaptIn(from.getHardwareInformation()));
}
if (from.isSetHooks()) {
to.setHooks(new Hooks());
to.getHooks().getHooks().addAll(adaptIn(from.getHooks().getHooks()));
}
if (from.isSetHostedEngine()) {
to.setHostedEngine(adaptIn(from.getHostedEngine()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetIscsi()) {
to.setIscsi(adaptIn(from.getIscsi()));
}
if (from.isSetKatelloErrata()) {
to.setKatelloErrata(new KatelloErrata());
to.getKatelloErrata().getKatelloErrata().addAll(adaptIn(from.getKatelloErrata().getKatelloErrata()));
}
if (from.isSetKdumpStatus()) {
to.setKdumpStatus(KdumpStatus.fromValue(from.getKdumpStatus()));
}
if (from.isSetKsm()) {
to.setKsm(adaptIn(from.getKsm()));
}
if (from.isSetLibvirtVersion()) {
to.setLibvirtVersion(adaptIn(from.getLibvirtVersion()));
}
if (from.isSetMaxSchedulingMemory()) {
to.setMaxSchedulingMemory(from.getMaxSchedulingMemory());
}
if (from.isSetMemory()) {
to.setMemory(from.getMemory());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNumaSupported()) {
to.setNumaSupported(from.isNumaSupported());
}
if (from.isSetOs()) {
to.setOs(adaptIn(from.getOs()));
}
if (from.isSetOverrideIptables()) {
to.setOverrideIptables(from.isOverrideIptables());
}
if (from.isSetPort()) {
to.setPort(from.getPort());
}
if (from.isSetPowerManagement()) {
to.setPowerManagement(adaptIn(from.getPowerManagement()));
}
if (from.isSetRootPassword()) {
to.setRootPassword(from.getRootPassword());
}
if (from.isSetSelinux()) {
to.setSeLinux(adaptIn(from.getSelinux()));
}
// This is for the old and deprecated "storage_manager" element:
V3StorageManager storageManager = from.getStorageManager();
if (storageManager != null) {
Spm spm = new Spm();
Boolean value = storageManager.isValue();
if (value != null) {
spm.setStatus(value ? SpmStatus.SPM : SpmStatus.NONE);
}
Integer priority = spm.getPriority();
if (storageManager.getPriority() != null) {
spm.setPriority(priority);
}
to.setSpm(spm);
}
// element to override the old element when both are provided):
if (from.isSetSpm()) {
to.setSpm(adaptIn(from.getSpm()));
}
if (from.isSetSsh()) {
to.setSsh(adaptIn(from.getSsh()));
}
if (from.isSetStatistics()) {
to.setStatistics(new Statistics());
to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
}
V3Status status = from.getStatus();
if (status != null) {
if (status.isSetState()) {
to.setStatus(HostStatus.fromValue(status.getState()));
}
if (status.isSetDetail()) {
to.setStatusDetail(status.getDetail());
}
}
if (from.isSetStorageConnectionExtensions()) {
to.setStorageConnectionExtensions(new StorageConnectionExtensions());
to.getStorageConnectionExtensions().getStorageConnectionExtensions().addAll(adaptIn(from.getStorageConnectionExtensions().getStorageConnectionExtension()));
}
if (from.isSetSummary()) {
to.setSummary(adaptIn(from.getSummary()));
}
if (from.isSetTransparentHugepages()) {
to.setTransparentHugepages(adaptIn(from.getTransparentHugepages()));
}
if (from.isSetType()) {
// In version 3 of the API the string for the RHEV_H value was "rhev-h", with a dash instead of an
// underscore, and we need to accept that for backwards compatibility:
String fromType = from.getType();
HostType toType = fromType.equalsIgnoreCase("rhev-h") ? HostType.RHEV_H : HostType.fromValue(fromType);
to.setType(toType);
}
if (from.isSetUpdateAvailable()) {
to.setUpdateAvailable(from.isUpdateAvailable());
}
if (from.isSetVersion()) {
to.setVersion(adaptIn(from.getVersion()));
}
return to;
}
Aggregations