Search in sources :

Example 6 with V3Disk

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

the class V3SnapshotInAdapter method adapt.

@Override
public Snapshot adapt(V3Snapshot from) {
    Snapshot to = new Snapshot();
    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(new Cdroms());
        to.getCdroms().getCdroms().addAll(adaptIn(from.getCdroms().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(new CustomProperties());
        to.getCustomProperties().getCustomProperties().addAll(adaptIn(from.getCustomProperties().getCustomProperty()));
    }
    if (from.isSetDate()) {
        to.setDate(from.getDate());
    }
    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(new Floppies());
        to.getFloppies().getFloppies().addAll(adaptIn(from.getFloppies().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(new KatelloErrata());
        to.getKatelloErrata().getKatelloErrata().addAll(adaptIn(from.getKatelloErrata().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(new Nics());
        to.getNics().getNics().addAll(adaptIn(from.getNics().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(new Payloads());
        to.getPayloads().getPayloads().addAll(adaptIn(from.getPayloads().getPayload()));
    }
    if (from.isSetPermissions()) {
        to.setPermissions(new Permissions());
        to.getPermissions().getPermissions().addAll(adaptIn(from.getPermissions().getPermissions()));
    }
    if (from.isSetPersistMemorystate()) {
        to.setPersistMemorystate(from.isPersistMemorystate());
    }
    if (from.isSetPlacementPolicy()) {
        to.setPlacementPolicy(adaptIn(from.getPlacementPolicy()));
    }
    if (from.isSetQuota()) {
        to.setQuota(adaptIn(from.getQuota()));
    }
    if (from.isSetReportedDevices()) {
        to.setReportedDevices(new ReportedDevices());
        to.getReportedDevices().getReportedDevices().addAll(adaptIn(from.getReportedDevices().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.isSetSnapshotStatus()) {
        to.setSnapshotStatus(SnapshotStatus.fromValue(from.getSnapshotStatus()));
    }
    if (from.isSetSnapshots()) {
        to.setSnapshots(new Snapshots());
        to.getSnapshots().getSnapshots().addAll(adaptIn(from.getSnapshots().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(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(VmStatus.fromValue(from.getStatus().getState()));
    }
    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(new Tags());
        to.getTags().getTags().addAll(adaptIn(from.getTags().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.setSnapshotType(SnapshotType.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.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    if (from.isSetVmPool()) {
        to.setVmPool(adaptIn(from.getVmPool()));
    }
    if (from.isSetWatchdogs()) {
        to.setWatchdogs(new Watchdogs());
        to.getWatchdogs().getWatchdogs().addAll(adaptIn(from.getWatchdogs().getWatchDogs()));
    }
    return to;
}
Also used : KatelloErrata(org.ovirt.engine.api.model.KatelloErrata) DiskAttachments(org.ovirt.engine.api.model.DiskAttachments) ReportedDevices(org.ovirt.engine.api.model.ReportedDevices) Statistics(org.ovirt.engine.api.model.Statistics) Nics(org.ovirt.engine.api.model.Nics) Cdroms(org.ovirt.engine.api.model.Cdroms) V3Snapshot(org.ovirt.engine.api.v3.types.V3Snapshot) Snapshot(org.ovirt.engine.api.model.Snapshot) DiskAttachment(org.ovirt.engine.api.model.DiskAttachment) V3Disk(org.ovirt.engine.api.v3.types.V3Disk) Floppies(org.ovirt.engine.api.model.Floppies) Permissions(org.ovirt.engine.api.model.Permissions) Watchdogs(org.ovirt.engine.api.model.Watchdogs) Snapshots(org.ovirt.engine.api.model.Snapshots) Tags(org.ovirt.engine.api.model.Tags) CustomProperties(org.ovirt.engine.api.model.CustomProperties) Payloads(org.ovirt.engine.api.model.Payloads)

Example 7 with V3Disk

use of org.ovirt.engine.api.v3.types.V3Disk 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;
}
Also used : V3Floppies(org.ovirt.engine.api.v3.types.V3Floppies) V3Tags(org.ovirt.engine.api.v3.types.V3Tags) V3Snapshot(org.ovirt.engine.api.v3.types.V3Snapshot) V3Permissions(org.ovirt.engine.api.v3.types.V3Permissions) V3KatelloErrata(org.ovirt.engine.api.v3.types.V3KatelloErrata) V3Payloads(org.ovirt.engine.api.v3.types.V3Payloads) V3ReportedDevices(org.ovirt.engine.api.v3.types.V3ReportedDevices) V3Statistics(org.ovirt.engine.api.v3.types.V3Statistics) V3WatchDogs(org.ovirt.engine.api.v3.types.V3WatchDogs) DiskAttachment(org.ovirt.engine.api.model.DiskAttachment) V3CustomProperties(org.ovirt.engine.api.v3.types.V3CustomProperties) V3Disk(org.ovirt.engine.api.v3.types.V3Disk) V3Snapshots(org.ovirt.engine.api.v3.types.V3Snapshots) V3Disks(org.ovirt.engine.api.v3.types.V3Disks) V3Status(org.ovirt.engine.api.v3.types.V3Status) V3Nics(org.ovirt.engine.api.v3.types.V3Nics) Disk(org.ovirt.engine.api.model.Disk) V3Disk(org.ovirt.engine.api.v3.types.V3Disk) V3CdRoms(org.ovirt.engine.api.v3.types.V3CdRoms)

Example 8 with V3Disk

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

the class V3DiskOutAdapter method adapt.

@Override
public V3Disk adapt(Disk from) {
    V3Disk to = new V3Disk();
    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.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.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());
        // In V3 "size" used to be a synonym of "provisioned_size":
        to.setSize(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());
    }
    return to;
}
Also used : V3Disk(org.ovirt.engine.api.v3.types.V3Disk) 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 9 with V3Disk

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

the class V3TemplateHelper method fixDiskLinks.

/**
 * Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
 * so we need to remove all the links and re-add them explicitly.
 */
public static void fixDiskLinks(String templateId, V3Disk disk) {
    // Fix the link of the disk itself:
    disk.setHref(V3LinkHelper.linkHref("templates", templateId, "disks", disk.getId()));
    // Remove all the action links and add them again:
    V3Actions actions = disk.getActions();
    if (actions != null) {
        List<V3Link> links = actions.getLinks();
        links.clear();
        V3LinkHelper.addLink(links, "copy", "templates", templateId, "disks", disk.getId(), "copy");
        V3LinkHelper.addLink(links, "export", "templates", templateId, "disks", disk.getId(), "export");
    }
}
Also used : V3Actions(org.ovirt.engine.api.v3.types.V3Actions) V3Link(org.ovirt.engine.api.v3.types.V3Link)

Example 10 with V3Disk

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

the class V3VmHelper method fixDiskLinks.

/**
 * Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
 * so we need to remove all the links and re-add them explicitly.
 */
public static void fixDiskLinks(String vmId, V3Disk disk) {
    // Fix the link of the disk itself:
    disk.setHref(V3LinkHelper.linkHref("vms", vmId, "disks", disk.getId()));
    // Remove all the action links and add them again:
    V3Actions actions = disk.getActions();
    if (actions != null) {
        List<V3Link> links = actions.getLinks();
        links.clear();
        V3LinkHelper.addLink(links, "activate", "vms", vmId, "disks", disk.getId(), "activate");
        V3LinkHelper.addLink(links, "deactivate", "vms", vmId, "disks", disk.getId(), "deactivate");
        V3LinkHelper.addLink(links, "export", "vms", vmId, "disks", disk.getId(), "export");
        V3LinkHelper.addLink(links, "move", "vms", vmId, "disks", disk.getId(), "move");
    }
    // Remove all the links and add them again:
    List<V3Link> links = disk.getLinks();
    links.clear();
    V3LinkHelper.addLink(links, "permissions", "vms", vmId, "disks", disk.getId(), "permissions");
    V3LinkHelper.addLink(links, "statistics", "vms", vmId, "disks", disk.getId(), "statistics");
}
Also used : V3Actions(org.ovirt.engine.api.v3.types.V3Actions) V3Link(org.ovirt.engine.api.v3.types.V3Link)

Aggregations

V3Disk (org.ovirt.engine.api.v3.types.V3Disk)10 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)5 Disk (org.ovirt.engine.api.model.Disk)4 V3Status (org.ovirt.engine.api.v3.types.V3Status)4 GET (javax.ws.rs.GET)3 DiskAttachments (org.ovirt.engine.api.model.DiskAttachments)3 V3Disks (org.ovirt.engine.api.v3.types.V3Disks)3 V3Link (org.ovirt.engine.api.v3.types.V3Link)3 V3Statistics (org.ovirt.engine.api.v3.types.V3Statistics)3 Statistics (org.ovirt.engine.api.model.Statistics)2 TimeZone (org.ovirt.engine.api.model.TimeZone)2 Vm (org.ovirt.engine.api.model.Vm)2 V3Actions (org.ovirt.engine.api.v3.types.V3Actions)2 V3CdRoms (org.ovirt.engine.api.v3.types.V3CdRoms)2 V3CustomProperties (org.ovirt.engine.api.v3.types.V3CustomProperties)2 V3Floppies (org.ovirt.engine.api.v3.types.V3Floppies)2 V3KatelloErrata (org.ovirt.engine.api.v3.types.V3KatelloErrata)2 V3Nics (org.ovirt.engine.api.v3.types.V3Nics)2 V3Payloads (org.ovirt.engine.api.v3.types.V3Payloads)2 V3Permissions (org.ovirt.engine.api.v3.types.V3Permissions)2