use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class AbstractBackendCpuProfilesResource method handleQosDataCenterLinks.
/**
* used to set qos's href (requires dc id).
*/
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
if (!qosMap.isEmpty()) {
List<CpuQos> list = getBackendCollection(CpuQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.CPU));
for (CpuQos cpuQos : list) {
Qos qos = qosMap.get(cpuQos.getId());
if (qos != null) {
qos.setDataCenter(new DataCenter());
qos.getDataCenter().setId(cpuQos.getStoragePoolId().toString());
}
}
}
}
use of org.ovirt.engine.api.model.DataCenter 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);
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfilesResource method handleQosDataCenterLinks.
/**
* used to set qos's href (requires dc id).
*/
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
if (!qosMap.isEmpty()) {
List<StorageQos> list = getBackendCollection(StorageQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.STORAGE));
for (StorageQos storageQos : list) {
Qos qos = qosMap.get(storageQos.getId());
if (qos != null) {
qos.setDataCenter(new DataCenter());
qos.getDataCenter().setId(storageQos.getStoragePoolId().toString());
}
}
}
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class AbstractBackendVnicProfilesResource method handleQosDataCenterLinks.
/**
* used to set qos's href (requires dc id).
*/
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
if (!qosMap.isEmpty()) {
List<NetworkQoS> list = getBackendCollection(NetworkQoS.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.NETWORK));
for (NetworkQoS networkQoS : list) {
Qos qos = qosMap.get(networkQoS.getId());
if (qos != null) {
qos.setDataCenter(new DataCenter());
qos.getDataCenter().setId(networkQoS.getStoragePoolId().toString());
}
}
}
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class StorageDomainHelper method addAttachedDataCenterReferences.
/**
* Adds to the given Storage Domain the references to the Data Centers it is attached to.
*
* @param resource the resource that will be used to run the required queries
* @param model the model of the Storage Domain where the references will be added
*/
public static void addAttachedDataCenterReferences(BackendResource resource, StorageDomain model) {
// Note that this implementation is far from efficient, as we are retrieving all the content of the Storage
// Domains and immediately discarding everything but the identifiers of the Data Centers. It would be better to
// have a query that returns only the identifiers.
Guid id = Guid.createGuidFromString(model.getId());
QueryReturnValue result = resource.runQuery(QueryType.GetStorageDomainListById, new IdQueryParameters(id));
if (result != null && result.getSucceeded()) {
List<org.ovirt.engine.core.common.businessentities.StorageDomain> storageDomains = result.getReturnValue();
if (CollectionUtils.isNotEmpty(storageDomains)) {
DataCenters dataCenters = new DataCenters();
for (org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain : storageDomains) {
DataCenter dataCenter = new DataCenter();
dataCenter.setId(storageDomain.getStoragePoolId().toString());
dataCenters.getDataCenters().add(dataCenter);
}
model.setDataCenters(dataCenters);
}
}
}
Aggregations