Search in sources :

Example 36 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class IsilonMirrorOperations method deleteMirrorFileShareLink.

public void deleteMirrorFileShareLink(StorageSystem system, URI source, URI target, TaskCompleter completer) throws DeviceControllerException {
    IsilonSyncPolicy policy;
    IsilonApi isi = null;
    BiosCommandResult cmdResult = null;
    FileShare targetFileShare = _dbClient.queryObject(FileShare.class, target);
    FileShare sourceFileShare = _dbClient.queryObject(FileShare.class, source);
    String policyName = targetFileShare.getLabel();
    StorageSystem sourceStorageSystem = _dbClient.queryObject(StorageSystem.class, sourceFileShare.getStorageDevice());
    isi = getIsilonDevice(sourceStorageSystem);
    try {
        policy = isi.getReplicationPolicy(policyName);
    } catch (IsilonException e) {
        _log.info("Not able to get policy : {} due to : {} ", policyName, e.getMessage());
        completer.ready(_dbClient);
        WorkflowStepCompleter.stepSucceded(completer.getOpId());
        return;
    }
    if (policy != null) {
        cmdResult = dodeleteReplicationPolicy(system, policyName);
    }
    // Check if mirror policy exists on target system if yes, delete it..
    if (cmdResult != null && cmdResult.getCommandSuccess()) {
        StorageSystem targetStorageSystem = _dbClient.queryObject(StorageSystem.class, targetFileShare.getStorageDevice());
        isi = getIsilonDevice(targetStorageSystem);
        String mirrorPolicyName = policyName.concat("_mirror");
        try {
            policy = isi.getReplicationPolicy(mirrorPolicyName);
        } catch (IsilonException e) {
            _log.info("Mirror policy named : {} not found on the target system", mirrorPolicyName);
            completer.ready(_dbClient);
            WorkflowStepCompleter.stepSucceded(completer.getOpId());
            return;
        }
        if (policy != null) {
            cmdResult = dodeleteReplicationPolicy(targetStorageSystem, mirrorPolicyName);
        }
    }
    if (cmdResult != null && cmdResult.getCommandSuccess()) {
        completer.ready(_dbClient);
        WorkflowStepCompleter.stepSucceded(completer.getOpId());
    } else {
        completer.error(_dbClient, cmdResult.getServiceCoded());
    }
}
Also used : BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) FileShare(com.emc.storageos.db.client.model.FileShare) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 37 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class NetAppFileStorageDevice method doDeleteFS.

/**
 * Deleting a file system: - deletes FileSystem and any correponding exports, smb shares
 *
 * @param StorageSystem storage
 * @param args FileDeviceInputOutput
 * @return BiosCommandResult
 * @throws ControllerException
 */
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppFileStorageDevice doDeleteFS - start");
        if (null == args.getFsName()) {
            _log.error("NetAppFileStorageDevice::doDeletFS failed:  Filesystem name is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
            serviceError.setMessage("Filesystem name is either missing or empty");
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        FileShare fileshare = args.getFs();
        // Now get the VFiler from the fileShare
        String portGroup = findVfilerName(fileshare);
        if (null != args.getFsShares() && !args.getFsShares().isEmpty()) {
            if (!netAppDeleteCIFSExports(storage, args.getFsShares(), portGroup)) {
                _log.info("NetAppFileStorageDevice doDeletFS:netAppDeleteCIFSExports {} - failed", args.getFsName());
            } else {
                _log.info("NetAppFileStorageDevice doDeletFS:netAppDeleteCIFSExports {} - succeeded", args.getFsName());
            }
        }
        boolean failedStatus = false;
        NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).vFiler(portGroup).build();
        if (!nApi.deleteFS(args.getFsName())) {
            failedStatus = true;
        }
        if (failedStatus == true) {
            _log.error("NetAppFileStorageDevice doDeletFS {} - failed", args.getFsName());
            ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
            result = BiosCommandResult.createErrorResult(serviceError);
        } else {
            _log.info("NetAppFileStorageDevice doDeletFS {} - complete", args.getFsName());
            result = BiosCommandResult.createSuccessfulResult();
        }
    } catch (NetAppException e) {
        _log.error("NetAppFileStorageDevice::doDeleteFS failed with a NetAppException", e);
        ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppFileStorageDevice::doDeleteFS failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppApi(com.emc.storageos.netapp.NetAppApi) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) NetAppException(com.emc.storageos.netapp.NetAppException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Example 38 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class NetAppFileStorageDevice method doRestoreFS.

@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    try {
        _log.info("NetAppFileStorageDevice doRestoreFS - start");
        if (null == args.getFsName()) {
            _log.error("NetAppFileStorageDevice::doRestoreFS failed:  Filesystem name is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
            serviceError.setMessage(FileSystemConstants.FS_ERR_FS_NAME_MISSING_OR_EMPTY);
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        if (null == args.getSnapshotName()) {
            _log.error("NetAppFileStorageDevice::doRestoreFS failed:  Snapshot name is either missing or empty");
            ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
            serviceError.setMessage(FileSystemConstants.FS_ERR_SNAPSHOT_NAME_MISSING_OR_EMPTY);
            result = BiosCommandResult.createErrorResult(serviceError);
            return result;
        }
        NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).build();
        if (!nApi.restoreSnapshot(args.getFsName(), args.getSnapshotName())) {
            _log.error("NetAppFileStorageDevice doRestoreFS {} - failed", args.getFsName());
            ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
            result = BiosCommandResult.createErrorResult(serviceError);
        } else {
            _log.info("doRestoreFS - restore of snapshot, {}  was successfully for filesystem, {} ", args.getSnapshotName(), args.getFsName());
            result = BiosCommandResult.createSuccessfulResult();
        }
    } catch (NetAppException e) {
        _log.error("NetAppFileStorageDevice::doRestoreFS failed with a NetAppException", e);
        ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    } catch (Exception e) {
        _log.error("NetAppFileStorageDevice::doRestoreFS failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppApi(com.emc.storageos.netapp.NetAppApi) NetAppException(com.emc.storageos.netapp.NetAppException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Example 39 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class NetAppFileStorageDevice method getPhysicalInventory.

@Override
public BiosCommandResult getPhysicalInventory(StorageSystem storage) {
    BiosCommandResult result = new BiosCommandResult();
    result.setCommandSuccess(true);
    return result;
}
Also used : BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 40 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class NetAppFileStorageDevice method deleteShareACLs.

@Override
public BiosCommandResult deleteShareACLs(StorageSystem storage, FileDeviceInputOutput args) {
    BiosCommandResult result = new BiosCommandResult();
    List<ShareACL> existingAcls = new ArrayList<ShareACL>();
    existingAcls = args.getExistingShareAcls();
    NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).build();
    try {
        deleteShareAcl(nApi, args.getShareName(), existingAcls);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (Exception e) {
        _log.error("NetAppFileStorageDevice::Delete All ACL failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteCIFSShareAcl();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ArrayList(java.util.ArrayList) NetAppApi(com.emc.storageos.netapp.NetAppApi) ShareACL(com.emc.storageos.model.file.ShareACL) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Aggregations

BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)135 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)76 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)69 ControllerException (com.emc.storageos.volumecontroller.ControllerException)64 NetAppException (com.emc.storageos.netapp.NetAppException)34 ArrayList (java.util.ArrayList)34 NetworkDeviceControllerException (com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)28 NetAppCException (com.emc.storageos.netappc.NetAppCException)19 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)18 NetAppApi (com.emc.storageos.netapp.NetAppApi)18 NetAppClusterApi (com.emc.storageos.netappc.NetAppClusterApi)18 URI (java.net.URI)16 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)15 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)15 VNXFileCommApi (com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi)15 ApplicationContext (org.springframework.context.ApplicationContext)15 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)15 FileShare (com.emc.storageos.db.client.model.FileShare)14 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)14 NetworkSystem (com.emc.storageos.db.client.model.NetworkSystem)11