Search in sources :

Example 6 with StorageDomains

use of org.ovirt.engine.api.model.StorageDomains 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;
}
Also used : StorageDomains(org.ovirt.engine.api.model.StorageDomains) Disk(org.ovirt.engine.api.model.Disk) V3Disk(org.ovirt.engine.api.v3.types.V3Disk) Statistics(org.ovirt.engine.api.model.Statistics) Vms(org.ovirt.engine.api.model.Vms)

Example 7 with StorageDomains

use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.

the class BackendStorageDomainsResource method mapCollection.

private StorageDomains mapCollection(List<org.ovirt.engine.core.common.businessentities.StorageDomain> entities) {
    StorageDomains collection = new StorageDomains();
    for (org.ovirt.engine.core.common.businessentities.StorageDomain entity : entities) {
        StorageDomain storageDomain = map(entity);
        // status is only relevant in the context of a data-center, so it can either be 'Unattached' or null.
        if (StorageDomainSharedStatus.Unattached.equals(entity.getStorageDomainSharedStatus())) {
            storageDomain.setStatus(StorageDomainStatus.UNATTACHED);
        } else {
            storageDomain.setStatus(null);
        }
        collection.getStorageDomains().add(addLinks(storageDomain, getLinksToExclude(storageDomain)));
    }
    return collection;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Example 8 with StorageDomains

use of org.ovirt.engine.api.model.StorageDomains 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 9 with StorageDomains

use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.

the class AbstractBackendStorageDomainDisksResource method addParents.

@Override
protected Disk addParents(Disk disk) {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(storageDomainId.toString());
    StorageDomains storageDomains = new StorageDomains();
    storageDomains.getStorageDomains().add(storageDomain);
    disk.setStorageDomain(storageDomain);
    disk.setStorageDomains(storageDomains);
    return disk;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Example 10 with StorageDomains

use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.

the class V3DiskSnapshotInAdapter method adapt.

@Override
public DiskSnapshot adapt(V3DiskSnapshot from) {
    DiskSnapshot to = new DiskSnapshot();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(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(adaptIn(from.getDisk()));
    }
    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());
    }
    return to;
}
Also used : V3DiskSnapshot(org.ovirt.engine.api.v3.types.V3DiskSnapshot) DiskSnapshot(org.ovirt.engine.api.model.DiskSnapshot) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Statistics(org.ovirt.engine.api.model.Statistics) Vms(org.ovirt.engine.api.model.Vms)

Aggregations

StorageDomains (org.ovirt.engine.api.model.StorageDomains)12 StorageDomain (org.ovirt.engine.api.model.StorageDomain)9 Disk (org.ovirt.engine.api.model.Disk)5 Statistics (org.ovirt.engine.api.model.Statistics)2 Vms (org.ovirt.engine.api.model.Vms)2 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 DiskProfile (org.ovirt.engine.api.model.DiskProfile)1 DiskSnapshot (org.ovirt.engine.api.model.DiskSnapshot)1 OpenStackVolumeType (org.ovirt.engine.api.model.OpenStackVolumeType)1 Quota (org.ovirt.engine.api.model.Quota)1 Snapshot (org.ovirt.engine.api.model.Snapshot)1 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)1 V3DiskSnapshot (org.ovirt.engine.api.v3.types.V3DiskSnapshot)1 V3StorageDomains (org.ovirt.engine.api.v3.types.V3StorageDomains)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 Guid (org.ovirt.engine.core.compat.Guid)1