Search in sources :

Example 26 with DataCenter

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

the class AbstractBackendCpuProfileResource method addLinks.

@Override
protected CpuProfile addLinks(CpuProfile model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) {
    if (model.isSetQos() && model.getQos().isSetId()) {
        QosBase qos = getEntity(QosBase.class, QueryType.GetQosById, new IdQueryParameters(asGuid(model.getQos().getId())), "qos");
        model.getQos().setDataCenter(new DataCenter());
        model.getQos().getDataCenter().setId(qos.getStoragePoolId().toString());
    }
    return super.addLinks(model, suggestedParent, subCollectionMembersToExclude);
}
Also used : QosBase(org.ovirt.engine.core.common.businessentities.qos.QosBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 27 with DataCenter

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

the class BackendDataCenterNetworksResource method add.

@Override
public Response add(Network network) {
    validateParameters(network, getRequiredAddFields());
    DataCenter dataCenter = new DataCenter();
    dataCenter.setId(dataCenterId.toString());
    network.setDataCenter(dataCenter);
    org.ovirt.engine.core.common.businessentities.network.Network entity = map(network);
    AddNetworkStoragePoolParameters params = getAddParameters(network, entity);
    return performCreate(network.isSetExternalProvider() ? ActionType.AddNetworkOnProvider : addAction, params, new DataCenterNetworkIdResolver(network.getName(), params.getStoragePoolId().toString()));
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)

Example 28 with DataCenter

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

the class BackendAttachedStorageDomainResource method addParents.

@Override
protected StorageDomain addParents(StorageDomain storageDomain) {
    // This is for backwards compatibility and will be removed in the future:
    storageDomain.setDataCenter(new DataCenter());
    storageDomain.getDataCenter().setId(dataCenterId.toString());
    // Find all the data centers that this storage domain is attached to and add references to them:
    StorageDomainHelper.addAttachedDataCenterReferences(this, storageDomain);
    return storageDomain;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 29 with DataCenter

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

the class BackendAttachedStorageDomainsResource method addParents.

@Override
protected StorageDomain addParents(StorageDomain storageDomain) {
    // This is for backwards compatibility and will be removed in the future:
    storageDomain.setDataCenter(new DataCenter());
    storageDomain.getDataCenter().setId(dataCenterId.toString());
    // Find all the data centers that this storage domain is attached to and add references to them:
    StorageDomainHelper.addAttachedDataCenterReferences(this, storageDomain);
    return storageDomain;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 30 with DataCenter

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

the class PermissionMapper method setObjectId.

/**
 * Completeness of "{entityType}.id" already validated
 */
private static void setObjectId(Permission model, org.ovirt.engine.core.common.businessentities.Permission entity) {
    String id = entity.getObjectId().toString();
    switch(entity.getObjectType()) {
        case System:
            break;
        case StoragePool:
            model.setDataCenter(new DataCenter());
            model.getDataCenter().setId(id);
            break;
        case Cluster:
            model.setCluster(new Cluster());
            model.getCluster().setId(id);
            break;
        case VDS:
            model.setHost(new Host());
            model.getHost().setId(id);
            break;
        case Storage:
            model.setStorageDomain(new StorageDomain());
            model.getStorageDomain().setId(id);
            break;
        case VM:
            model.setVm(new Vm());
            model.getVm().setId(id);
            break;
        case VmPool:
            model.setVmPool(new VmPool());
            model.getVmPool().setId(id);
            break;
        case VmTemplate:
            model.setTemplate(new Template());
            model.getTemplate().setId(id);
            break;
        case Disk:
            model.setDisk(new Disk());
            model.getDisk().setId(id);
            break;
        default:
            assert false;
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) DataCenter(org.ovirt.engine.api.model.DataCenter) VmPool(org.ovirt.engine.api.model.VmPool) Vm(org.ovirt.engine.api.model.Vm) Cluster(org.ovirt.engine.api.model.Cluster) Host(org.ovirt.engine.api.model.Host) Disk(org.ovirt.engine.api.model.Disk) Template(org.ovirt.engine.api.model.Template)

Aggregations

DataCenter (org.ovirt.engine.api.model.DataCenter)42 Test (org.junit.Test)10 WebApplicationException (javax.ws.rs.WebApplicationException)6 Network (org.ovirt.engine.api.model.Network)6 StorageDomain (org.ovirt.engine.api.model.StorageDomain)5 Response (javax.ws.rs.core.Response)4 Qos (org.ovirt.engine.api.model.Qos)4 Quota (org.ovirt.engine.api.model.Quota)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 Guid (org.ovirt.engine.core.compat.Guid)4 Cluster (org.ovirt.engine.api.model.Cluster)3 Permission (org.ovirt.engine.api.model.Permission)3 Role (org.ovirt.engine.api.model.Role)3 AddNetworkStoragePoolParameters (org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)3 QosBase (org.ovirt.engine.core.common.businessentities.qos.QosBase)3 QosQueryParameterBase (org.ovirt.engine.core.common.queries.QosQueryParameterBase)3 Cpu (org.ovirt.engine.api.model.Cpu)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1