Search in sources :

Example 1 with IsilonCollectionException

use of com.emc.storageos.plugins.metering.isilon.IsilonCollectionException in project coprhd-controller by CoprHD.

the class IsilonFileStorageDevice method doesSnapshotExistsForFSPath.

private boolean doesSnapshotExistsForFSPath(StorageSystem storageSystem, String isilonAccessZone, String path) throws IsilonCollectionException {
    URI storageSystemId = storageSystem.getId();
    String resumeToken = null;
    try {
        _log.info("Checking snapshots for path {}  on Isilon storage system: {} in access zone {} - start", path, storageSystem.getLabel(), isilonAccessZone);
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        do {
            IsilonList<IsilonSnapshot> isilonSnapshots = isilonApi.listSnapshots(resumeToken, path);
            List<IsilonSnapshot> snpashots = isilonSnapshots.getList();
            for (IsilonSnapshot snapshot : snpashots) {
                if (snapshot.getPath() == null || snapshot.getPath().isEmpty()) {
                    _log.info("Ignoring snapshot {} as it is not having any path", snapshot);
                    continue;
                }
                if (snapshot.getPath().equals(path)) {
                    _log.info("Found snapshot on path {} in Ision: {}", path, storageSystem.getLabel());
                    return true;
                }
            }
            resumeToken = isilonSnapshots.getToken();
        } while (resumeToken != null);
        _log.info("Snapshots not found with path {} on Ision: {} in access zone: {}", path, storageSystem.getLabel(), isilonAccessZone);
        return false;
    } catch (IsilonException ie) {
        _log.error("doesSnapshotExistsForFSPath failed. Storage system: {}", storageSystemId, ie);
        IsilonCollectionException ice = new IsilonCollectionException("doesSnapshotExistsForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(ie);
        throw ice;
    } catch (Exception e) {
        _log.error("doesSnapshotExistsForFSPath failed. Storage system: {}", storageSystemId, e);
        IsilonCollectionException ice = new IsilonCollectionException("doesSnapshotExistsForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(e);
        throw ice;
    }
}
Also used : IsilonSnapshot(com.emc.storageos.isilon.restapi.IsilonSnapshot) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 2 with IsilonCollectionException

use of com.emc.storageos.plugins.metering.isilon.IsilonCollectionException in project coprhd-controller by CoprHD.

the class IsilonFileStorageDevice method doesCIFSShareExistsForFSPath.

private boolean doesCIFSShareExistsForFSPath(final StorageSystem storageSystem, String isilonAccessZone, String path) {
    String resumeToken = null;
    URI storageSystemId = storageSystem.getId();
    _log.info("Checking CIFS share for path {}  on Isilon storage system: {} in access zone {} - start", path, storageSystem.getLabel(), isilonAccessZone);
    try {
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        do {
            IsilonApi.IsilonList<IsilonSMBShare> isilonShares = isilonApi.listShares(resumeToken, isilonAccessZone);
            List<IsilonSMBShare> isilonSMBShareList = isilonShares.getList();
            for (IsilonSMBShare share : isilonSMBShareList) {
                if (share.getPath().equals(path)) {
                    _log.info("Found CIFS share with path {} and name {} on Ision: {} in access zone: {}", path, share.getName(), storageSystem.getLabel(), isilonAccessZone);
                    return true;
                }
            }
            resumeToken = isilonShares.getToken();
        } while (resumeToken != null);
        _log.info("CIFS share not found with path {} on Ision: {} in access zone: {}", path, storageSystem.getLabel(), isilonAccessZone);
        return false;
    } catch (IsilonException ie) {
        _log.error("doesCIFSShareExistForFSPath failed. Storage system: {}", storageSystemId, ie);
        IsilonCollectionException ice = new IsilonCollectionException("doesCIFSShareExistForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(ie);
        throw ice;
    } catch (Exception e) {
        _log.error("doesCIFSShareExistForFSPath failed. Storage system: {}", storageSystemId, e);
        IsilonCollectionException ice = new IsilonCollectionException("doesCIFSShareExistForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(e);
        throw ice;
    }
}
Also used : IsilonSMBShare(com.emc.storageos.isilon.restapi.IsilonSMBShare) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 3 with IsilonCollectionException

use of com.emc.storageos.plugins.metering.isilon.IsilonCollectionException in project coprhd-controller by CoprHD.

the class IsilonFileStorageDevice method doesNFSExportExistsForFSPath.

private boolean doesNFSExportExistsForFSPath(StorageSystem storageSystem, String isilonAccessZone, String path) throws IsilonCollectionException {
    URI storageSystemId = storageSystem.getId();
    String resumeToken = null;
    try {
        _log.info("Checking NFS export for path {}  on Isilon storage system: {} in access zone {} - start", path, storageSystem.getLabel(), isilonAccessZone);
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        do {
            IsilonApi.IsilonList<IsilonExport> isilonExports = isilonApi.listExports(resumeToken, isilonAccessZone);
            List<IsilonExport> exports = isilonExports.getList();
            for (IsilonExport exp : exports) {
                if (exp.getPaths() == null || exp.getPaths().isEmpty()) {
                    _log.info("Ignoring export {} as it is not having any path", exp);
                    continue;
                }
                // Ignore Export with multiple paths
                if (exp.getPaths().size() > 1) {
                    _log.info("Isilon Export: {} has multiple paths. So ingnore it.", exp);
                    continue;
                }
                String exportPath = exp.getPaths().get(0);
                if (exportPath.equals(path)) {
                    _log.info("Found NFS export with path {} on Ision: {} in access zone: {}", path, storageSystem.getLabel(), isilonAccessZone);
                    return true;
                }
            }
            resumeToken = isilonExports.getToken();
        } while (resumeToken != null);
        _log.info("NFS export not found with path {} on Ision: {} in access zone: {}", path, storageSystem.getLabel(), isilonAccessZone);
        return false;
    } catch (IsilonException ie) {
        _log.error("doesNFSExportExistsForFSPath failed. Storage system: {}", storageSystemId, ie);
        IsilonCollectionException ice = new IsilonCollectionException("doesNFSExportExistsForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(ie);
        throw ice;
    } catch (Exception e) {
        _log.error("doesNFSExportExistsForFSPath failed. Storage system: {}", storageSystemId, e);
        IsilonCollectionException ice = new IsilonCollectionException("doesNFSExportExistsForFSPath failed. Storage system: " + storageSystemId);
        ice.initCause(e);
        throw ice;
    }
}
Also used : IsilonExport(com.emc.storageos.isilon.restapi.IsilonExport) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 4 with IsilonCollectionException

use of com.emc.storageos.plugins.metering.isilon.IsilonCollectionException in project coprhd-controller by CoprHD.

the class IsilonCommunicationInterface method discoverAccessZoneSMBShares.

/**
 * Get all SMB shares of storagesystem
 *
 * @param storageSystem
 * @return
 */
private HashMap<String, HashSet<String>> discoverAccessZoneSMBShares(final StorageSystem storageSystem, String isilonAccessZone) {
    // Discover All FileShares
    String resumeToken = null;
    HashMap<String, HashSet<String>> allShares = new HashMap<String, HashSet<String>>();
    URI storageSystemId = storageSystem.getId();
    _log.info("discoverAllShares for storage system {} - start", storageSystemId);
    try {
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        do {
            IsilonApi.IsilonList<IsilonSMBShare> isilonShares = isilonApi.listShares(resumeToken, isilonAccessZone);
            List<IsilonSMBShare> isilonSMBShareList = isilonShares.getList();
            HashSet<String> sharesHashSet = null;
            for (IsilonSMBShare share : isilonSMBShareList) {
                // get the filesystem path and shareid
                String path = share.getPath();
                String shareId = share.getId();
                sharesHashSet = allShares.get(path);
                if (null == sharesHashSet) {
                    sharesHashSet = new HashSet<String>();
                    sharesHashSet.add(shareId);
                    allShares.put(path, sharesHashSet);
                } else {
                    // if shares already exist for path then add
                    sharesHashSet.add(shareId);
                    allShares.put(path, sharesHashSet);
                }
                _log.info("Discovered SMB Share name {} and path {}", shareId, path);
            }
            resumeToken = isilonShares.getToken();
        } while (resumeToken != null);
        _log.info("discoverd AllShares for access zone {} ", isilonAccessZone);
        return allShares;
    } catch (IsilonException ie) {
        _log.error("discoverAllShares failed. Storage system: {}", storageSystemId, ie);
        IsilonCollectionException ice = new IsilonCollectionException("discoverAllShares failed. Storage system: " + storageSystemId);
        ice.initCause(ie);
        throw ice;
    } catch (Exception e) {
        _log.error("discoverAllShares failed. Storage system: {}", storageSystemId, e);
        IsilonCollectionException ice = new IsilonCollectionException("discoverAllShares failed. Storage system: " + storageSystemId);
        ice.initCause(e);
        throw ice;
    }
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) URI(java.net.URI) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) IsilonSMBShare(com.emc.storageos.isilon.restapi.IsilonSMBShare) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) HashSet(java.util.HashSet) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 5 with IsilonCollectionException

use of com.emc.storageos.plugins.metering.isilon.IsilonCollectionException in project coprhd-controller by CoprHD.

the class IsilonCommunicationInterface method discoverCluster.

private void discoverCluster(StorageSystem storageSystem) throws IsilonCollectionException {
    URI storageSystemId = storageSystem.getId();
    try {
        _log.info("discoverCluster information for storage system {} - start", storageSystemId);
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        IsilonClusterConfig clusterConfig = isilonApi.getClusterConfig();
        storageSystem.setSerialNumber(clusterConfig.getGuid());
        String nativeGuid = NativeGUIDGenerator.generateNativeGuid(DiscoveredDataObject.Type.isilon.toString(), clusterConfig.getGuid());
        storageSystem.setNativeGuid(nativeGuid);
        String clusterReleaseVersion = clusterConfig.getOnefs_version_info().getReleaseVersionNumber();
        storageSystem.setFirmwareVersion(clusterReleaseVersion);
        String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(storageSystem.getSystemType()));
        _log.info("Verifying version details : Minimum Supported Version {} - Discovered Cluster Version {}", minimumSupportedVersion, clusterReleaseVersion);
        if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, clusterReleaseVersion) < 0) {
            storageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
            storageSystem.setReachableStatus(false);
            DiscoveryUtils.setSystemResourcesIncompatible(_dbClient, _coordinator, storageSystem.getId());
            IsilonCollectionException ice = new IsilonCollectionException(String.format(" ** This version of Isilon firmware is not supported ** Should be a minimum of %s", minimumSupportedVersion));
            throw ice;
        }
        storageSystem.setSupportSoftLimit(false);
        storageSystem.setSupportNotificationLimit(false);
        // Check license status for smart quota and set the support attributes as true
        if (ACTIVATED.equalsIgnoreCase(isilonApi.getLicenseInfo(IsilonLicenseType.SMARTQUOTA)) || EVALUATION.equalsIgnoreCase(isilonApi.getLicenseInfo(IsilonLicenseType.SMARTQUOTA))) {
            storageSystem.setSupportSoftLimit(true);
            storageSystem.setSupportNotificationLimit(true);
        }
        storageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
        storageSystem.setReachableStatus(true);
        _log.info("discoverCluster information for storage system {} - complete", storageSystemId);
    } catch (Exception e) {
        storageSystem.setReachableStatus(false);
        String errMsg = String.format("discoverCluster failed. %s", e.getMessage());
        _log.error(errMsg, e);
        IsilonCollectionException ice = new IsilonCollectionException(errMsg);
        throw ice;
    }
}
Also used : IsilonClusterConfig(com.emc.storageos.isilon.restapi.IsilonClusterConfig) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) URI(java.net.URI) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException)

Aggregations

IsilonCollectionException (com.emc.storageos.plugins.metering.isilon.IsilonCollectionException)15 IsilonApi (com.emc.storageos.isilon.restapi.IsilonApi)14 IsilonException (com.emc.storageos.isilon.restapi.IsilonException)14 URI (java.net.URI)14 URISyntaxException (java.net.URISyntaxException)14 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)11 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 IOException (java.io.IOException)11 JSONException (org.codehaus.jettison.json.JSONException)11 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7 IsilonList (com.emc.storageos.isilon.restapi.IsilonApi.IsilonList)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5 HashSet (java.util.HashSet)5 List (java.util.List)4 FileShare (com.emc.storageos.db.client.model.FileShare)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)3 StoragePort (com.emc.storageos.db.client.model.StoragePort)3