use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeProvidersResource method getStoragePoolIdByStorageDomainName.
private StoragePool getStoragePoolIdByStorageDomainName(String storageDomainName) {
StorageDomainStatic storageDomain = getEntity(StorageDomainStatic.class, QueryType.GetStorageDomainByName, new NameQueryParameters(storageDomainName), "StorageDomain: name=" + storageDomainName);
List<StoragePool> storagePools = getEntity(List.class, QueryType.GetStoragePoolsByStorageDomainId, new IdQueryParameters(storageDomain.getId()), "Datacenters");
if (!storagePools.isEmpty()) {
return storagePools.get(0);
}
// The storage domain is unattached
return null;
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeProvidersResource method getStoragePool.
public StoragePool getStoragePool(DataCenter dataCenter) {
StoragePool pool = null;
if (dataCenter.isSetId()) {
Guid id = asGuid(dataCenter.getId());
pool = getEntity(StoragePool.class, QueryType.GetStoragePoolById, new IdQueryParameters(id), "Datacenter: id=" + dataCenter.getId());
} else if (dataCenter.isSetName()) {
pool = getEntity(StoragePool.class, QueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(dataCenter.getName()), "Datacenter: name=" + dataCenter.getName());
}
if (pool == null) {
notFound(DataCenter.class);
}
return pool;
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeProvidersResource method add.
@Override
public Response add(OpenStackVolumeProvider provider) {
validateParameters(provider, "name");
if (provider.isSetDataCenter()) {
StoragePool storagePool = getStoragePool(provider.getDataCenter());
provider.setDataCenter(DataCenterMapper.map(storagePool, null));
}
return performCreate(ActionType.AddProvider, new ProviderParameters(map(provider)), new QueryIdResolver<Guid>(QueryType.GetProviderById, IdQueryParameters.class));
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class BackendStorageDomainDisksResourceTest method testListUnregistered.
@Test
public void testListUnregistered() throws Exception {
setUriInfo(addMatrixParameterExpectations(setUpBasicUriExpectations(), BackendStorageDomainDisksResource.UNREGISTERED));
StoragePool storagePool = new StoragePool();
storagePool.setId(storagePoolId);
setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[3] }, Collections.singletonList(storagePool));
List<org.ovirt.engine.core.common.businessentities.storage.Disk> entities = new ArrayList<>();
for (int i = 0; i < NAMES.length; i++) {
entities.add(getEntity(i));
}
setUpEntityQueryExpectations(QueryType.GetUnregisteredDisks, GetUnregisteredDisksQueryParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[3], storagePoolId }, entities);
verifyCollection(getCollection());
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class BackendStorageDomainImageResourceTest method getStoragePoolList.
public static List<StoragePool> getStoragePoolList() {
return new ArrayList<StoragePool>() {
private static final long serialVersionUID = 4817230014440543623L;
{
StoragePool storagePool = new StoragePool();
storagePool.setId(STORAGE_POOL_ID);
add(storagePool);
}
};
}
Aggregations