Search in sources :

Example 16 with NetAppCException

use of com.emc.storageos.netappc.NetAppCException in project coprhd-controller by CoprHD.

the class NetAppClusterModeCommIntf method discoverAll.

public void discoverAll(AccessProfile accessProfile) throws BaseCollectionException {
    URI storageSystemId = null;
    StorageSystem storageSystem = null;
    String detailedStatusMessage = "Unknown Status";
    try {
        _logger.info("Access Profile Details :  IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
        storageSystemId = accessProfile.getSystemId();
        storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
        // Retrieve NetAppC Filer information.
        discoverFilerInfo(storageSystem);
        String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(storageSystem.getSystemType()));
        String firmwareVersion = storageSystem.getFirmwareVersion();
        // Example version String for NetappC looks like 8.2
        _logger.info("Verifying version details : Minimum Supported Version {} - Discovered NetApp Cluster Mode Version {}", minimumSupportedVersion, firmwareVersion);
        if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, firmwareVersion) < 0) {
            storageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
            storageSystem.setReachableStatus(false);
            DiscoveryUtils.setSystemResourcesIncompatible(_dbClient, _coordinator, storageSystem.getId());
            throw new NetAppCException(String.format(" ** This version of NetApp Cluster Mode is not supported ** Should be a minimum of %s", minimumSupportedVersion));
        }
        storageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
        storageSystem.setReachableStatus(true);
        _dbClient.persistObject(storageSystem);
        if (!storageSystem.getReachableStatus()) {
            throw new NetAppCException("Failed to connect to " + storageSystem.getIpAddress());
        }
        _completer.statusPending(_dbClient, "Identified physical storage");
        List<StorageVirtualMachineInfo> svms = new ArrayList<StorageVirtualMachineInfo>();
        Map<String, List<StorageHADomain>> groups = discoverPortGroups(storageSystem, svms);
        _logger.info("No of newly discovered groups {}", groups.get(NEW).size());
        _logger.info("No of existing discovered groups {}", groups.get(EXISTING).size());
        if (!groups.get(NEW).isEmpty()) {
            _dbClient.createObject(groups.get(NEW));
        }
        if (!groups.get(EXISTING).isEmpty()) {
            _dbClient.persistObject(groups.get(EXISTING));
        }
        List<StoragePool> poolsToMatchWithVpool = new ArrayList<StoragePool>();
        List<StoragePool> allPools = new ArrayList<StoragePool>();
        Map<String, List<StoragePool>> pools = discoverStoragePools(storageSystem, poolsToMatchWithVpool);
        _logger.info("No of newly discovered pools {}", pools.get(NEW).size());
        _logger.info("No of existing discovered pools {}", pools.get(EXISTING).size());
        if (!pools.get(NEW).isEmpty()) {
            allPools.addAll(pools.get(NEW));
            _dbClient.createObject(pools.get(NEW));
        }
        if (!pools.get(EXISTING).isEmpty()) {
            allPools.addAll(pools.get(EXISTING));
            _dbClient.persistObject(pools.get(EXISTING));
        }
        List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(allPools, _dbClient, storageSystemId);
        if (notVisiblePools != null && !notVisiblePools.isEmpty()) {
            poolsToMatchWithVpool.addAll(notVisiblePools);
        }
        _completer.statusPending(_dbClient, "Completed pool discovery");
        // discover ports
        List<StoragePort> allPorts = new ArrayList<StoragePort>();
        Map<String, List<StoragePort>> ports = discoverPorts(storageSystem, svms, groups.get(NEW));
        _logger.info("No of newly discovered port {}", ports.get(NEW).size());
        _logger.info("No of existing discovered port {}", ports.get(EXISTING).size());
        if (!ports.get(NEW).isEmpty()) {
            allPorts.addAll(ports.get(NEW));
            _dbClient.createObject(ports.get(NEW));
        }
        if (!ports.get(EXISTING).isEmpty()) {
            allPorts.addAll(ports.get(EXISTING));
            _dbClient.persistObject(ports.get(EXISTING));
        }
        List<StoragePort> notVisiblePorts = DiscoveryUtils.checkStoragePortsNotVisible(allPorts, _dbClient, storageSystemId);
        _completer.statusPending(_dbClient, "Completed port discovery");
        List<StoragePort> allExistingPorts = new ArrayList<StoragePort>(ports.get(EXISTING));
        if (notVisiblePorts != null && !notVisiblePorts.isEmpty()) {
            allExistingPorts.addAll(notVisiblePorts);
        }
        StoragePortAssociationHelper.runUpdatePortAssociationsProcess(ports.get(NEW), allExistingPorts, _dbClient, _coordinator, poolsToMatchWithVpool);
        // discovery succeeds
        detailedStatusMessage = String.format("Discovery completed successfully for Storage System: %s", storageSystemId.toString());
    } catch (Exception e) {
        if (null != storageSystem) {
            cleanupDiscovery(storageSystem);
        }
        detailedStatusMessage = String.format("Discovery failed for Storage System: %s because %s", storageSystemId.toString(), e.getLocalizedMessage());
        _logger.error(detailedStatusMessage, e);
        throw new NetAppCException(detailedStatusMessage);
    } finally {
        if (storageSystem != null) {
            try {
                // set detailed message
                storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.persistObject(storageSystem);
            } catch (DatabaseException ex) {
                _logger.error("Error while persisting object to DB", ex);
            }
        }
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) ArrayList(java.util.ArrayList) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) NetAppException(com.emc.storageos.netapp.NetAppException) NetAppCException(com.emc.storageos.netappc.NetAppCException) IOException(java.io.IOException) NetAppCException(com.emc.storageos.netappc.NetAppCException) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageVirtualMachineInfo(com.iwave.ext.netappc.StorageVirtualMachineInfo) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 17 with NetAppCException

use of com.emc.storageos.netappc.NetAppCException in project coprhd-controller by CoprHD.

the class NetAppClusterModeCommIntf method discoverUmanagedFileSystems.

private void discoverUmanagedFileSystems(AccessProfile profile) {
    URI storageSystemId = profile.getSystemId();
    StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
    if (null == storageSystem) {
        return;
    }
    String detailedStatusMessage = "Discovery of NetApp Cluster Mode Unmanaged FileSystem started";
    List<UnManagedFileSystem> unManagedFileSystems = new ArrayList<UnManagedFileSystem>();
    List<UnManagedFileSystem> existingUnManagedFileSystems = new ArrayList<UnManagedFileSystem>();
    int newFileSystemsCount = 0;
    int existingFileSystemsCount = 0;
    Set<URI> allDiscoveredUnManagedFileSystems = new HashSet<URI>();
    NetAppClusterApi netAppCApi = new NetAppClusterApi.Builder(storageSystem.getIpAddress(), storageSystem.getPortNumber(), storageSystem.getUsername(), storageSystem.getPassword()).https(true).build();
    Collection<String> attrs = new ArrayList<String>();
    for (String property : ntpPropertiesList) {
        attrs.add(SupportedNtpFileSystemInformation.getFileSystemInformation(property));
    }
    try {
        StoragePort storagePort = getStoragePortPool(storageSystem);
        URIQueryResultList storagePoolURIs = new URIQueryResultList();
        _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePoolConstraint(storageSystem.getId()), storagePoolURIs);
        HashMap<String, StoragePool> pools = new HashMap();
        Iterator<URI> poolsItr = storagePoolURIs.iterator();
        while (poolsItr.hasNext()) {
            URI storagePoolURI = poolsItr.next();
            StoragePool storagePool = _dbClient.queryObject(StoragePool.class, storagePoolURI);
            pools.put(storagePool.getNativeGuid(), storagePool);
        }
        // Retrieve all the file system and SVM info.
        List<Map<String, String>> fileSystemInfo = netAppCApi.listVolumeInfo(null, attrs);
        List<StorageVirtualMachineInfo> svms = netAppCApi.listSVM();
        for (Map<String, String> fileSystemChar : fileSystemInfo) {
            String poolName = fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.STORAGE_POOL.toString()));
            String filesystem = fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.NAME.toString()));
            boolean isSVMRootVolume = Boolean.valueOf(fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.IS_SVM_ROOT.toString())));
            boolean isNodeRootVolume = Boolean.valueOf(fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.IS_NODE_ROOT.toString())));
            String path = fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.PATH.toString()));
            String state = fileSystemChar.get(SupportedNtpFileSystemInformation.getFileSystemInformation(SupportedNtpFileSystemInformation.STATE.toString()));
            String poolNativeGuid = NativeGUIDGenerator.generateNativeGuid(storageSystem, poolName, NativeGUIDGenerator.POOL);
            StoragePool pool = pools.get(poolNativeGuid);
            String nativeId;
            if ("".equals(filesystem)) {
                continue;
            }
            if (filesystem.startsWith(VOL_ROOT)) {
                nativeId = filesystem;
            } else {
                nativeId = VOL_ROOT + filesystem;
            }
            String fsNativeGuid = NativeGUIDGenerator.generateNativeGuid(storageSystem.getSystemType(), storageSystem.getSerialNumber(), nativeId);
            // Ignore export for root volume and don't pull it into ViPR db.
            if (isNodeRootVolume || isSVMRootVolume) {
                _logger.info("Ignore and not discover root" + filesystem + "on NTP array");
                continue;
            }
            // Ignore volume that is offline and don't pull it into ViPR db.
            if (state.equalsIgnoreCase(VOLUME_STATE_OFFLINE)) {
                _logger.info("Ignoring volume " + filesystem + " as it is offline");
                continue;
            }
            // to create an UnManaged Filesystems.
            if (checkStorageFileSystemExistsInDB(fsNativeGuid)) {
                continue;
            }
            _logger.debug("retrieve info for file system: " + filesystem);
            String svm = getOwningSVM(filesystem, fileSystemInfo);
            String address = getSVMAddress(svm, svms);
            if (svm != null && !svm.isEmpty()) {
                // Need to use storage port for SVM.
                String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(storageSystem, address, NativeGUIDGenerator.PORT);
                storagePort = getSVMStoragePort(storageSystem, portNativeGuid, svm);
            }
            String fsUnManagedFsNativeGuid = NativeGUIDGenerator.generateNativeGuidForPreExistingFileSystem(storageSystem.getSystemType(), storageSystem.getSerialNumber().toUpperCase(), nativeId);
            UnManagedFileSystem unManagedFs = checkUnManagedFileSystemExistsInDB(fsUnManagedFsNativeGuid);
            boolean alreadyExist = unManagedFs == null ? false : true;
            unManagedFs = createUnManagedFileSystem(unManagedFs, profile, fsUnManagedFsNativeGuid, nativeId, storageSystem, pool, filesystem, storagePort, fileSystemChar);
            if (alreadyExist) {
                existingUnManagedFileSystems.add(unManagedFs);
                existingFileSystemsCount++;
            } else {
                unManagedFileSystems.add(unManagedFs);
                newFileSystemsCount++;
            }
            allDiscoveredUnManagedFileSystems.add(unManagedFs.getId());
            /**
             * Persist 200 objects and clear them to avoid memory issue
             */
            validateListSizeLimitAndPersist(unManagedFileSystems, existingUnManagedFileSystems, Constants.DEFAULT_PARTITION_SIZE * 2);
        }
        // Process those active unmanaged fs objects available in database but not in newly discovered items, to
        // mark them inactive.
        markUnManagedFSObjectsInActive(storageSystem, allDiscoveredUnManagedFileSystems);
        _logger.info("New unmanaged NetappC file systems count: {}", newFileSystemsCount);
        _logger.info("Update unmanaged NetappC file systems count: {}", existingFileSystemsCount);
        if (!unManagedFileSystems.isEmpty()) {
            // Add UnManagedFileSystem
            _partitionManager.insertInBatches(unManagedFileSystems, Constants.DEFAULT_PARTITION_SIZE, _dbClient, UNMANAGED_FILESYSTEM);
        }
        if (!existingUnManagedFileSystems.isEmpty()) {
            // Update UnManagedFilesystem
            _partitionManager.updateAndReIndexInBatches(existingUnManagedFileSystems, Constants.DEFAULT_PARTITION_SIZE, _dbClient, UNMANAGED_FILESYSTEM);
        }
        // discovery succeeds
        detailedStatusMessage = String.format("Discovery completed successfully for NetAppC: %s", storageSystemId.toString());
    } catch (NetAppCException ve) {
        if (null != storageSystem) {
            cleanupDiscovery(storageSystem);
        }
        _logger.error("discoverStorage failed.  Storage system: " + storageSystemId);
        throw ve;
    } catch (Exception e) {
        if (null != storageSystem) {
            cleanupDiscovery(storageSystem);
        }
        _logger.error("discoverStorage failed. Storage system: " + storageSystemId, e);
        throw NetAppCException.exceptions.discoveryFailed(storageSystemId.toString(), e);
    } finally {
        if (storageSystem != null) {
            try {
                // set detailed message
                storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.persistObject(storageSystem);
            } catch (Exception ex) {
                _logger.error("Error while persisting object to DB", ex);
            }
        }
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageVirtualMachineInfo(com.iwave.ext.netappc.StorageVirtualMachineInfo) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) HashSet(java.util.HashSet) StoragePort(com.emc.storageos.db.client.model.StoragePort) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) NetAppException(com.emc.storageos.netapp.NetAppException) NetAppCException(com.emc.storageos.netappc.NetAppCException) IOException(java.io.IOException) NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) NetAppCException(com.emc.storageos.netappc.NetAppCException) UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap) Map(java.util.Map) HashMap(java.util.HashMap) UnManagedSMBShareMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBShareMap) StringMap(com.emc.storageos.db.client.model.StringMap)

Example 18 with NetAppCException

use of com.emc.storageos.netappc.NetAppCException in project coprhd-controller by CoprHD.

the class NetAppClusterModeCommIntf method discoverFilerInfo.

/**
 * Discover the Control Station for the specified NTAP File storage array.
 * Since the StorageSystem object currently exists, this method updates
 * information in the object.
 *
 * @param system
 * @throws NetAppCException
 */
private void discoverFilerInfo(StorageSystem system) throws NetAppCException {
    _logger.info("Start Control Station discovery for storage system {}", system.getId());
    Map<String, String> systemInfo = new HashMap<String, String>();
    Map<String, String> systemVer = new HashMap<String, String>();
    NetAppClusterApi ncApi = new NetAppClusterApi.Builder(system.getIpAddress(), system.getPortNumber(), system.getUsername(), system.getPassword()).https(true).build();
    try {
        systemInfo = ncApi.clusterSystemInfo();
        systemVer = ncApi.systemVer();
        if ((null == systemInfo) || (systemInfo.size() <= 0)) {
            _logger.error("Failed to retrieve NetAppC Filer info!");
            system.setReachableStatus(false);
            return;
        }
        if ((null == systemVer) || (systemVer.size() <= 0)) {
            _logger.error("Failed to retrieve NetAppC Filer info!");
            system.setReachableStatus(false);
            return;
        }
        system.setReachableStatus(true);
        system.setSerialNumber(systemInfo.get(SYSTEM_SERIAL_NUM));
        String sysNativeGuid = NativeGUIDGenerator.generateNativeGuid(system);
        system.setNativeGuid(sysNativeGuid);
        system.setFirmwareVersion(systemVer.get(SYSTEM_FIRMWARE_REL));
        _logger.info("NetAppC Filer discovery for storage system {} complete", system.getId());
    } catch (Exception e) {
        _logger.error("Failed to retrieve NetAppC Filer info!");
        system.setReachableStatus(false);
        String msg = "exception occurred while attempting to retrieve NetAppC filer information. Storage system: " + system.getIpAddress() + " " + e.getMessage();
        _logger.error(msg);
        throw new NetAppCException(msg);
    }
}
Also used : NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) HashMap(java.util.HashMap) NetAppCException(com.emc.storageos.netappc.NetAppCException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) NetAppException(com.emc.storageos.netapp.NetAppException) NetAppCException(com.emc.storageos.netappc.NetAppCException) IOException(java.io.IOException)

Example 19 with NetAppCException

use of com.emc.storageos.netappc.NetAppCException in project coprhd-controller by CoprHD.

the class NetAppClusterModeDevice method doCreateFS.

@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doCreateFS - start");
        if (null == args.getFsName()) {
            _log.error("NetAppClusterModeDevice::doCreateFS failed:  Filesystem name is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
            serviceError.setMessage(FileSystemConstants.FS_ERR_FS_NAME_MISSING_OR_EMPTY);
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        if (null == args.getPoolNativeId()) {
            _log.error("NetAppClusterModeDevice::doCreateFS failed:  PoolNativeId either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
            serviceError.setMessage(FileSystemConstants.FS_ERR_POOL_NATIVE_ID_MISSING_OR_EMPTY);
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        if (null == args.getFsCapacity()) {
            _log.error("NetAppClusterModeDevice::doCreateFS failed:  Filesystem capacity is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
            serviceError.setMessage(FileSystemConstants.FS_ERR_FS_CAPACITY_MISSING_OR_EMPTY);
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        String nativeId = "/" + args.getFsName();
        args.setFsNativeId(nativeId);
        String fsNativeGuid = NativeGUIDGenerator.generateNativeGuid(storage.getSystemType(), storage.getSerialNumber(), nativeId);
        args.setFsNativeGuid(fsNativeGuid);
        String portGroup = findSVMName(args.getFs());
        NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
        Long fsSize = args.getFsCapacity() / BYTESPERMB;
        String strFsSize = fsSize.toString() + "m";
        if (!ncApi.createFS(args.getFsName(), args.getPoolNativeId(), strFsSize, args.getThinProvision())) {
            _log.error("NetAppClusterModeDevice doCreateFS {} - failed", args.getFsName());
            BiosCommandResult rollbackResult = doDeleteFS(storage, args);
            if (rollbackResult.isCommandSuccess()) {
                _log.info("NetAppClusterModeDevice doCreateFS rollback completed failed for fs, {}", args.getFsName());
            } else {
                _log.error("NetAppClusterModeDevice doCreateFS rollback failed for fs, {} with {}.", args.getFsName(), rollbackResult.getMessage());
            }
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
            result = BiosCommandResult.createErrorResult(serviceError);
        } else {
            _log.info("NetAppClusterModeDevice doCreateFS {} - complete", args.getFsName());
            // Set FS path and Mount Path information
            args.setFsPath(nativeId);
            args.setFsMountPath(nativeId);
            result = BiosCommandResult.createSuccessfulResult();
        }
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doCreateFS failed with a NetAppCException", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doCreateFS failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppCException(com.emc.storageos.netappc.NetAppCException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Example 20 with NetAppCException

use of com.emc.storageos.netappc.NetAppCException in project coprhd-controller by CoprHD.

the class NetAppClusterModeDevice method doCreateQuotaDirectory.

@Override
public BiosCommandResult doCreateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qtree) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doCreateQuotaDirectory - start");
        // Using NetApp terminology here
        String volName = args.getFsName();
        String qtreeName = args.getQuotaDirectoryName();
        Boolean oplocks = qtree.getOpLock();
        String securityStyle = qtree.getSecurityStyle();
        Long size = qtree.getSize();
        String method = new String("doCreateQuotaDirectory");
        result = validateQuotaDirectoryParams(volName, qtreeName, method);
        if (!result.isCommandSuccess()) {
            return result;
        }
        String portGroup = findSVMName(args.getFs());
        NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
        ncApi.createQtree(qtreeName, volName, oplocks, securityStyle, size, portGroup);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doCreateQuotaDirectory failed with a NetAppCException", e);
        _log.info("NetAppClusterModeDevice::doCreateQuotaDirectory e.getLocalizedMessage(): {}", e.getLocalizedMessage());
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateQtree();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doCreateQuotaDirectory failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateQtree();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppCException(com.emc.storageos.netappc.NetAppCException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Aggregations

NetAppCException (com.emc.storageos.netappc.NetAppCException)23 NetAppClusterApi (com.emc.storageos.netappc.NetAppClusterApi)20 NetAppException (com.emc.storageos.netapp.NetAppException)18 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)16 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)16 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)14 ControllerException (com.emc.storageos.volumecontroller.ControllerException)12 ArrayList (java.util.ArrayList)8 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)6 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)6 IOException (java.io.IOException)6 URI (java.net.URI)6 HashMap (java.util.HashMap)6 StorageVirtualMachineInfo (com.iwave.ext.netappc.StorageVirtualMachineInfo)5 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)4 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 List (java.util.List)4 FileShare (com.emc.storageos.db.client.model.FileShare)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)3