Search in sources :

Example 11 with StorageSystemRestRep

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

the class BlockVirtualPools method checkDisconnectedStoragePools.

public static void checkDisconnectedStoragePools(@As(",") String[] ids) {
    List<BlockVirtualPoolRestRep> virtualpools = VirtualPoolUtils.getBlockVirtualPools();
    Set<String> connectedstoragepools = new HashSet<String>();
    List<String> failedArrays = new ArrayList<String>();
    for (BlockVirtualPoolRestRep virtualpool : virtualpools) {
        if (virtualpool.getUseMatchedPools()) {
            for (RelatedResourceRep pool : virtualpool.getMatchedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        } else {
            for (RelatedResourceRep pool : virtualpool.getAssignedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        }
    }
    for (String id : ids) {
        StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
        if (storageSystem != null && !storageSystem.getRegistrationStatus().equals("UNREGISTERED")) {
            boolean found = false;
            List<StoragePoolRestRep> storagepools = StoragePoolUtils.getStoragePools(id);
            for (StoragePoolRestRep storagepool : storagepools) {
                if (connectedstoragepools.contains(storagepool.getId().toString())) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                failedArrays.add(storageSystem.getName());
            }
        }
    }
    renderJSON(failedArrays);
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) HashSet(java.util.HashSet)

Example 12 with StorageSystemRestRep

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

the class StorageProviders method getAllFlashStorageSystemsList.

public static void getAllFlashStorageSystemsList(@As(",") String[] ids) {
    List<Map<String, String>> storagesystemslist = new ArrayList<Map<String, String>>();
    for (String id : ids) {
        if (id.contains(PROVIDER_TYPE)) {
            StorageProviderRestRep storageProvider = StorageProviderUtils.getStorageProvider(uri(id));
            if (storageProvider == null) {
                continue;
            }
            Set<NamedRelatedResourceRep> storageSystems = StorageProviderUtils.getConnectedStorageSystems(uri(id));
            for (NamedRelatedResourceRep storageSystem : storageSystems) {
                StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(storageSystem.getId());
                if (ss != null && !ss.getRegistrationStatus().equals(UNREGESTERD)) {
                    Map<String, String> ssMap = new HashMap<String, String>();
                    // Check if storage system is of type UNITY, VMAX or XtremIO
                    if (StringUtils.equals(XTREMIO, ss.getSystemType())) {
                        ssMap.put("id", ss.getId().toString());
                        ssMap.put("name", ss.getName());
                        storagesystemslist.add(ssMap);
                    }
                    if (StringUtils.equals(VMAX, ss.getSystemType())) {
                        String modelType = ss.getModel();
                        if (modelType != null && (modelType.contains(SUFFIX_ALL_FLASH) || modelType.contains(POWERMAX) || modelType.contains(PMAX))) {
                            ssMap.put("id", ss.getId().toString());
                            ssMap.put("name", ss.getName());
                            storagesystemslist.add(ssMap);
                        }
                    }
                }
            }
        } else {
            StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(id);
            if (ss != null && !ss.getRegistrationStatus().equals(UNREGESTERD)) {
                Logger.info(ss.getId() + "-----" + ss.getSystemType());
                Map<String, String> ssMap = new HashMap<String, String>();
                // Check if storage system is of type UNITY, VMAX or XtremIO
                if (StringUtils.equals(XTREMIO, ss.getSystemType())) {
                    ssMap.put("id", ss.getId().toString());
                    ssMap.put("name", ss.getName());
                    storagesystemslist.add(ssMap);
                }
                if (StringUtils.equals(VMAX, ss.getSystemType()) || StringUtils.equals(UNITY, ss.getSystemType())) {
                    String modelType = ss.getModel();
                    if (modelType != null && (modelType.contains(SUFFIX_ALL_FLASH) || modelType.contains(POWERMAX) || modelType.contains(PMAX))) {
                        ssMap.put("id", ss.getId().toString());
                        ssMap.put("name", ss.getName());
                        storagesystemslist.add(ssMap);
                    }
                }
            }
        }
    }
    renderJSON(storagesystemslist);
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) HashMap(java.util.HashMap) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) HashMap(java.util.HashMap) Map(java.util.Map) DefaultStorageProviderPortMap(util.DefaultStorageProviderPortMap)

Example 13 with StorageSystemRestRep

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

the class StorageProviders method discoveryCheckJson.

public static void discoveryCheckJson(@As(",") String[] ids) {
    List<String> failedDiscovery = new ArrayList<String>();
    for (String id : ids) {
        StorageProviderRestRep storageProvider = StorageProviderUtils.getStorageProvider(uri(id));
        if (storageProvider == null || storageProvider.getRegistrationStatus().equals(UNREGESTERD)) {
            // ignore for now
            continue;
        }
        if (!storageProvider.getScanStatus().equals("COMPLETE")) {
            failedDiscovery.add(storageProvider.getName());
            continue;
        }
        Set<NamedRelatedResourceRep> storageSystems = StorageProviderUtils.getConnectedStorageSystems(uri(id));
        boolean ssFound = false;
        for (NamedRelatedResourceRep storageSystem : storageSystems) {
            StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(storageSystem.getId());
            if (ss != null) {
                if (!ss.getDiscoveryJobStatus().equals("COMPLETE")) {
                    continue;
                } else {
                    ssFound = true;
                }
            }
        }
        if (!ssFound) {
            failedDiscovery.add(storageProvider.getName());
            continue;
        }
    }
    renderJSON(failedDiscovery);
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 14 with StorageSystemRestRep

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

the class VirtualArrays method getConnectedStorage.

public static void getConnectedStorage() {
    List<VirtualArrayRestRep> virtualarrays = VirtualArrayUtils.getVirtualArrays();
    Set<String> connectedstoragesystems = new HashSet<String>();
    for (VirtualArrayRestRep virtualarray : virtualarrays) {
        for (StorageSystemRestRep storageSystem : StorageSystemUtils.getStorageSystemsByVirtualArray(virtualarray.getId().toString())) {
            connectedstoragesystems.add(storageSystem.getId().toString());
        }
    }
    renderJSON(connectedstoragesystems);
}
Also used : VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) HashSet(java.util.HashSet)

Example 15 with StorageSystemRestRep

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

the class VirtualArrays method getDisconnectedStorage.

public static void getDisconnectedStorage(@As(",") String[] ids) {
    Set<String> connectedstoragesystems = new HashSet<String>();
    Set<String> disConnectedstoragesystems = new HashSet<String>();
    JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
    if (dataObject != null) {
        JsonArray varrays = dataObject.getAsJsonArray(VARRAYS);
        if (varrays != null) {
            for (Object virtualarray : varrays) {
                JsonObject varrayobject = (JsonObject) virtualarray;
                String varrayid = varrayobject.get("id").getAsString();
                VirtualArrayRestRep virtualArrayRestRep = VirtualArrayUtils.getVirtualArray(varrayid);
                if (virtualArrayRestRep == null || virtualArrayRestRep.getInactive()) {
                    // ignore for now
                    continue;
                }
                for (StorageSystemRestRep storageSystem : StorageSystemUtils.getStorageSystemsByVirtualArray(varrayid)) {
                    connectedstoragesystems.add(storageSystem.getId().toString());
                }
            }
        }
    }
    for (String id : ids) {
        StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
        if (storageSystem == null || storageSystem.getRegistrationStatus().equals("UNREGISTERED")) {
            // ignore for now
            continue;
        }
        if (!connectedstoragesystems.contains(id)) {
            disConnectedstoragesystems.add(storageSystem.getName());
        }
    }
    renderJSON(disConnectedstoragesystems);
}
Also used : JsonArray(com.google.gson.JsonArray) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) HashSet(java.util.HashSet)

Aggregations

StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)44 URI (java.net.URI)11 ArrayList (java.util.ArrayList)10 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)7 HashSet (java.util.HashSet)7 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)6 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)5 Asset (com.emc.sa.asset.annotation.Asset)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)3 StorageProviderRestRep (com.emc.storageos.model.smis.StorageProviderRestRep)3 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 HashMap (java.util.HashMap)3 GetStorageSystems (com.emc.sa.service.vipr.tasks.GetStorageSystems)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)2