Search in sources :

Example 1 with QosBase

use of org.ovirt.engine.core.common.businessentities.qos.QosBase in project ovirt-engine by oVirt.

the class AbstractBackendDiskProfileResource method addLinks.

@Override
protected DiskProfile addLinks(DiskProfile 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 2 with QosBase

use of org.ovirt.engine.core.common.businessentities.qos.QosBase in project ovirt-engine by oVirt.

the class BackendQossResource method add.

@Override
public Response add(Qos qos) {
    validateParameters(qos, "name", "type");
    QosParametersBase<QosBase> params = new QosParametersBase<>();
    org.ovirt.engine.api.model.QosType qosType = qos.getType();
    QosBase qosEntity = createNewQosEntityForQosType(qosType);
    params.setQos(map(qos, qosEntity));
    if (dataCenterId != null) {
        qosEntity.setStoragePoolId(dataCenterId);
    }
    return performCreate(addActionTypeForQosType(qosType), params, new QueryIdResolver<Guid>(QueryType.GetQosById, IdQueryParameters.class));
}
Also used : QosBase(org.ovirt.engine.core.common.businessentities.qos.QosBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) Guid(org.ovirt.engine.core.compat.Guid) QosType(org.ovirt.engine.api.model.QosType)

Example 3 with QosBase

use of org.ovirt.engine.core.common.businessentities.qos.QosBase in project ovirt-engine by oVirt.

the class AbstractBackendVnicProfileResource method addLinks.

@Override
protected VnicProfile addLinks(VnicProfile 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 4 with QosBase

use of org.ovirt.engine.core.common.businessentities.qos.QosBase 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 5 with QosBase

use of org.ovirt.engine.core.common.businessentities.qos.QosBase in project ovirt-engine by oVirt.

the class BackendQosResource method update.

@Override
public Qos update(final Qos incoming) {
    QueryIdResolver<Guid> entityResolver = new QueryIdResolver<>(QueryType.GetQosById, IdQueryParameters.class);
    final QosBase qosBase = getEntity(new QueryIdResolver<>(QueryType.GetQosById, IdQueryParameters.class), true);
    return performUpdate(incoming, entityResolver, updateActionTypeForQosType(qosBase.getQosType()), (model, entity) -> {
        QosParametersBase<QosBase> parameters = new QosParametersBase<>();
        parameters.setQosId(guid);
        parameters.setQos(map(incoming, entity));
        return parameters;
    });
}
Also used : QosBase(org.ovirt.engine.core.common.businessentities.qos.QosBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

QosBase (org.ovirt.engine.core.common.businessentities.qos.QosBase)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 DataCenter (org.ovirt.engine.api.model.DataCenter)3 QosParametersBase (org.ovirt.engine.core.common.action.QosParametersBase)2 Guid (org.ovirt.engine.core.compat.Guid)2 QosType (org.ovirt.engine.api.model.QosType)1