use of com.emc.storageos.model.pools.StoragePoolList in project coprhd-controller by CoprHD.
the class ObjectVirtualPoolService method getMatchingPoolsForVirtualPoolAttributes.
/**
* Return the matching pools for a given set of VirtualPool attributes.
* This API is useful for user to find the matching pools before creating a VirtualPool.
*
* @param param : VirtualPoolAttributeParam
* @brief List pools matching specified properties in Object store VirtualPool
* @return : matching pools.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/matching-pools")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public StoragePoolList getMatchingPoolsForVirtualPoolAttributes(ObjectVirtualPoolParam param) {
StoragePoolList poolList = new StoragePoolList();
VirtualPool vpool = prepareVirtualPool(param);
List<URI> poolURIs = _dbClient.queryByType(StoragePool.class, true);
List<StoragePool> allPools = _dbClient.queryObject(StoragePool.class, poolURIs);
StringBuffer errorMessage = new StringBuffer();
List<StoragePool> matchedPools = ImplicitPoolMatcher.getMatchedPoolWithStoragePools(vpool, allPools, null, null, null, _dbClient, _coordinator, AttributeMatcher.VPOOL_MATCHERS, errorMessage);
for (StoragePool pool : matchedPools) {
poolList.getPools().add(toNamedRelatedResource(pool, pool.getNativeGuid()));
}
return poolList;
}
use of com.emc.storageos.model.pools.StoragePoolList in project coprhd-controller by CoprHD.
the class VirtualPoolService method refreshMatchedPools.
/**
* Refresh the matching pools by running implicit pool matcher algorithm and
* find if there are any new matched pools exists in the environment.
* Returns the new matched pools to user.
*
* @param id the URN of a ViPR VirtualPool.
* @return : list of pools.
*/
protected StoragePoolList refreshMatchedPools(VirtualPool.Type type, URI id) {
ArgValidator.checkUri(id);
StoragePoolList poolList = new StoragePoolList();
VirtualPool vpool = queryResource(id);
ArgValidator.checkEntityNotNull(vpool, id, isIdEmbeddedInURL(id));
if (!vpool.getType().equals(type.name())) {
throw APIException.badRequests.providedVirtualPoolNotCorrectType();
}
StringBuffer errorMessage = new StringBuffer();
ImplicitPoolMatcher.matchVirtualPoolWithAllStoragePools(vpool, _dbClient, _coordinator, errorMessage);
_dbClient.updateAndReindexObject(vpool);
StringSet matchedPools = vpool.getMatchedStoragePools();
if (null != matchedPools && !matchedPools.isEmpty()) {
Iterator<String> vpoolItr = matchedPools.iterator();
while (vpoolItr.hasNext()) {
URI poolURI = URI.create(vpoolItr.next());
StoragePool pool = _dbClient.queryObject(StoragePool.class, poolURI);
if (pool == null) {
continue;
}
poolList.getPools().add(toNamedRelatedResource(pool));
}
}
return poolList;
}
use of com.emc.storageos.model.pools.StoragePoolList in project coprhd-controller by CoprHD.
the class BlockVirtualPoolService method getMatchingPoolsForVirtualPoolAttributes.
/**
* Return the matching pools for a given set of VirtualPool attributes.
* This API is useful for user to find the matching pools before creating a VirtualPool.
*
* @prereq none
* @param param : VirtualPoolAttributeParam
* @brief List matching pools for virtual pool properties
* @return matching pools.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/matching-pools")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public StoragePoolList getMatchingPoolsForVirtualPoolAttributes(BlockVirtualPoolParam param) {
StoragePoolList poolList = new StoragePoolList();
Map<URI, VpoolRemoteCopyProtectionSettings> remoteSettingsMap = new HashMap<URI, VpoolRemoteCopyProtectionSettings>();
List<VpoolProtectionVarraySettings> protectionSettings = new ArrayList<VpoolProtectionVarraySettings>();
Map<URI, VpoolProtectionVarraySettings> protectionSettingsMap = new HashMap<URI, VpoolProtectionVarraySettings>();
VirtualPool vpool = prepareVirtualPool(param, remoteSettingsMap, protectionSettingsMap, protectionSettings);
List<URI> storagePoolURIs = _dbClient.queryByType(StoragePool.class, true);
List<StoragePool> allPools = _dbClient.queryObject(StoragePool.class, storagePoolURIs);
StringBuffer errorMessage = new StringBuffer();
List<StoragePool> matchedPools = ImplicitPoolMatcher.getMatchedPoolWithStoragePools(vpool, allPools, protectionSettingsMap, remoteSettingsMap, null, _dbClient, _coordinator, AttributeMatcher.VPOOL_MATCHERS, errorMessage);
for (StoragePool pool : matchedPools) {
poolList.getPools().add(toNamedRelatedResource(pool, pool.getNativeGuid()));
}
return poolList;
}
use of com.emc.storageos.model.pools.StoragePoolList in project coprhd-controller by CoprHD.
the class StoragePoolService method getStoragePools.
/**
* Gets the ids and self links for all storage pools.
*
* @brief List storage pools
* @return A StoragePoolList reference specifying the ids and self links for
* the storage pools.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StoragePoolList getStoragePools() {
StoragePoolList storagePools = new StoragePoolList();
List<URI> ids = _dbClient.queryByType(StoragePool.class, true);
for (URI id : ids) {
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, id);
if (storagePool != null) {
storagePools.getPools().add(toNamedRelatedResource(storagePool, storagePool.getNativeGuid()));
}
}
return storagePools;
}
use of com.emc.storageos.model.pools.StoragePoolList in project coprhd-controller by CoprHD.
the class FileVirtualPoolService method getMatchingPoolsForVirtualPoolAttributes.
/**
* Return the matching pools for a given set of VirtualPool attributes.
* This API is useful for user to find the matching pools before creating a VirtualPool.
*
* @param param : VirtualPoolAttributeParam
* @brief List pools matching specified properties in file store VirtualPool
* @return : matching pools.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/matching-pools")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public StoragePoolList getMatchingPoolsForVirtualPoolAttributes(FileVirtualPoolParam param) {
StoragePoolList poolList = new StoragePoolList();
VirtualPool vpool = prepareVirtualPool(param, false);
List<URI> poolURIs = _dbClient.queryByType(StoragePool.class, true);
List<StoragePool> allPools = _dbClient.queryObject(StoragePool.class, poolURIs);
StringBuffer errorMessage = new StringBuffer();
List<StoragePool> matchedPools = ImplicitPoolMatcher.getMatchedPoolWithStoragePools(vpool, allPools, null, null, null, _dbClient, _coordinator, AttributeMatcher.VPOOL_MATCHERS, errorMessage);
for (StoragePool pool : matchedPools) {
poolList.getPools().add(toNamedRelatedResource(pool, pool.getNativeGuid()));
}
return poolList;
}
Aggregations