Search in sources :

Example 1 with V3Status

use of org.ovirt.engine.api.v3.types.V3Status in project ovirt-engine by oVirt.

the class V3ActionOutAdapter method adapt.

@Override
public V3Action adapt(Action from) {
    V3Action to = new V3Action();
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetAsync()) {
        to.setAsync(from.isAsync());
    }
    if (from.isSetBricks()) {
        to.setBricks(adaptOut(from.getBricks()));
    }
    if (from.isSetCertificates()) {
        to.setCertificates(adaptOut(from.getCertificates()));
    }
    if (from.isSetCheckConnectivity()) {
        to.setCheckConnectivity(from.isCheckConnectivity());
    }
    if (from.isSetClone()) {
        to.setClone(from.isClone());
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptOut(from.getCluster()));
    }
    if (from.isSetConnectivityTimeout()) {
        to.setConnectivityTimeout(from.getConnectivityTimeout());
    }
    if (from.isSetDiscardSnapshots()) {
        to.setDiscardSnapshots(from.isDiscardSnapshots());
    }
    if (from.isSetDisk()) {
        to.setDisk(adaptOut(from.getDisk()));
    }
    if (from.isSetDisks()) {
        to.setDisks(adaptOut(from.getDisks()));
    }
    if (from.isSetExclusive()) {
        to.setExclusive(from.isExclusive());
    }
    if (from.isSetFault()) {
        to.setFault(adaptOut(from.getFault()));
    }
    if (from.isSetFenceType()) {
        to.setFenceType(from.getFenceType());
    }
    if (from.isSetFixLayout()) {
        to.setFixLayout(from.isFixLayout());
    }
    if (from.isSetForce()) {
        to.setForce(from.isForce());
    }
    if (from.isSetGracePeriod()) {
        to.setGracePeriod(adaptOut(from.getGracePeriod()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptOut(from.getHost()));
    }
    if (from.isSetImage()) {
        to.setImage(from.getImage());
    }
    if (from.isSetImportAsTemplate()) {
        to.setImportAsTemplate(from.isImportAsTemplate());
    }
    if (from.isSetIsAttached()) {
        to.setIsAttached(from.isIsAttached());
    }
    if (from.isSetIscsi()) {
        to.setIscsi(adaptOut(from.getIscsi()));
    }
    if (from.isSetIscsiTargets()) {
        to.getIscsiTargets().addAll(from.getIscsiTargets().getIscsiTargets());
    }
    if (from.isSetJob()) {
        to.setJob(adaptOut(from.getJob()));
    }
    if (from.isSetLogicalUnits()) {
        to.setLogicalUnits(adaptOut(from.getLogicalUnits()));
    }
    if (from.isSetMaintenanceEnabled()) {
        to.setMaintenanceEnabled(from.isMaintenanceEnabled());
    }
    if (from.isSetModifiedBonds()) {
        to.setModifiedBonds(adaptOut(from.getModifiedBonds()));
    }
    if (from.isSetModifiedLabels()) {
        to.setModifiedLabels(adaptOut(from.getModifiedLabels()));
    }
    if (from.isSetModifiedNetworkAttachments()) {
        to.setModifiedNetworkAttachments(adaptOut(from.getModifiedNetworkAttachments()));
    }
    if (from.isSetOption()) {
        to.setOption(adaptOut(from.getOption()));
    }
    if (from.isSetPause()) {
        to.setPause(from.isPause());
    }
    if (from.isSetPowerManagement()) {
        to.setPowerManagement(adaptOut(from.getPowerManagement()));
    }
    if (from.isSetProxyTicket()) {
        to.setProxyTicket(adaptOut(from.getProxyTicket()));
    }
    if (from.isSetReason()) {
        to.setReason(from.getReason());
    }
    if (from.isSetRemovedBonds()) {
        to.setRemovedBonds(adaptOut(from.getRemovedBonds()));
    }
    if (from.isSetRemovedLabels()) {
        to.setRemovedLabels(adaptOut(from.getRemovedLabels()));
    }
    if (from.isSetRemovedNetworkAttachments()) {
        to.setRemovedNetworkAttachments(adaptOut(from.getRemovedNetworkAttachments()));
    }
    if (from.isSetResolutionType()) {
        to.setResolutionType(from.getResolutionType());
    }
    if (from.isSetRestoreMemory()) {
        to.setRestoreMemory(from.isRestoreMemory());
    }
    if (from.isSetRootPassword()) {
        to.setRootPassword(from.getRootPassword());
    }
    if (from.isSetSnapshot()) {
        to.setSnapshot(adaptOut(from.getSnapshot()));
    }
    if (from.isSetSsh()) {
        to.setSsh(adaptOut(from.getSsh()));
    }
    if (from.isSetStatus()) {
        V3Status status = new V3Status();
        status.setState(from.getStatus());
        to.setStatus(status);
    }
    if (from.isSetStorageDomain()) {
        to.setStorageDomain(adaptOut(from.getStorageDomain()));
    }
    if (from.isSetStorageDomains()) {
        to.setStorageDomains(adaptOut(from.getStorageDomains()));
    }
    if (from.isSetSucceeded()) {
        to.setSucceeded(from.isSucceeded());
    }
    if (from.isSetSynchronizedNetworkAttachments()) {
        to.setSynchronizedNetworkAttachments(adaptOut(from.getSynchronizedNetworkAttachments()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptOut(from.getTemplate()));
    }
    if (from.isSetTicket()) {
        to.setTicket(adaptOut(from.getTicket()));
    }
    if (from.isSetUseCloudInit()) {
        to.setUseCloudInit(from.isUseCloudInit());
    }
    if (from.isSetUseSysprep()) {
        to.setUseSysprep(from.isUseSysprep());
    }
    if (from.isSetVirtualFunctionsConfiguration()) {
        to.setVirtualFunctionsConfiguration(adaptOut(from.getVirtualFunctionsConfiguration()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptOut(from.getVm()));
    }
    return to;
}
Also used : V3Action(org.ovirt.engine.api.v3.types.V3Action) V3Status(org.ovirt.engine.api.v3.types.V3Status)

Example 2 with V3Status

use of org.ovirt.engine.api.v3.types.V3Status in project ovirt-engine by oVirt.

the class V3GlusterHookOutAdapter method adapt.

@Override
public V3GlusterHook adapt(GlusterHook from) {
    V3GlusterHook to = new V3GlusterHook();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetChecksum()) {
        to.setChecksum(from.getChecksum());
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptOut(from.getCluster()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetConflictStatus()) {
        to.setConflictStatus(from.getConflictStatus());
    }
    if (from.isSetConflicts()) {
        to.setConflicts(from.getConflicts());
    }
    if (from.isSetContent()) {
        to.setContent(from.getContent());
    }
    if (from.isSetContentType()) {
        to.setContentType(from.getContentType().value());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetGlusterCommand()) {
        to.setGlusterCommand(from.getGlusterCommand());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetServerHooks()) {
        to.setServerHooks(new V3GlusterServerHooks());
        to.getServerHooks().getGlusterServerHooks().addAll(adaptOut(from.getServerHooks().getGlusterServerHooks()));
    }
    if (from.isSetStage()) {
        to.setStage(from.getStage().value());
    }
    if (from.isSetStatus()) {
        V3Status status = new V3Status();
        status.setState(from.getStatus().value());
        to.setStatus(status);
    }
    return to;
}
Also used : V3GlusterHook(org.ovirt.engine.api.v3.types.V3GlusterHook) V3Status(org.ovirt.engine.api.v3.types.V3Status) V3GlusterServerHooks(org.ovirt.engine.api.v3.types.V3GlusterServerHooks)

Example 3 with V3Status

use of org.ovirt.engine.api.v3.types.V3Status in project ovirt-engine by oVirt.

the class V3VMInAdapter method adapt.

@Override
public Vm adapt(V3VM from) {
    Vm to = new Vm();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBios()) {
        to.setBios(adaptIn(from.getBios()));
    }
    if (from.isSetCdroms()) {
        to.setCdroms(adaptIn(from.getCdroms()));
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptIn(from.getCluster()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetConsole()) {
        to.setConsole(adaptIn(from.getConsole()));
    }
    if (from.isSetCpu()) {
        to.setCpu(adaptIn(from.getCpu()));
    }
    if (from.isSetCpuProfile()) {
        to.setCpuProfile(adaptIn(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(adaptIn(from.getCustomProperties()));
    }
    if (from.isSetDeleteProtected()) {
        to.setDeleteProtected(from.isDeleteProtected());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisks()) {
        DiskAttachments toAttachments = new DiskAttachments();
        for (V3Disk fromDisk : from.getDisks().getDisks()) {
            DiskAttachment toAttachment = new DiskAttachment();
            toAttachment.setDisk(adaptIn(fromDisk));
            toAttachments.getDiskAttachments().add(toAttachment);
        }
        to.setDiskAttachments(toAttachments);
    }
    if (from.isSetDisplay()) {
        to.setDisplay(adaptIn(from.getDisplay()));
    }
    if (from.isSetDomain()) {
        to.setDomain(adaptIn(from.getDomain()));
    }
    if (from.isSetExternalHostProvider()) {
        to.setExternalHostProvider(adaptIn(from.getExternalHostProvider()));
    }
    if (from.isSetFloppies()) {
        to.setFloppies(adaptIn(from.getFloppies()));
    }
    if (from.isSetGuestOperatingSystem()) {
        to.setGuestOperatingSystem(adaptIn(from.getGuestOperatingSystem()));
    }
    if (from.isSetGuestTimeZone()) {
        to.setGuestTimeZone(adaptIn(from.getGuestTimeZone()));
    }
    if (from.isSetHighAvailability()) {
        to.setHighAvailability(adaptIn(from.getHighAvailability()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInitialization()) {
        to.setInitialization(adaptIn(from.getInitialization()));
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptIn(from.getInstanceType()));
    }
    if (from.isSetIo()) {
        to.setIo(adaptIn(from.getIo()));
    }
    if (from.isSetKatelloErrata()) {
        to.setKatelloErrata(adaptIn(from.getKatelloErrata()));
    }
    if (from.isSetLargeIcon()) {
        to.setLargeIcon(adaptIn(from.getLargeIcon()));
    }
    if (from.isSetMemory()) {
        to.setMemory(from.getMemory());
    }
    if (from.isSetMemoryPolicy()) {
        to.setMemoryPolicy(adaptIn(from.getMemoryPolicy()));
    }
    if (from.isSetMigration()) {
        to.setMigration(adaptIn(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(adaptIn(from.getNics()));
    }
    if (from.isSetNumaTuneMode()) {
        to.setNumaTuneMode(NumaTuneMode.fromValue(from.getNumaTuneMode()));
    }
    if (from.isSetOrigin()) {
        to.setOrigin(from.getOrigin());
    }
    if (from.isSetOs()) {
        to.setOs(adaptIn(from.getOs()));
    }
    if (from.isSetPayloads()) {
        to.setPayloads(adaptIn(from.getPayloads()));
    }
    if (from.isSetPermissions()) {
        to.setPermissions(adaptIn(from.getPermissions()));
    }
    if (from.isSetPlacementPolicy()) {
        to.setPlacementPolicy(adaptIn(from.getPlacementPolicy()));
    }
    if (from.isSetQuota()) {
        to.setQuota(adaptIn(from.getQuota()));
    }
    if (from.isSetReportedDevices()) {
        to.setReportedDevices(adaptIn(from.getReportedDevices()));
    }
    if (from.isSetRngDevice()) {
        to.setRngDevice(adaptIn(from.getRngDevice()));
    }
    if (from.isSetRunOnce()) {
        to.setRunOnce(from.isRunOnce());
    }
    if (from.isSetSerialNumber()) {
        to.setSerialNumber(adaptIn(from.getSerialNumber()));
    }
    if (from.isSetSmallIcon()) {
        to.setSmallIcon(adaptIn(from.getSmallIcon()));
    }
    if (from.isSetSnapshots()) {
        to.setSnapshots(adaptIn(from.getSnapshots()));
    }
    if (from.isSetSoundcardEnabled()) {
        to.setSoundcardEnabled(from.isSoundcardEnabled());
    }
    if (from.isSetSso()) {
        to.setSso(adaptIn(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(adaptIn(from.getStatistics()));
    }
    V3Status status = from.getStatus();
    if (status != null) {
        if (status.isSetState()) {
            to.setStatus(VmStatus.fromValue(status.getState()));
        }
        if (status.isSetDetail()) {
            to.setStatusDetail(status.getDetail());
        }
    }
    if (from.isSetStopReason()) {
        to.setStopReason(from.getStopReason());
    }
    if (from.isSetStopTime()) {
        to.setStopTime(from.getStopTime());
    }
    if (from.isSetStorageDomain()) {
        to.setStorageDomain(adaptIn(from.getStorageDomain()));
    }
    if (from.isSetTags()) {
        to.setTags(adaptIn(from.getTags()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetTimeZone()) {
        to.setTimeZone(adaptIn(from.getTimeZone()));
    }
    if (from.isSetTunnelMigration()) {
        to.setTunnelMigration(from.isTunnelMigration());
    }
    if (from.isSetType()) {
        to.setType(VmType.fromValue(from.getType()));
    }
    if (from.isSetUsb()) {
        to.setUsb(adaptIn(from.getUsb()));
    }
    if (from.isSetUseLatestTemplateVersion()) {
        to.setUseLatestTemplateVersion(from.isUseLatestTemplateVersion());
    }
    if (from.isSetVirtioScsi()) {
        to.setVirtioScsi(adaptIn(from.getVirtioScsi()));
    }
    if (from.isSetVmPool()) {
        to.setVmPool(adaptIn(from.getVmPool()));
    }
    if (from.isSetWatchdogs()) {
        to.setWatchdogs(adaptIn(from.getWatchdogs()));
    }
    // new structured "time_zone" element containing the name of the time zone and the UTC offset:
    if (from.isSetTimezone() && !to.isSetTimeZone()) {
        TimeZone timeZone = new TimeZone();
        timeZone.setName(from.getTimezone());
        to.setTimeZone(timeZone);
    }
    return to;
}
Also used : TimeZone(org.ovirt.engine.api.model.TimeZone) DiskAttachment(org.ovirt.engine.api.model.DiskAttachment) V3Disk(org.ovirt.engine.api.v3.types.V3Disk) Vm(org.ovirt.engine.api.model.Vm) DiskAttachments(org.ovirt.engine.api.model.DiskAttachments) V3Status(org.ovirt.engine.api.v3.types.V3Status)

Example 4 with V3Status

use of org.ovirt.engine.api.v3.types.V3Status 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;
}
Also used : VmResource(org.ovirt.engine.api.resource.VmResource) DiskAttachmentsResource(org.ovirt.engine.api.resource.DiskAttachmentsResource) DiskAttachmentResource(org.ovirt.engine.api.resource.DiskAttachmentResource) DiskAttachment(org.ovirt.engine.api.model.DiskAttachment) VmsResource(org.ovirt.engine.api.resource.VmsResource) V3DiskSnapshot(org.ovirt.engine.api.v3.types.V3DiskSnapshot) V3Status(org.ovirt.engine.api.v3.types.V3Status) V3Statistics(org.ovirt.engine.api.v3.types.V3Statistics) V3VMs(org.ovirt.engine.api.v3.types.V3VMs) V3StorageDomains(org.ovirt.engine.api.v3.types.V3StorageDomains)

Example 5 with V3Status

use of org.ovirt.engine.api.v3.types.V3Status 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;
}
Also used : Spm(org.ovirt.engine.api.model.Spm) HostType(org.ovirt.engine.api.model.HostType) KatelloErrata(org.ovirt.engine.api.model.KatelloErrata) Host(org.ovirt.engine.api.model.Host) V3Host(org.ovirt.engine.api.v3.types.V3Host) Hooks(org.ovirt.engine.api.model.Hooks) V3Status(org.ovirt.engine.api.v3.types.V3Status) StorageConnectionExtensions(org.ovirt.engine.api.model.StorageConnectionExtensions) Statistics(org.ovirt.engine.api.model.Statistics) V3StorageManager(org.ovirt.engine.api.v3.types.V3StorageManager)

Aggregations

V3Status (org.ovirt.engine.api.v3.types.V3Status)23 V3Statistics (org.ovirt.engine.api.v3.types.V3Statistics)6 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)4 TimeZone (org.ovirt.engine.api.model.TimeZone)4 V3CustomProperties (org.ovirt.engine.api.v3.types.V3CustomProperties)4 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)4 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Collectors.toList (java.util.stream.Collectors.toList)3 Link (org.ovirt.engine.api.model.Link)3 V3Adapter (org.ovirt.engine.api.v3.V3Adapter)3 V3OutAdapters.adaptOut (org.ovirt.engine.api.v3.adapters.V3OutAdapters.adaptOut)3 V3KatelloErrata (org.ovirt.engine.api.v3.types.V3KatelloErrata)3 Disk (org.ovirt.engine.api.model.Disk)2 Host (org.ovirt.engine.api.model.Host)2 HostType (org.ovirt.engine.api.model.HostType)2 Spm (org.ovirt.engine.api.model.Spm)2 Vm (org.ovirt.engine.api.model.Vm)2 V3CdRoms (org.ovirt.engine.api.v3.types.V3CdRoms)2