Search in sources :

Example 91 with BiosCommandResult

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

the class VNXFileStorageDeviceXML method doDeleteShare.

@Override
public BiosCommandResult doDeleteShare(StorageSystem storage, FileDeviceInputOutput args, SMBFileShare smbFileShare) throws ControllerException {
    _log.info("Call FileShare doDeleteShare");
    XMLApiResult result = null;
    ApplicationContext context = null;
    try {
        context = loadContext();
        VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
        if (null == vnxComm) {
            throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
        }
        StorageHADomain dm = null;
        String mountPoint = null;
        if (args.getFileOperation()) {
            mountPoint = args.getFs().getMountPath();
            // Get DataMover
            dm = this.getDataMover(args.getFs());
            if (dm == null) {
                Exception e = new Exception("VNX File Share creation Failed Data Mover not found");
                throw VNXException.exceptions.createExportFailed("VNX File Delete Share Failed Data Mover not found", e);
            }
        } else {
            // Get DataMover
            URI snapshotId = args.getSnapshotId();
            Snapshot snapshot = _dbClient.queryObject(Snapshot.class, snapshotId);
            FileShare fileshare = _dbClient.queryObject(FileShare.class, snapshot.getParent().getURI());
            mountPoint = fileshare.getMountPath();
            dm = this.getDataMover(fileshare);
            if (dm == null) {
                Exception e = new Exception("VNX File Share creation Failed Data Mover not found");
                throw VNXException.exceptions.createExportFailed("VNX File Delete Share Failed Data Mover not found", e);
            }
        }
        result = vnxComm.doDeleteShare(storage, dm, smbFileShare.getName(), mountPoint, false, args);
        args.getFileObjShares().remove(smbFileShare.getName());
    } catch (VNXException e) {
        throw new DeviceControllerException(e);
    } finally {
        clearContext(context);
    }
    BiosCommandResult cmdResult = null;
    if (result.isCommandSuccess()) {
        cmdResult = BiosCommandResult.createSuccessfulResult();
    } else {
        cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToDeleteFileShare(result.getMessage()));
    }
    return cmdResult;
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) VNXSnapshot(com.emc.storageos.vnx.xmlapi.VNXSnapshot) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) VNXFileCommApi(com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) XMLApiResult(com.emc.storageos.vnx.xmlapi.XMLApiResult) URI(java.net.URI) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) VNXException(com.emc.storageos.vnx.xmlapi.VNXException)

Example 92 with BiosCommandResult

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

the class VNXFileStorageDeviceXML method doCreateFS.

@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    Map<String, String> autoExtendAtts = getAutoExtendAttrs(args);
    Long fsSize = args.getFsCapacity() / BYTESPERMB;
    if (fsSize < 1) {
        // Invalid size throw an error
        String errMsg = "doCreateFS failed : FileSystem size in bytes is not valid " + args.getFsCapacity();
        _log.error(errMsg);
        return BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(errMsg));
    }
    _log.info("FileSystem size translation : {} : {} ", args.getFsCapacity(), fsSize);
    XMLApiResult result = null;
    ApplicationContext context = null;
    try {
        context = loadContext();
        VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
        if (null == vnxComm) {
            throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
        }
        result = vnxComm.createFileSystem(storage, args.getFsName(), // This will be used for CLI create FS
        args.getPoolName(), "1", fsSize, args.getThinProvision(), args.getNativeDeviceFsId(), autoExtendAtts);
        if (result.isCommandSuccess()) {
            VNXFileSystem vnxFS = (VNXFileSystem) result.getObject();
            args.setFsNativeId(String.valueOf(vnxFS.getFsId()));
            String path = "/" + args.getFsName();
            // Set path & mountpath
            args.setFsMountPath(path);
            args.setFsPath(path);
        }
    } catch (VNXException e) {
        throw DeviceControllerException.exceptions.unableToCreateFileSystem(e.getMessage(Locale.getDefault()));
    } finally {
        clearContext(context);
    }
    BiosCommandResult cmdResult = null;
    if (result.isCommandSuccess()) {
        cmdResult = BiosCommandResult.createSuccessfulResult();
    } else {
        cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(result.getMessage()));
    }
    return cmdResult;
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) VNXFileSystem(com.emc.storageos.vnx.xmlapi.VNXFileSystem) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) VNXFileCommApi(com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi) XMLApiResult(com.emc.storageos.vnx.xmlapi.XMLApiResult)

Example 93 with BiosCommandResult

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

the class VNXeStorageDevice method doCreateQuotaDirectory.

@Override
public BiosCommandResult doCreateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qd) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    ServiceError serviceError = DeviceControllerErrors.vnxe.operationNotSupported("Create Quota Directory", "VNXe");
    result = BiosCommandResult.createErrorResult(serviceError);
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 94 with BiosCommandResult

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

the class VNXeStorageDevice method doModifyFS.

@Override
public BiosCommandResult doModifyFS(StorageSystem storage, FileDeviceInputOutput fd) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    result.setCommandSuccess(false);
    result.setCommandStatus(Operation.Status.error.name());
    result.setMessage("Modify FS NOT supported for VNXe.");
    return result;
}
Also used : BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 95 with BiosCommandResult

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

the class VNXeStorageDevice method doDeleteFS.

/*
     * @Override
     * public BiosCommandResult doDeleteFS(StorageSystem storage,
     * FileDeviceInputOutput fileInOut) throws ControllerException {
     * _logger.info("deleting file system: ", fileInOut.getFsName());
     * VNXeApiClient apiClient = getVnxeClient(storage);
     * VNXeCommandJob job = null;
     * VNXeFileTaskCompleter completer = null;
     * try {
     * job = apiClient.deleteFileSystem(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
     * if (job != null) {
     * completer = new VNXeFileTaskCompleter(FileShare.class, fileInOut.getFsId(), fileInOut.getOpId(),
     * OperationTypeEnum.DELETE_FILE_SYSTEM);
     * VNXeDeleteFileSystemJob deleteFSJob = new VNXeDeleteFileSystemJob(job.getId(), storage.getId(),
     * completer, fileInOut.getForceDelete());
     * ControllerServiceImpl.enqueueJob(new QueueJob(deleteFSJob));
     * } else {
     * _logger.error("No job returned from deleteFileSystem");
     * ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem",
     * "No Job returned from deleteFileSystem");
     * return BiosCommandResult.createErrorResult(error);
     * }
     * 
     * }catch (VNXeException e) {
     * _logger.error("Delete file system got the exception", e);
     * if (completer != null) {
     * completer.error(_dbClient, e);
     * }
     * return BiosCommandResult.createErrorResult(e);
     * } catch (Exception ex) {
     * _logger.error("Delete file system got the exception", ex);
     * ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
     * if (completer != null) {
     * completer.error(_dbClient, error);
     * }
     * return BiosCommandResult.createErrorResult(error);
     * }
     * StringBuilder logMsgBuilder = new StringBuilder(String.format(
     * "Delete filesystem job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(),
     * fileInOut.getFsName()));
     * _logger.info(logMsgBuilder.toString());
     * return BiosCommandResult.createPendingResult();
     * }
     */
/*
     * To get around the KH API delete file system async issues, using sync call for now.
     */
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput fileInOut) throws ControllerException {
    _logger.info("deleting file system: ", fileInOut.getFsName());
    VNXeApiClient apiClient = getVnxeClient(storage);
    BiosCommandResult result = null;
    try {
        apiClient.deleteFileSystemSync(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
        StringBuilder logMsgBuilder = new StringBuilder(String.format("Deleted filesystem - Array:%s, fileSystem: %s", storage.getSerialNumber(), fileInOut.getFsName()));
        _logger.info(logMsgBuilder.toString());
        result = BiosCommandResult.createSuccessfulResult();
    } catch (VNXeException e) {
        _logger.error("Delete file system got the exception", e);
        result = BiosCommandResult.createErrorResult(e);
    } catch (Exception ex) {
        _logger.error("Delete file system got the exception", ex);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
        result = BiosCommandResult.createErrorResult(error);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) VNXeException(com.emc.storageos.vnxe.VNXeException) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

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