Search in sources :

Example 1 with StorageSystemList

use of com.emc.storageos.model.systems.StorageSystemList in project coprhd-controller by CoprHD.

the class StorageSystemService method getStorageSystems.

/**
 * Gets the id, name, and self link for all registered storage systems.
 *
 * @brief List storage systems
 * @return A reference to a StorageSystemList.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemList getStorageSystems() {
    StorageSystemList systemsList = new StorageSystemList();
    List<URI> ids = _dbClient.queryByType(StorageSystem.class, true);
    Iterator<StorageSystem> iter = _dbClient.queryIterativeObjects(StorageSystem.class, ids);
    while (iter.hasNext()) {
        systemsList.getStorageSystems().add(toNamedRelatedResource(iter.next()));
    }
    return systemsList;
}
Also used : StorageSystemList(com.emc.storageos.model.systems.StorageSystemList) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with StorageSystemList

use of com.emc.storageos.model.systems.StorageSystemList in project coprhd-controller by CoprHD.

the class SMISProviderService method getStorageSystems.

/**
 * Allows the user to get the id, name, and self link for all storage
 * systems visible to the provider with the passed id.
 * <p>
 * The method is deprecated. Use /vdc/storage-providers/{id}/storage-systems
 *
 * @param id the URN of a ViPR SMI-S provider
 *
 * @brief List SMI-S provider storage systems
 * @return A StorageSystemList reference specifying the id, name, and self
 *         link for the storage systems visible to the provider.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/storage-systems")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemList getStorageSystems(@PathParam("id") URI id) {
    // Validate the provider
    ArgValidator.checkFieldUriType(id, StorageProvider.class, "id");
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, id);
    ArgValidator.checkEntityNotNull(provider, id, isIdEmbeddedInURL(id));
    // Return the list of storage systems for the provider.
    StorageSystemList storageSystemsForProvider = new StorageSystemList();
    StringSet providerSystemURIStrs = provider.getStorageSystems();
    if (providerSystemURIStrs != null) {
        for (String providerSystemURIStr : providerSystemURIStrs) {
            StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, URI.create(providerSystemURIStr));
            if (storageSystem != null) {
                storageSystemsForProvider.getStorageSystems().add(toNamedRelatedResource(storageSystem));
            }
        }
    }
    return storageSystemsForProvider;
}
Also used : StorageSystemList(com.emc.storageos.model.systems.StorageSystemList) StringSet(com.emc.storageos.db.client.model.StringSet) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with StorageSystemList

use of com.emc.storageos.model.systems.StorageSystemList in project coprhd-controller by CoprHD.

the class StorageProviderService method getStorageSystems.

/**
 * Allows the user to get the id, name, and self link for all storage
 * systems visible to the provider with the passed id.
 *
 * @param id the URN of a ViPR Storage provider
 *
 * @brief List Storage provider storage systems
 * @return A StorageSystemList reference specifying the id, name, and self
 *         link for the storage systems visible to the provider.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/storage-systems")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemList getStorageSystems(@PathParam("id") URI id) {
    // Validate the provider
    ArgValidator.checkFieldUriType(id, StorageProvider.class, "id");
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, id);
    ArgValidator.checkEntityNotNull(provider, id, isIdEmbeddedInURL(id));
    // Return the list of storage systems for the provider.
    StorageSystemList storageSystemsForProvider = new StorageSystemList();
    StringSet providerSystemURIStrs = provider.getStorageSystems();
    if (providerSystemURIStrs != null) {
        for (String providerSystemURIStr : providerSystemURIStrs) {
            StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, URI.create(providerSystemURIStr));
            if (storageSystem != null) {
                storageSystemsForProvider.getStorageSystems().add(toNamedRelatedResource(storageSystem));
            }
        }
    }
    return storageSystemsForProvider;
}
Also used : StorageSystemList(com.emc.storageos.model.systems.StorageSystemList) StringSet(com.emc.storageos.db.client.model.StringSet) MapStorageProvider(com.emc.storageos.api.mapper.functions.MapStorageProvider) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 4 with StorageSystemList

use of com.emc.storageos.model.systems.StorageSystemList in project coprhd-controller by CoprHD.

the class ApiTest method updateAllVnxAndVmaxPorts.

/**
 * Update the discovered VNX/VMAX storage ports to set the transport zone.
 *
 * @param provider : Provider.
 */
private void updateAllVnxAndVmaxPorts(SMISProviderRestRep provider) {
    StorageSystemList systemList = rZAdmin.path("/vdc/storage-systems").get(StorageSystemList.class);
    for (RelatedResourceRep resRep : systemList.getStorageSystems()) {
        StorageSystemRestRep system = rZAdmin.path(String.format("/vdc/storage-systems/%s", resRep.getId()).toString()).get(StorageSystemRestRep.class);
        if (system.getSystemType().equals(Type.vnxblock.toString()) || system.getSystemType().equals(Type.vmax.toString())) {
            // Register all the discovered storage ports .
            StoragePortList vnxBlockPortList = rZAdmin.path(String.format("/vdc/storage-systems/%s/storage-ports", system.getId()).toString()).get(StoragePortList.class);
            List<NamedRelatedResourceRep> vnxBlockPortURIList = vnxBlockPortList.getPorts();
            for (RelatedResourceRep portURI : vnxBlockPortURIList) {
                updateStoragePortTZ(resRep.getId(), portURI);
            }
        }
    }
}
Also used : StorageSystemList(com.emc.storageos.model.systems.StorageSystemList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortList(com.emc.storageos.model.ports.StoragePortList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

StorageSystemList (com.emc.storageos.model.systems.StorageSystemList)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)3 GET (javax.ws.rs.GET)3 Produces (javax.ws.rs.Produces)3 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 Path (javax.ws.rs.Path)2 MapStorageProvider (com.emc.storageos.api.mapper.functions.MapStorageProvider)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StoragePortList (com.emc.storageos.model.ports.StoragePortList)1 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)1 URI (java.net.URI)1