Search in sources :

Example 26 with StorageSystemType

use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.

the class StorageSystemTypeService method getStorageSystemType.

/**
 * Show Storage System Type detail for given URI
 *
 * @param id
 *            the URN of Storage System Type
 * @brief Show storage system type of storage
 * @return Storage System Type details
 */
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public StorageSystemTypeRestRep getStorageSystemType(@PathParam("id") URI id) {
    log.info("GET getStorageSystemType on Uri: " + id);
    ArgValidator.checkFieldUriType(id, StorageSystemType.class, "id");
    StorageSystemType storageType = queryResource(id);
    ArgValidator.checkEntity(storageType, id, isIdEmbeddedInURL(id));
    StorageSystemTypeRestRep storageTypeRest = new StorageSystemTypeRestRep();
    return map(storageType, storageTypeRest);
}
Also used : StorageSystemTypeRestRep(com.emc.storageos.model.storagesystem.type.StorageSystemTypeRestRep) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 27 with StorageSystemType

use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.

the class StorageSystemTypeService method getStorageSystemTypes.

/**
 * Returns a list of all Storage System Types requested for like block,
 * file, object or all. Valid input parameters are block, file, object and
 * all
 *
 * @brief List storage system types
 * @return List of all storage system types.
 */
@GET
@Path("/type/{type}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemTypeList getStorageSystemTypes(@PathParam("type") String type) {
    log.info("GET getStorageSystemType on type: " + type);
    if (type != null) {
        ArgValidator.checkFieldValueFromEnum(type.toUpperCase(), "metaType", StorageSystemType.META_TYPE.class);
    }
    List<URI> ids = _dbClient.queryByType(StorageSystemType.class, true);
    StorageSystemTypeList list = new StorageSystemTypeList();
    Iterator<StorageSystemType> iter = _dbClient.queryIterativeObjects(StorageSystemType.class, ids);
    while (iter.hasNext()) {
        StorageSystemType ssType = iter.next();
        if (ssType.getStorageTypeId() == null) {
            ssType.setStorageTypeId(ssType.getId().toString());
        }
        if (StringUtils.equals(ALL_TYPE, type) || StringUtils.equals(type, ssType.getMetaType())) {
            list.getStorageSystemTypes().add(map(ssType));
        }
    }
    return list;
}
Also used : StorageSystemTypeList(com.emc.storageos.model.storagesystem.type.StorageSystemTypeList) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType) URI(java.net.URI) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 28 with StorageSystemType

use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.

the class StorageDriverManagerProxy method listNonNativeTypes.

private List<StorageSystemType> listNonNativeTypes() {
    List<StorageSystemType> result = new ArrayList<StorageSystemType>();
    List<URI> ids = dbClient.queryByType(StorageSystemType.class, true);
    Iterator<StorageSystemType> it = dbClient.queryIterativeObjects(StorageSystemType.class, ids);
    while (it.hasNext()) {
        StorageSystemType type = it.next();
        if (type.getIsNative() == null || type.getIsNative()) {
            continue;
        }
        if (StringUtils.equals(type.getDriverStatus(), StorageSystemType.STATUS.ACTIVE.toString())) {
            result.add(type);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType) URI(java.net.URI)

Example 29 with StorageSystemType

use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.

the class StorageDriverManagerProxy method refreshInfo.

private void refreshInfo() {
    clearInfo();
    List<StorageSystemType> types = listNonNativeTypes();
    for (StorageSystemType type : types) {
        String typeName = type.getStorageTypeName();
        String driverName = type.getDriverName();
        if (type.getIsSmiProvider()) {
            storageProvidersMap.put(driverName, typeName);
            log.info("Driver info for storage system type {} has been set into storageDriverManagerProxy instance", typeName);
            continue;
        }
        storageSystemsMap.put(driverName, typeName);
        if (type.getManagedBy() != null) {
            providerManaged.add(typeName);
        } else {
            directlyManaged.add(typeName);
        }
        if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.FILE.toString())) {
            fileSystems.add(typeName);
        } else if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.BLOCK.toString())) {
            blockSystems.add(typeName);
        }
        log.info("Driver info for storage system type {} has been set into storageDriverManagerProxy instance", typeName);
    }
}
Also used : StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType)

Aggregations

StorageSystemType (com.emc.storageos.db.client.model.StorageSystemType)29 URI (java.net.URI)10 ArrayList (java.util.ArrayList)10 StorageDriversInfo (com.emc.storageos.coordinator.client.model.StorageDriversInfo)8 HashMap (java.util.HashMap)5 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)5 StorageDriverMetaData (com.emc.storageos.coordinator.client.model.StorageDriverMetaData)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 Path (javax.ws.rs.Path)4 File (java.io.File)3 HashSet (java.util.HashSet)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 AbstractStorageDriver (com.emc.storageos.storagedriver.AbstractStorageDriver)2 ZipFile (java.util.zip.ZipFile)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2