use of com.emc.storageos.protectioncontroller.ProtectionController in project coprhd-controller by CoprHD.
the class ProtectionSystemService method discoverProtectionSystem.
/**
* Allows the user to manually discover the registered protection system with
* the passed id.
*
* @param id the URN of a ViPR protection system.
* @QueryParam namespace
* ProtectionSystem Auto Discovery is grouped into multiple namespaces.
* Namespace is used to discover specific parts of Storage System.
*
* Possible Values :
* UNMANAGED_CGS
* ALL
*
* UNMANAGED_CGS will discover all the consistency groups which are present in the
* Protection System (RPA).
*
* @brief Discover protection system
* @throws ControllerException When an error occurs discovering the protection
* system.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
@Path("/{id}/discover")
public TaskResourceRep discoverProtectionSystem(@PathParam("id") URI id, @QueryParam("namespace") String namespace) {
ProtectionSystem protectionSystem = _dbClient.queryObject(ProtectionSystem.class, id);
ArgValidator.checkEntity(protectionSystem, id, isIdEmbeddedInURL(id), true);
// If Namespace is empty or null set it to ALL as default
if (namespace == null || namespace.trim().length() < 1) {
namespace = Discovery_Namespaces.ALL.toString();
}
if (!validateNameSpace(namespace)) {
throw APIException.badRequests.invalidParameterProtectionSystemNamespace(namespace);
}
String deviceType = protectionSystem.getSystemType();
ProtectionController controller = getController(RPController.class, deviceType);
DiscoveredObjectTaskScheduler scheduler = new DiscoveredObjectTaskScheduler(_dbClient, new DiscoverJobExec(controller));
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>(1);
String taskId = UUID.randomUUID().toString();
tasks.add(new AsyncTask(ProtectionSystem.class, protectionSystem.getId(), taskId, namespace));
TaskList taskList = scheduler.scheduleAsyncTasks(tasks);
return taskList.getTaskList().listIterator().next();
}
use of com.emc.storageos.protectioncontroller.ProtectionController in project coprhd-controller by CoprHD.
the class ProtectionSystemService method startProtectionSystem.
/**
* Invoke connect protection. Once system is verified to be registered.
* Statistics, Events will be collected for only registered systems.
*
* @param system Protection system to start Metering & Monitoring.
* @throws InternalException
*/
private void startProtectionSystem(ProtectionSystem system) throws InternalException {
ProtectionController controller = getProtectionController(system.getSystemType());
controller.connect(system.getId());
}
Aggregations