use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendAssignedDiskProfilesResource method addParents.
@Override
public DiskProfile addParents(DiskProfile diskProfile) {
diskProfile.setStorageDomain(new StorageDomain());
diskProfile.getStorageDomain().setId(storageDomainId);
return diskProfile;
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendAssignedDiskProfilesResource method add.
@Override
public Response add(DiskProfile diskProfile) {
if (!diskProfile.isSetStorageDomain() || !diskProfile.getStorageDomain().isSetId()) {
diskProfile.setStorageDomain(new StorageDomain());
diskProfile.getStorageDomain().setId(storageDomainId);
}
return super.add(diskProfile);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class AbstractBackendStorageDomainDiskResource 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;
}
use of org.ovirt.engine.api.model.StorageDomain 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);
}
}
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainTemplateResourceTest method testImportNotFound.
@Test
public void testImportNotFound() throws Exception {
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(GUIDS[2].toString());
action.setCluster(new org.ovirt.engine.api.model.Cluster());
action.getCluster().setId(GUIDS[1].toString());
setUpGetEntityExpectations(StorageDomainType.ImportExport, GUIDS[2], true);
setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
try {
resource.doImport(action);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyNotFoundException(wae);
}
}
Aggregations