Search in sources :

Example 21 with ComputeSystemController

use of com.emc.storageos.computesystemcontroller.ComputeSystemController in project coprhd-controller by CoprHD.

the class ClusterService method detachStorage.

/**
 * Updates export groups that are referenced by the given cluster by removing the cluster
 * reference and initiators belonging to hosts in this cluster. Volumes are left intact.
 *
 * @param id the URN of a ViPR Cluster
 * @brief Detach storage from cluster
 * @return OK if detaching completed successfully
 * @throws DatabaseException when a DB error occurs
 */
@POST
@Path("/{id}/detach-storage")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.TENANT_ADMIN })
public TaskResourceRep detachStorage(@PathParam("id") URI id) throws DatabaseException {
    Cluster cluster = queryObject(Cluster.class, id, true);
    String taskId = UUID.randomUUID().toString();
    Operation op = _dbClient.createTaskOpStatus(Cluster.class, id, taskId, ResourceOperationTypeEnum.DETACH_VCENTER_DATACENTER_STORAGE);
    ComputeSystemController controller = getController(ComputeSystemController.class, null);
    controller.detachClusterStorage(cluster.getId(), false, true, taskId);
    return toTask(cluster, taskId, op);
}
Also used : ComputeSystemController(com.emc.storageos.computesystemcontroller.ComputeSystemController) MapCluster(com.emc.storageos.api.mapper.functions.MapCluster) Cluster(com.emc.storageos.db.client.model.Cluster) Operation(com.emc.storageos.db.client.model.Operation) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

ComputeSystemController (com.emc.storageos.computesystemcontroller.ComputeSystemController)21 Path (javax.ws.rs.Path)12 Produces (javax.ws.rs.Produces)12 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)10 POST (javax.ws.rs.POST)10 Host (com.emc.storageos.db.client.model.Host)9 Operation (com.emc.storageos.db.client.model.Operation)9 URI (java.net.URI)6 Initiator (com.emc.storageos.db.client.model.Initiator)4 MapVcenter (com.emc.storageos.api.mapper.functions.MapVcenter)3 TaskList (com.emc.storageos.model.TaskList)3 ArrayList (java.util.ArrayList)3 Consumes (javax.ws.rs.Consumes)3 MapVcenterDataCenter (com.emc.storageos.api.mapper.functions.MapVcenterDataCenter)2 DiscoveredObjectTaskScheduler (com.emc.storageos.api.service.impl.resource.utils.DiscoveredObjectTaskScheduler)2 ActionableEvent (com.emc.storageos.db.client.model.ActionableEvent)2 Cluster (com.emc.storageos.db.client.model.Cluster)2 AsyncTask (com.emc.storageos.volumecontroller.AsyncTask)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2