Search in sources :

Example 1 with NetAppCException

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

the class NetAppClusterModeDevice method doDeleteSnapshot.

@Override
public BiosCommandResult doDeleteSnapshot(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    if (null == args.getFsName()) {
        throw new DeviceControllerException("Filesystem name is either missing or empty", new Object[] {});
    }
    if (null == args.getSnapshotName()) {
        throw new DeviceControllerException("Snapshot name is either missing or empty for filesystem name {0}", new Object[] { args.getFsName() });
    }
    _log.info("NetAppClusterModeDevice doDeleteSnapshot: {},{} - start", args.getSnapshotId(), args.getSnapshotName());
    BiosCommandResult result = new BiosCommandResult();
    String portGroup = findSVMName(args.getFs());
    NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
    try {
        if (!ncApi.deleteSnapshot(args.getFsName(), args.getSnapshotName())) {
            _log.error("NetAppClusterModeDevice doDeleteSnapshot {} - failed", args.getFsId());
            result.setCommandSuccess(false);
            result.setMessage("NetAppClusterModeDevice doDeleteSnapshot - failed");
            result.setCommandStatus(Operation.Status.error.name());
        } else {
            _log.info("doDeleteSnapshot for snapshot {} on filesystem {} successful", args.getSnapshotName(), args.getFsName());
            result.setCommandSuccess(true);
            result.setCommandStatus(Operation.Status.ready.name());
            result.setMessage("Snapshot," + args.getSnapshotName() + " has been successfully deleted");
        }
    } catch (NetAppCException e) {
        throw new DeviceControllerException("Failed to delete snapshot, {0} for filesystem, {1} with: {2}", new Object[] { args.getSnapshotName(), args.getFsName(), e.getMessage() });
    }
    return result;
}
Also used : NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 2 with NetAppCException

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

the class NetAppClusterModeDevice method doDeleteQuotaDirectory.

@Override
public BiosCommandResult doDeleteQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doDeleteQuotaDirectory - start");
        // Using NetApp terminology here
        String volName = args.getFsName();
        String qtreeName = args.getQuotaDirectoryName();
        String method = new String("doDeleteQuotaDirectory");
        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.deleteQtree(qtreeName, volName, portGroup);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doDeleteQuotaDirectory failed with a NetAppCException", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteQtree();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doDeleteQuotaDirectory failed with an Exception ", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteQtree();
        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 3 with NetAppCException

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

the class NetAppClusterModeDevice method doUpdateQuotaDirectory.

@Override
public BiosCommandResult doUpdateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qtree) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doUpdateQuotaDirectory - 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("doUpdateQuotaDirectory");
        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.updateQtree(qtreeName, volName, oplocks, securityStyle, size, portGroup);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doUpdateQuotaDirectory failed with a NetAppCException", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToUpdateQtree();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doUpdateQuotaDirectory failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToUpdateQtree();
        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 4 with NetAppCException

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

the class NetAppClusterModeDevice method doDeleteFS.

@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doDeleteFS - start");
        if (null == args.getFsName()) {
            _log.error("NetAppClusterModeDevice::doDeletFS failed:  Filesystem name is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteFileSystem();
            serviceError.setMessage("Filesystem name is either missing or empty");
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        // Now get the SVM from the fileShare
        String portGroup = findSVMName(args.getFs());
        if (null != args.getFsShares() && !args.getFsShares().isEmpty()) {
            if (!netAppDeleteCIFSExports(storage, args.getFsShares(), portGroup)) {
                _log.info("NetAppClusterModeDevice doDeletFS:netAppDeleteCIFSExports {} - failed", args.getFsName());
            } else {
                _log.info("NetAppClusterModeDevice doDeletFS:netAppDeleteCIFSExports {} - succeeded", args.getFsName());
            }
        }
        boolean failedStatus = false;
        NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
        if (!ncApi.deleteFS(args.getFsName())) {
            failedStatus = true;
        }
        if (failedStatus == true) {
            _log.error("NetAppClusterModeDevice doDeletFS {} - failed", args.getFsName());
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteFileSystem();
            result = BiosCommandResult.createErrorResult(serviceError);
        } else {
            _log.info("NetAppClusterModeDevice doDeletFS {} - complete", args.getFsName());
            result = BiosCommandResult.createSuccessfulResult();
        }
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doDeleteFS failed with a NetAppCException", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doDeleteFS failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteFileSystem();
        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 5 with NetAppCException

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

the class NetAppClusterModeDevice method doShare.

@Override
public BiosCommandResult doShare(StorageSystem storage, FileDeviceInputOutput args, SMBFileShare smbFileShare) throws ControllerException {
    // To be in-sync with isilon implementation, currently forceGroup is
    // set to null which will set the group name as "everyone" by default.
    String forceGroup = null;
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppClusterModeDevice doShare - start");
        SMBShareMap smbShareMap = args.getFileObjShares();
        SMBFileShare existingShare = (smbShareMap == null) ? null : smbShareMap.get(smbFileShare.getName());
        Boolean modOrCreateShareSuccess = false;
        if (existingShare != null) {
            modOrCreateShareSuccess = modifyNtpShare(storage, args, smbFileShare, forceGroup, existingShare);
        } else if (existingShare == null) {
            modOrCreateShareSuccess = createNtpShare(storage, args, smbFileShare, forceGroup);
        }
        if (modOrCreateShareSuccess.booleanValue() == true) {
            _log.info("NetAppClusterModeDevice doShare {} - complete", smbFileShare.getName());
            // Update the collection.
            if (args.getFileObjShares() == null) {
                args.initFileObjShares();
            }
            // set Mount Point
            smbFileShare.setMountPoint(smbFileShare.getNetBIOSName(), smbFileShare.getStoragePortNetworkId(), smbFileShare.getStoragePortName(), smbFileShare.getName());
            args.getFileObjShares().put(smbFileShare.getName(), smbFileShare);
            result = BiosCommandResult.createSuccessfulResult();
        } else {
            _log.error("NetAppClusterModeDevice doShare {} - failed", smbFileShare.getName());
            ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileShare();
            result = BiosCommandResult.createErrorResult(serviceError);
        }
    } catch (NetAppCException e) {
        _log.error("NetAppClusterModeDevice::doShare failed with a NetAppCException", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileShare();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::doShare failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToCreateFileShare();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppCException(com.emc.storageos.netappc.NetAppCException) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) 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