Search in sources :

Example 1 with V3StorageDomains

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

the class V3StorageDomainsOutAdapter method adapt.

@Override
public V3StorageDomains adapt(StorageDomains from) {
    V3StorageDomains to = new V3StorageDomains();
    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.getStorageDomains().addAll(adaptOut(from.getStorageDomains()));
    return to;
}
Also used : V3StorageDomains(org.ovirt.engine.api.v3.types.V3StorageDomains)

Example 2 with V3StorageDomains

use of org.ovirt.engine.api.v3.types.V3StorageDomains 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 3 with V3StorageDomains

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

the class V3StorageDomainsInAdapter method adapt.

@Override
public StorageDomains adapt(V3StorageDomains from) {
    StorageDomains to = new StorageDomains();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getStorageDomains().addAll(adaptIn(from.getStorageDomains()));
    return to;
}
Also used : V3StorageDomains(org.ovirt.engine.api.v3.types.V3StorageDomains) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Example 4 with V3StorageDomains

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

the class V3ApiSummaryOutAdapter method adapt.

@Override
public V3ApiSummary adapt(ApiSummary from) {
    V3ApiSummary to = new V3ApiSummary();
    if (from.isSetHosts()) {
        ApiSummaryItem fromHosts = from.getHosts();
        V3Hosts toHosts = new V3Hosts();
        if (fromHosts.isSetTotal()) {
            toHosts.setTotal(fromHosts.getTotal().longValue());
        }
        if (fromHosts.isSetActive()) {
            toHosts.setActive(fromHosts.getActive().longValue());
        }
        to.setHosts(toHosts);
    }
    if (from.isSetStorageDomains()) {
        ApiSummaryItem fromSds = from.getStorageDomains();
        V3StorageDomains toSds = new V3StorageDomains();
        if (fromSds.isSetTotal()) {
            toSds.setTotal(fromSds.getTotal().longValue());
        }
        if (fromSds.isSetActive()) {
            toSds.setActive(fromSds.getActive().longValue());
        }
        to.setStorageDomains(toSds);
    }
    if (from.isSetUsers()) {
        ApiSummaryItem fromUsers = from.getUsers();
        V3Users toUsers = new V3Users();
        if (fromUsers.isSetTotal()) {
            toUsers.setTotal(fromUsers.getTotal().longValue());
        }
        if (fromUsers.isSetActive()) {
            toUsers.setActive(fromUsers.getActive().longValue());
        }
        to.setUsers(toUsers);
    }
    if (from.isSetVms()) {
        ApiSummaryItem fromVms = from.getVms();
        V3VMs toVms = new V3VMs();
        if (fromVms.isSetTotal()) {
            toVms.setTotal(fromVms.getTotal().longValue());
        }
        if (fromVms.isSetActive()) {
            toVms.setActive(fromVms.getActive().longValue());
        }
        to.setVMs(toVms);
    }
    return to;
}
Also used : ApiSummaryItem(org.ovirt.engine.api.model.ApiSummaryItem) V3ApiSummary(org.ovirt.engine.api.v3.types.V3ApiSummary) V3Hosts(org.ovirt.engine.api.v3.types.V3Hosts) V3Users(org.ovirt.engine.api.v3.types.V3Users) V3VMs(org.ovirt.engine.api.v3.types.V3VMs) V3StorageDomains(org.ovirt.engine.api.v3.types.V3StorageDomains)

Example 5 with V3StorageDomains

use of org.ovirt.engine.api.v3.types.V3StorageDomains 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)

Aggregations

V3StorageDomains (org.ovirt.engine.api.v3.types.V3StorageDomains)5 V3VMs (org.ovirt.engine.api.v3.types.V3VMs)3 V3Statistics (org.ovirt.engine.api.v3.types.V3Statistics)2 V3Status (org.ovirt.engine.api.v3.types.V3Status)2 ApiSummaryItem (org.ovirt.engine.api.model.ApiSummaryItem)1 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)1 StorageDomains (org.ovirt.engine.api.model.StorageDomains)1 DiskAttachmentResource (org.ovirt.engine.api.resource.DiskAttachmentResource)1 DiskAttachmentsResource (org.ovirt.engine.api.resource.DiskAttachmentsResource)1 VmResource (org.ovirt.engine.api.resource.VmResource)1 VmsResource (org.ovirt.engine.api.resource.VmsResource)1 V3ApiSummary (org.ovirt.engine.api.v3.types.V3ApiSummary)1 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)1 V3DiskSnapshot (org.ovirt.engine.api.v3.types.V3DiskSnapshot)1 V3Hosts (org.ovirt.engine.api.v3.types.V3Hosts)1 V3Users (org.ovirt.engine.api.v3.types.V3Users)1