Search in sources :

Example 6 with FileSnapshotWorkflowCompleter

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

the class FileOrchestrationDeviceController method deleteShare.

@Override
public void deleteShare(URI storage, URI uri, FileSMBShare fileSMBShare, String opId) throws ControllerException {
    FileObject fileObj = null;
    String stepDescription = null;
    String successMessage = null;
    String opName = null;
    TaskCompleter completer = null;
    if (URIUtil.isType(uri, FileShare.class)) {
        completer = new FileWorkflowCompleter(uri, opId);
        fileObj = s_dbClient.queryObject(FileShare.class, uri);
        stepDescription = String.format("Deleting file system: %s CIFS share: %s ", uri, fileSMBShare.getName());
        successMessage = String.format("Deleting file system: %s CIFS share: %s finished succesfully.", uri, fileSMBShare.getName());
        opName = ResourceOperationTypeEnum.DELETE_FILE_SYSTEM_SHARE.getName();
    } else {
        completer = new FileSnapshotWorkflowCompleter(uri, opId);
        fileObj = s_dbClient.queryObject(Snapshot.class, uri);
        stepDescription = String.format("Deleting file system snapshot: %s CIFS share: %s ", uri, fileSMBShare.getName());
        successMessage = String.format("Deleting file system snapshot: %s CIFS share: %s finished succesfully.", uri, fileSMBShare.getName());
        opName = ResourceOperationTypeEnum.DELETE_FILE_SNAPSHOT_SHARE.getName();
    }
    try {
        Workflow workflow = _workflowService.getNewWorkflow(this, DELETE_FILESYSTEM_CIFS_SHARE_WF_NAME, false, opId, completer);
        String sharedeleteStep = workflow.createStepId();
        Object[] args = new Object[] { storage, uri, fileSMBShare };
        _fileDeviceController.createMethod(workflow, null, DELETE_FILESYSTEM_SHARE_METHOD, sharedeleteStep, stepDescription, storage, args);
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        s_logger.error(String.format("Deleting file system snapshot: %s CIFS share: %s failed.", uri, fileSMBShare.getName()), ex);
        ServiceError serviceError = DeviceControllerException.errors.deleteCIFSShareFailed(fileObj.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter) FileSnapshotWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileSnapshotWorkflowCompleter) Workflow(com.emc.storageos.workflow.Workflow) FileObject(com.emc.storageos.db.client.model.FileObject) FileObject(com.emc.storageos.db.client.model.FileObject) VNXeFSSnapshotTaskCompleter(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter) MirrorFileFailoverTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailoverTaskCompleter) MirrorFileFailbackTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailbackTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 7 with FileSnapshotWorkflowCompleter

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

the class FileOrchestrationDeviceController method updateExportRules.

@Override
public void updateExportRules(URI storage, URI uri, FileExportUpdateParams param, boolean unmountExport, String opId) throws ControllerException {
    FileObject fileObj = null;
    String stepDescription = null;
    String successMessage = null;
    String opName = null;
    TaskCompleter completer = null;
    if (URIUtil.isType(uri, FileShare.class)) {
        completer = new FileWorkflowCompleter(uri, opId);
        fileObj = s_dbClient.queryObject(FileShare.class, uri);
        stepDescription = String.format("Updating file system : %s export rules: %s", uri, param.toString());
        successMessage = String.format("Updating file system : %s export rules: %s finished successfully.", uri, param.toString());
        opName = ResourceOperationTypeEnum.UPDATE_EXPORT_RULES_FILE_SYSTEM.getName();
    } else {
        completer = new FileSnapshotWorkflowCompleter(uri, opId);
        fileObj = s_dbClient.queryObject(Snapshot.class, uri);
        stepDescription = String.format("Updating file system : %s export rules: %s", uri, param.toString());
        successMessage = String.format("Updating file system : %s export rules: %s finished successfully.", uri, param.toString());
        opName = ResourceOperationTypeEnum.UPDATE_EXPORT_RULES_FILE_SNAPSHOT.getName();
    }
    try {
        Workflow workflow = _workflowService.getNewWorkflow(this, UPDATE_FILESYSTEM_EXPORT_RULES_WF_NAME, false, opId, completer);
        String waitFor = null;
        // Check if the export should be unmounted before deleting
        if (unmountExport) {
            // get all the mounts and generate steps for unmounting them
            List<MountInfo> mountList = _fileDeviceController.getMountedExports(uri, param.getSubDir(), param);
            for (MountInfo mount : mountList) {
                Object[] args = new Object[] { mount.getHostId(), mount.getFsId(), mount.getMountPath() };
                waitFor = _fileDeviceController.createMethod(workflow, waitFor, UNMOUNT_FILESYSTEM_EXPORT_METHOD, null, "Unmounting path:" + mount.getMountPath(), storage, args);
            }
        } else if (URIUtil.isType(uri, FileShare.class)) {
            // Check if the export rule is mounted and throw an error if mounted
            Object[] args = new Object[] { uri, param };
            waitFor = _fileDeviceController.createMethod(workflow, waitFor, VERIFY_MOUNT_DEPENDENCIES_METHOD, null, "Verifying mount dependencies", storage, args);
        }
        Object[] args = new Object[] { storage, uri, param };
        _fileDeviceController.createMethod(workflow, waitFor, UPDATE_FILESYSTEM_EXPORT_RULES_METHOD, null, stepDescription, storage, args);
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        s_logger.error(String.format("Updating file system : %s export rules: %s failed.", uri, param.toString()), ex);
        ServiceError serviceError = DeviceControllerException.errors.updateFileShareExportRulesFailed(fileObj.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileSnapshotWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileSnapshotWorkflowCompleter) Workflow(com.emc.storageos.workflow.Workflow) MountInfo(com.emc.storageos.model.file.MountInfo) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) Snapshot(com.emc.storageos.db.client.model.Snapshot) FileWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter) FileObject(com.emc.storageos.db.client.model.FileObject) FileObject(com.emc.storageos.db.client.model.FileObject) VNXeFSSnapshotTaskCompleter(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter) MirrorFileFailoverTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailoverTaskCompleter) MirrorFileFailbackTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailbackTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter)

Example 8 with FileSnapshotWorkflowCompleter

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

the class FileOrchestrationDeviceController method createCIFSShare.

@Override
public void createCIFSShare(URI storageSystem, URI uri, FileSMBShare smbShare, String taskId) throws ControllerException {
    FileObject fileObj = null;
    String stepDescription = null;
    String successMessage = null;
    String opName = null;
    TaskCompleter completer = null;
    if (URIUtil.isType(uri, FileShare.class)) {
        completer = new FileWorkflowCompleter(uri, taskId);
        fileObj = s_dbClient.queryObject(FileShare.class, uri);
        stepDescription = String.format("Creating CIFS share for file system : %s, share name: %s ", uri, smbShare.getName());
        successMessage = String.format("Creating CIFS share for file system : %s, share name: %s finished succesfully.", uri, smbShare.getName());
        opName = ResourceOperationTypeEnum.CREATE_FILE_SYSTEM_SHARE.getName();
    } else {
        completer = new FileSnapshotWorkflowCompleter(uri, taskId);
        fileObj = s_dbClient.queryObject(Snapshot.class, uri);
        stepDescription = String.format("Creating CIFS share for file system snapshot : %s, share name: %s ", uri, smbShare.getName());
        successMessage = String.format("Creating CIFS share for file system : %s, share name: %s finished succesfully.", uri, smbShare.getName());
        opName = ResourceOperationTypeEnum.CREATE_FILE_SNAPSHOT_SHARE.getName();
    }
    try {
        Workflow workflow = _workflowService.getNewWorkflow(this, CREATE_FILESYSTEM_CIFS_SHARE_WF_NAME, false, taskId, completer);
        String shareStep = workflow.createStepId();
        Object[] args = new Object[] { storageSystem, uri, smbShare };
        _fileDeviceController.createMethod(workflow, null, CREATE_FILESYSTEM_SHARE_METHOD, shareStep, stepDescription, storageSystem, args);
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        s_logger.error(String.format("Creating CIFS share for file system : %s, share name: %s failed.", uri, smbShare.getName()), ex);
        ServiceError serviceError = DeviceControllerException.errors.createFileSharesFailed(fileObj.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter) FileSnapshotWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileSnapshotWorkflowCompleter) Workflow(com.emc.storageos.workflow.Workflow) FileObject(com.emc.storageos.db.client.model.FileObject) FileObject(com.emc.storageos.db.client.model.FileObject) VNXeFSSnapshotTaskCompleter(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter) MirrorFileFailoverTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailoverTaskCompleter) MirrorFileFailbackTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileFailbackTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Aggregations

FileObject (com.emc.storageos.db.client.model.FileObject)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)8 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)8 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)8 ControllerException (com.emc.storageos.volumecontroller.ControllerException)8 FileSnapshotWorkflowCompleter (com.emc.storageos.volumecontroller.impl.file.FileSnapshotWorkflowCompleter)8 Workflow (com.emc.storageos.workflow.Workflow)8 WorkflowException (com.emc.storageos.workflow.WorkflowException)8 Snapshot (com.emc.storageos.db.client.model.Snapshot)7 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)7 FileWorkflowCompleter (com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter)7 MirrorFileFailbackTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileFailbackTaskCompleter)7 MirrorFileFailoverTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileFailoverTaskCompleter)7 VNXeFSSnapshotTaskCompleter (com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFSSnapshotTaskCompleter)7 FileShare (com.emc.storageos.db.client.model.FileShare)6 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)6 MountInfo (com.emc.storageos.model.file.MountInfo)2