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);
}
}
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);
}
}
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);
}
}
Aggregations