use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileService method stopContinuousCopies.
/**
* Stop continuous copies.
*
* @prereq none
* @param id the URN of a ViPR Source file share
* @brief Stop the replication session between source and target file system.
* @return TaskList
* @throws ControllerException
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies/stop")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskList stopContinuousCopies(@PathParam("id") URI id, FileReplicationParam param) throws ControllerException {
doMirrorOperationValidation(id, ProtectionOp.STOP.toString());
String task = UUID.randomUUID().toString();
FileShare sourceFileShare = queryResource(id);
Set<URI> unassignFrom = new HashSet<>();
unassignFrom.add(id);
FilePolicy filepolicy = FileSystemReplicationUtils.getReplicationPolicyAppliedOnFS(sourceFileShare, _dbClient);
Operation op = _dbClient.createTaskOpStatus(FileShare.class, id, task, ResourceOperationTypeEnum.FILE_PROTECTION_ACTION_STOP);
op.setDescription("stop the replication link between source and target");
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
controller.unassignFilePolicy(filepolicy.getId(), unassignFrom, task);
auditOp(OperationTypeEnum.STOP_FILE_MIRROR, true, "BEGIN", sourceFileShare.getId().toString());
TaskList taskList = new TaskList();
TaskResourceRep taskResp = toTask(sourceFileShare, task, op);
taskList.getTaskList().add(taskResp);
return taskList;
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileService method unAssignFilePolicy.
/**
* Unassign existing file system to file policy.
*
* @param id
* the URN of a ViPR fileSystem
* @param filePolicyUri
* the URN of a Policy
* @brief Update file system with Policy detail
* @return Task resource representation
* @throws InternalException
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/unassign-file-policy/{filePolicyUri}")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskResourceRep unAssignFilePolicy(@PathParam("id") URI id, @PathParam("filePolicyUri") URI filePolicyUri) throws InternalException {
// log input received.
_log.info("Unassign Policy on File System : request received for {} with {}", id, filePolicyUri);
String task = UUID.randomUUID().toString();
// Validate the FS id.
ArgValidator.checkFieldUriType(id, FileShare.class, "id");
FileShare fs = queryResource(id);
ArgValidator.checkEntity(fs, id, isIdEmbeddedInURL(id));
ArgValidator.checkFieldUriType(filePolicyUri, FilePolicy.class, "filePolicyUri");
ArgValidator.checkUri(filePolicyUri);
FilePolicy fp = _permissionsHelper.getObjectById(filePolicyUri, FilePolicy.class);
ArgValidator.checkEntityNotNull(fp, filePolicyUri, isIdEmbeddedInURL(filePolicyUri));
// verify the schedule policy is associated with file system or not.
if (!fs.getFilePolicies().isEmpty() && !fs.getFilePolicies().contains(filePolicyUri.toString())) {
throw APIException.badRequests.cannotFindAssociatedPolicy(filePolicyUri);
}
StorageSystem device = _dbClient.queryObject(StorageSystem.class, fs.getStorageDevice());
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
Operation op = _dbClient.createTaskOpStatus(FilePolicy.class, fp.getId(), task, ResourceOperationTypeEnum.UNASSIGN_FILE_POLICY);
op.setDescription("Filesystem unassign policy");
// As the action done by tenant admin
// Set current tenant as task's tenant!!!
Task taskObj = op.getTask(fp.getId());
FilePolicyServiceUtils.updateTaskTenant(_dbClient, fp, "unassign", taskObj, fs.getTenant().getURI());
try {
Set<URI> unassignFrom = new HashSet<URI>();
unassignFrom.add(id);
_log.info("No Errors found proceeding further {}, {}, {}", new Object[] { _dbClient, fs, fp });
controller.unassignFilePolicy(filePolicyUri, unassignFrom, task);
auditOp(OperationTypeEnum.UNASSIGN_FILE_POLICY, true, "BEGIN", fp.getId().toString(), fp.getFilePolicyName());
} catch (BadRequestException e) {
op = _dbClient.error(FilePolicy.class, fp.getId(), task, e);
_log.error("Error Unassigning File policy {}, {}", e.getMessage(), e);
throw e;
} catch (Exception e) {
_log.error("Error Unassigning Filesystem policy {}, {}", e.getMessage(), e);
throw APIException.badRequests.unableToProcessRequest(e.getMessage());
}
return toTask(fp, task, op);
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class AbstractFileServiceApiImpl method deleteFileSystems.
@Override
public void deleteFileSystems(URI systemURI, List<URI> fileSystemURIs, String deletionType, boolean forceDelete, boolean deleteOnlyMirrors, String task) throws InternalException {
// Get volume descriptor for all volumes to be deleted.
List<FileDescriptor> fileDescriptors = getDescriptorsOfFileShareDeleted(systemURI, fileSystemURIs, deletionType, forceDelete, deleteOnlyMirrors);
// place request in queue
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
controller.deleteFileSystems(fileDescriptors, task);
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class AbstractFileServiceApiImpl method assignFilePolicyToVirtualPools.
@Override
public void assignFilePolicyToVirtualPools(Map<URI, List<URI>> vpoolToStorageSystemMap, URI filePolicyToAssign, String taskId) {
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
controller.assignFileSnapshotPolicyToVirtualPools(vpoolToStorageSystemMap, filePolicyToAssign, taskId);
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class AbstractFileServiceApiImpl method updateFileProtectionPolicy.
@Override
public void updateFileProtectionPolicy(URI policy, FilePolicyUpdateParam param, String taskId) {
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
controller.updateFileProtectionPolicy(policy, param, taskId);
}
Aggregations