use of org.ovirt.engine.api.v3.types.V3Statistics in project ovirt-engine by oVirt.
the class V3StatisticsOutAdapter method adapt.
@Override
public V3Statistics adapt(Statistics from) {
V3Statistics to = new V3Statistics();
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getStatistics().addAll(adaptOut(from.getStatistics()));
return to;
}
use of org.ovirt.engine.api.v3.types.V3Statistics in project ovirt-engine by oVirt.
the class V3DiskSnapshotOutAdapter method adapt.
@Override
public V3DiskSnapshot adapt(DiskSnapshot from) {
V3DiskSnapshot to = new V3DiskSnapshot();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
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.isSetDisk()) {
to.setDisk(adaptOut(from.getDisk()));
}
if (from.isSetDiskProfile()) {
to.setDiskProfile(adaptOut(from.getDiskProfile()));
}
if (from.isSetFormat()) {
to.setFormat(from.getFormat().value());
}
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(adaptOut(from.getInstanceType()));
}
if (from.isSetLogicalName()) {
to.setLogicalName(from.getLogicalName());
}
if (from.isSetLunStorage()) {
to.setLunStorage(adaptOut(from.getLunStorage()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOpenstackVolumeType()) {
to.setOpenstackVolumeType(adaptOut(from.getOpenstackVolumeType()));
}
if (from.isSetPropagateErrors()) {
to.setPropagateErrors(from.isPropagateErrors());
}
if (from.isSetProvisionedSize()) {
to.setProvisionedSize(from.getProvisionedSize());
}
if (from.isSetQuota()) {
to.setQuota(adaptOut(from.getQuota()));
}
if (from.isSetReadOnly()) {
to.setReadOnly(from.isReadOnly());
}
if (from.isSetSgio()) {
to.setSgio(from.getSgio().value());
}
if (from.isSetShareable()) {
to.setShareable(from.isShareable());
}
if (from.isSetSnapshot()) {
to.setSnapshot(adaptOut(from.getSnapshot()));
}
if (from.isSetSparse()) {
to.setSparse(from.isSparse());
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetStatus()) {
V3Status status = new V3Status();
status.setState(from.getStatus().value());
to.setStatus(status);
}
if (from.isSetStorageDomain()) {
to.setStorageDomain(adaptOut(from.getStorageDomain()));
}
if (from.isSetStorageDomains()) {
to.setStorageDomains(new V3StorageDomains());
to.getStorageDomains().getStorageDomains().addAll(adaptOut(from.getStorageDomains().getStorageDomains()));
}
if (from.isSetStorageType()) {
to.setStorageType(from.getStorageType().value());
}
if (from.isSetTemplate()) {
to.setTemplate(adaptOut(from.getTemplate()));
}
if (from.isSetUsesScsiReservation()) {
to.setUsesScsiReservation(from.isUsesScsiReservation());
}
if (from.isSetVm()) {
to.setVm(adaptOut(from.getVm()));
}
if (from.isSetVms()) {
to.setVms(new V3VMs());
to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
}
if (from.isSetWipeAfterDelete()) {
to.setWipeAfterDelete(from.isWipeAfterDelete());
}
// continue supporting it. To do so we need to find the disk attachment and copy this attribute to the disk.
if (to.isSetId() && to.isSetVm() && to.getVm().isSetId()) {
String diskId = to.getId();
String vmId = to.getVm().getId();
VmsResource vmsResource = BackendApiResource.getInstance().getVmsResource();
VmResource vmResource = vmsResource.getVmResource(vmId);
DiskAttachmentsResource attachmentsResource = vmResource.getDiskAttachmentsResource();
DiskAttachmentResource attachmentResource = attachmentsResource.getAttachmentResource(diskId);
DiskAttachment attachment = attachmentResource.get();
if (attachment.isSetActive()) {
to.setActive(attachment.isActive());
}
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Statistics in project ovirt-engine by oVirt.
the class V3HostNicOutAdapter method adapt.
@Override
public V3HostNIC adapt(HostNic from) {
V3HostNIC to = new V3HostNIC();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
// In version 3 of the API the name of the network labels sub-collection was just "labels", but in version
// 4 of the API it has been renamed to "networklabels", so we need to adjust the links accordingly:
to.getLinks().stream().filter(this::isNetworksLabelsLink).forEach(this::fixNetworkLabelsLink);
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetBaseInterface()) {
to.setBaseInterface(from.getBaseInterface());
}
if (from.isSetBonding()) {
to.setBonding(adaptOut(from.getBonding()));
}
if (from.isSetBootProtocol()) {
to.setBootProtocol(from.getBootProtocol().value());
}
if (from.isSetBridged()) {
to.setBridged(from.isBridged());
}
if (from.isSetCheckConnectivity()) {
to.setCheckConnectivity(from.isCheckConnectivity());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetCustomConfiguration()) {
to.setCustomConfiguration(from.isCustomConfiguration());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetHost()) {
to.setHost(adaptOut(from.getHost()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetIp()) {
to.setIp(adaptOut(from.getIp()));
}
if (from.isSetNetworkLabels()) {
to.setLabels(new V3Labels());
to.getLabels().getLabels().addAll(adaptOut(from.getNetworkLabels().getNetworkLabels()));
}
if (from.isSetMac()) {
to.setMac(adaptOut(from.getMac()));
}
if (from.isSetMtu()) {
to.setMtu(from.getMtu());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNetwork()) {
to.setNetwork(adaptOut(from.getNetwork()));
}
if (from.isSetOverrideConfiguration()) {
to.setOverrideConfiguration(from.isOverrideConfiguration());
}
if (from.isSetPhysicalFunction()) {
to.setPhysicalFunction(adaptOut(from.getPhysicalFunction()));
}
if (from.isSetProperties()) {
to.setProperties(new V3Properties());
to.getProperties().getProperties().addAll(adaptOut(from.getProperties().getProperties()));
}
if (from.isSetQos()) {
to.setQos(adaptOut(from.getQos()));
}
if (from.isSetSpeed()) {
to.setSpeed(from.getSpeed());
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetStatus()) {
V3Status status = new V3Status();
status.setState(from.getStatus().value());
to.setStatus(status);
}
if (from.isSetVirtualFunctionsConfiguration()) {
to.setVirtualFunctionsConfiguration(adaptOut(from.getVirtualFunctionsConfiguration()));
}
if (from.isSetVlan()) {
to.setVlan(adaptOut(from.getVlan()));
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Statistics in project ovirt-engine by oVirt.
the class V3HostOutAdapter method adapt.
@Override
public V3Host adapt(Host from) {
V3Host to = new V3Host();
// Remove the links for "rels" that are new in version 4 of the API:
if (from.isSetLinks()) {
List<Link> links = from.getLinks().stream().filter(link -> !RELS_TO_REMOVE.contains(link.getRel())).collect(toList());
to.getLinks().addAll(adaptOut(links));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetAddress()) {
to.setAddress(from.getAddress());
}
if (from.isSetAutoNumaStatus()) {
to.setAutoNumaStatus(from.getAutoNumaStatus().value());
}
if (from.isSetCertificate()) {
to.setCertificate(adaptOut(from.getCertificate()));
}
if (from.isSetCluster()) {
to.setCluster(adaptOut(from.getCluster()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetCpu()) {
to.setCpu(adaptOut(from.getCpu()));
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDevicePassthrough()) {
to.setDevicePassthrough(adaptOut(from.getDevicePassthrough()));
}
if (from.isSetDisplay()) {
to.setDisplay(adaptOut(from.getDisplay()));
}
if (from.isSetExternalHostProvider()) {
to.setExternalHostProvider(adaptOut(from.getExternalHostProvider()));
}
if (from.isSetExternalStatus()) {
V3Status status = new V3Status();
status.setState(from.getExternalStatus().value());
to.setExternalStatus(status);
}
if (from.isSetHardwareInformation()) {
to.setHardwareInformation(adaptOut(from.getHardwareInformation()));
}
if (from.isSetHooks()) {
to.setHooks(new V3Hooks());
to.getHooks().getHooks().addAll(adaptOut(from.getHooks().getHooks()));
}
if (from.isSetHostedEngine()) {
to.setHostedEngine(adaptOut(from.getHostedEngine()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetIscsi()) {
to.setIscsi(adaptOut(from.getIscsi()));
}
if (from.isSetKatelloErrata()) {
to.setKatelloErrata(new V3KatelloErrata());
to.getKatelloErrata().getKatelloErrata().addAll(adaptOut(from.getKatelloErrata().getKatelloErrata()));
}
if (from.isSetKdumpStatus()) {
to.setKdumpStatus(from.getKdumpStatus().value());
}
if (from.isSetKsm()) {
to.setKsm(adaptOut(from.getKsm()));
}
if (from.isSetLibvirtVersion()) {
to.setLibvirtVersion(adaptOut(from.getLibvirtVersion()));
}
// All hosts support live snapshots now
to.setLiveSnapshotSupport(true);
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(adaptOut(from.getOs()));
}
if (from.isSetOverrideIptables()) {
to.setOverrideIptables(from.isOverrideIptables());
}
if (from.isSetPort()) {
to.setPort(from.getPort());
}
if (from.isSetPowerManagement()) {
to.setPowerManagement(adaptOut(from.getPowerManagement()));
}
if (from.isSetProtocol()) {
to.setProtocol(from.getProtocol().value());
}
if (from.isSetRootPassword()) {
to.setRootPassword(from.getRootPassword());
}
if (from.isSetSeLinux()) {
to.setSelinux(adaptOut(from.getSeLinux()));
}
Spm spm = from.getSpm();
if (spm != null) {
// This is for the old and deprecated "storage_manager" element:
V3StorageManager storageManager = new V3StorageManager();
SpmStatus status = spm.getStatus();
if (status != null) {
storageManager.setValue(status == SpmStatus.SPM);
}
if (spm.isSetPriority()) {
storageManager.setPriority(spm.getPriority());
}
to.setStorageManager(storageManager);
// This is for the new and recommended "spm" element (the order here isn't relevant, as we are populating
// both output elements):
to.setSpm(adaptOut(spm));
}
if (from.isSetSsh()) {
to.setSsh(adaptOut(from.getSsh()));
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetStatus()) {
V3Status status = to.getStatus();
if (status == null) {
status = new V3Status();
to.setStatus(status);
}
status.setState(from.getStatus().value());
}
if (from.isSetStatusDetail()) {
V3Status status = to.getStatus();
if (status == null) {
status = new V3Status();
to.setStatus(status);
}
status.setDetail(from.getStatusDetail());
}
if (from.isSetStorageConnectionExtensions()) {
to.setStorageConnectionExtensions(new V3StorageConnectionExtensions());
to.getStorageConnectionExtensions().getStorageConnectionExtension().addAll(adaptOut(from.getStorageConnectionExtensions().getStorageConnectionExtensions()));
}
if (from.isSetSummary()) {
to.setSummary(adaptOut(from.getSummary()));
}
if (from.isSetTransparentHugepages()) {
to.setTransparentHugepages(adaptOut(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 preserve that for backwards compatibility:
HostType fromType = from.getType();
String toType = fromType == HostType.RHEV_H ? "rhev-h" : fromType.value();
to.setType(toType);
}
if (from.isSetUpdateAvailable()) {
to.setUpdateAvailable(from.isUpdateAvailable());
}
if (from.isSetVersion()) {
to.setVersion(adaptOut(from.getVersion()));
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Statistics in project ovirt-engine by oVirt.
the class V3SnapshotOutAdapter method adapt.
@Override
public V3Snapshot adapt(Snapshot from) {
V3Snapshot to = new V3Snapshot();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetBios()) {
to.setBios(adaptOut(from.getBios()));
}
if (from.isSetCdroms()) {
to.setCdroms(new V3CdRoms());
to.getCdroms().getCdRoms().addAll(adaptOut(from.getCdroms().getCdroms()));
}
if (from.isSetCluster()) {
to.setCluster(adaptOut(from.getCluster()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetConsole()) {
to.setConsole(adaptOut(from.getConsole()));
}
if (from.isSetCpu()) {
to.setCpu(adaptOut(from.getCpu()));
}
if (from.isSetCpuProfile()) {
to.setCpuProfile(adaptOut(from.getCpuProfile()));
}
if (from.isSetCpuShares()) {
to.setCpuShares(from.getCpuShares());
}
if (from.isSetCreationTime()) {
to.setCreationTime(from.getCreationTime());
}
if (from.isSetCustomCpuModel()) {
to.setCustomCpuModel(from.getCustomCpuModel());
}
if (from.isSetCustomEmulatedMachine()) {
to.setCustomEmulatedMachine(from.getCustomEmulatedMachine());
}
if (from.isSetCustomProperties()) {
to.setCustomProperties(new V3CustomProperties());
to.getCustomProperties().getCustomProperty().addAll(adaptOut(from.getCustomProperties().getCustomProperties()));
}
if (from.isSetDate()) {
to.setDate(from.getDate());
}
if (from.isSetDeleteProtected()) {
to.setDeleteProtected(from.isDeleteProtected());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDiskAttachments()) {
V3Disks toDisks = new V3Disks();
for (DiskAttachment fromDiskAttachment : from.getDiskAttachments().getDiskAttachments()) {
Disk fromDisk = fromDiskAttachment.getDisk();
if (fromDisk != null) {
V3Disk toDisk = adaptOut(fromDisk);
toDisks.getDisks().add(toDisk);
}
}
to.setDisks(toDisks);
}
if (from.isSetDisplay()) {
to.setDisplay(adaptOut(from.getDisplay()));
}
if (from.isSetDomain()) {
to.setDomain(adaptOut(from.getDomain()));
}
if (from.isSetExternalHostProvider()) {
to.setExternalHostProvider(adaptOut(from.getExternalHostProvider()));
}
if (from.isSetFloppies()) {
to.setFloppies(new V3Floppies());
to.getFloppies().getFloppies().addAll(adaptOut(from.getFloppies().getFloppies()));
}
if (from.isSetGuestOperatingSystem()) {
to.setGuestOperatingSystem(adaptOut(from.getGuestOperatingSystem()));
}
if (from.isSetGuestTimeZone()) {
to.setGuestTimeZone(adaptOut(from.getGuestTimeZone()));
}
if (from.isSetHighAvailability()) {
to.setHighAvailability(adaptOut(from.getHighAvailability()));
}
if (from.isSetHost()) {
to.setHost(adaptOut(from.getHost()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetInitialization()) {
to.setInitialization(adaptOut(from.getInitialization()));
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptOut(from.getInstanceType()));
}
if (from.isSetIo()) {
to.setIo(adaptOut(from.getIo()));
}
if (from.isSetKatelloErrata()) {
to.setKatelloErrata(new V3KatelloErrata());
to.getKatelloErrata().getKatelloErrata().addAll(adaptOut(from.getKatelloErrata().getKatelloErrata()));
}
if (from.isSetLargeIcon()) {
to.setLargeIcon(adaptOut(from.getLargeIcon()));
}
if (from.isSetMemory()) {
to.setMemory(from.getMemory());
}
if (from.isSetMemoryPolicy()) {
to.setMemoryPolicy(adaptOut(from.getMemoryPolicy()));
}
if (from.isSetMigration()) {
to.setMigration(adaptOut(from.getMigration()));
}
if (from.isSetMigrationDowntime()) {
to.setMigrationDowntime(from.getMigrationDowntime());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNextRunConfigurationExists()) {
to.setNextRunConfigurationExists(from.isNextRunConfigurationExists());
}
if (from.isSetNics()) {
to.setNics(new V3Nics());
to.getNics().getNics().addAll(adaptOut(from.getNics().getNics()));
}
if (from.isSetNumaTuneMode()) {
to.setNumaTuneMode(from.getNumaTuneMode().value());
}
if (from.isSetOrigin()) {
to.setOrigin(from.getOrigin());
}
if (from.isSetOs()) {
to.setOs(adaptOut(from.getOs()));
}
if (from.isSetPayloads()) {
to.setPayloads(new V3Payloads());
to.getPayloads().getPayload().addAll(adaptOut(from.getPayloads().getPayloads()));
}
if (from.isSetPermissions()) {
to.setPermissions(new V3Permissions());
to.getPermissions().getPermissions().addAll(adaptOut(from.getPermissions().getPermissions()));
}
if (from.isSetPersistMemorystate()) {
to.setPersistMemorystate(from.isPersistMemorystate());
}
if (from.isSetPlacementPolicy()) {
to.setPlacementPolicy(adaptOut(from.getPlacementPolicy()));
}
if (from.isSetQuota()) {
to.setQuota(adaptOut(from.getQuota()));
}
if (from.isSetReportedDevices()) {
to.setReportedDevices(new V3ReportedDevices());
to.getReportedDevices().getReportedDevices().addAll(adaptOut(from.getReportedDevices().getReportedDevices()));
}
if (from.isSetRngDevice()) {
to.setRngDevice(adaptOut(from.getRngDevice()));
}
if (from.isSetRunOnce()) {
to.setRunOnce(from.isRunOnce());
}
if (from.isSetSerialNumber()) {
to.setSerialNumber(adaptOut(from.getSerialNumber()));
}
if (from.isSetSmallIcon()) {
to.setSmallIcon(adaptOut(from.getSmallIcon()));
}
if (from.isSetSnapshotStatus()) {
to.setSnapshotStatus(from.getSnapshotStatus().value());
}
if (from.isSetSnapshots()) {
to.setSnapshots(new V3Snapshots());
to.getSnapshots().getSnapshots().addAll(adaptOut(from.getSnapshots().getSnapshots()));
}
if (from.isSetSoundcardEnabled()) {
to.setSoundcardEnabled(from.isSoundcardEnabled());
}
if (from.isSetSso()) {
to.setSso(adaptOut(from.getSso()));
}
if (from.isSetStartPaused()) {
to.setStartPaused(from.isStartPaused());
}
if (from.isSetStartTime()) {
to.setStartTime(from.getStartTime());
}
if (from.isSetStateless()) {
to.setStateless(from.isStateless());
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetStatus()) {
V3Status status = new V3Status();
status.setState(from.getStatus().value());
to.setStatus(status);
}
if (from.isSetStopReason()) {
to.setStopReason(from.getStopReason());
}
if (from.isSetStopTime()) {
to.setStopTime(from.getStopTime());
}
if (from.isSetStorageDomain()) {
to.setStorageDomain(adaptOut(from.getStorageDomain()));
}
if (from.isSetTags()) {
to.setTags(new V3Tags());
to.getTags().getTags().addAll(adaptOut(from.getTags().getTags()));
}
if (from.isSetTemplate()) {
to.setTemplate(adaptOut(from.getTemplate()));
}
if (from.isSetTimeZone()) {
to.setTimeZone(adaptOut(from.getTimeZone()));
}
if (from.isSetTunnelMigration()) {
to.setTunnelMigration(from.isTunnelMigration());
}
if (from.isSetSnapshotType()) {
to.setType(from.getSnapshotType().value());
}
if (from.isSetUsb()) {
to.setUsb(adaptOut(from.getUsb()));
}
if (from.isSetUseLatestTemplateVersion()) {
to.setUseLatestTemplateVersion(from.isUseLatestTemplateVersion());
}
if (from.isSetVirtioScsi()) {
to.setVirtioScsi(adaptOut(from.getVirtioScsi()));
}
if (from.isSetVm()) {
to.setVm(adaptOut(from.getVm()));
}
if (from.isSetVmPool()) {
to.setVmPool(adaptOut(from.getVmPool()));
}
if (from.isSetWatchdogs()) {
to.setWatchdogs(new V3WatchDogs());
to.getWatchdogs().getWatchDogs().addAll(adaptOut(from.getWatchdogs().getWatchdogs()));
}
return to;
}
Aggregations