use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class BlockControllerImpl method validateStorageProviderConnection.
@Override
public boolean validateStorageProviderConnection(String ipAddress, Integer portNumber, String interfaceType) {
// Making a direct call to get connection status.
Controller controller = lookupDeviceController();
BlockController blkcontroller = (BlockController) controller;
return blkcontroller.validateStorageProviderConnection(ipAddress, portNumber, interfaceType);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class BlockControllerImpl method getInitiatorAlias.
@Override
public String getInitiatorAlias(URI systemURI, URI initiatorURI) throws Exception {
// Making a direct call to get alias.
Controller controller = lookupDeviceController();
BlockController blkcontroller = (BlockController) controller;
return blkcontroller.getInitiatorAlias(systemURI, initiatorURI);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class SMISProviderService method updateStorageSystem.
/**
* Allows the user to update credentials for a storage system that
* is not connected to any SMIS Provider.
* This update call is applicable to systems that cannot be discovered
* via an SMI-S provider.
* This API call creates an asynchronous operation to add providers to the SMI-S provider,
* verifies that the storage system is visible through the provider, and performs discovery of
* the storage system
* Note: only vnxblock can be actively connected to the SMIS provider. VMAX skips this step,
* the system must be visible to the SMIS provider beforehand.
* <p>
* The method is deprecated. Use /vdc/storage-providers/storage-systems/{system_id} instead.
*
* @param id the URN of a ViPR SMI-S provider
* @param param The storage system details to update.
*
* @brief Update storage system credentials and the list of SMI-S providers
* @return A TaskResourceRep reference specifying the storage system
* data.
* @throws ControllerException
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/storage-systems/{system_id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
public TaskResourceRep updateStorageSystem(@PathParam("id") URI id, StorageSystemSMISUpdateParam param) throws ControllerException {
StorageSystem system = _dbClient.queryObject(StorageSystem.class, id);
ArgValidator.checkEntity(system, id, isIdEmbeddedInURL(id));
if (system.getSystemType().equals(StorageSystem.Type.vmax.name())) {
throw APIException.badRequests.unableToUpdateStorageSystem(StorageSystem.Type.vmax.name());
}
String taskId = UUID.randomUUID().toString();
if (param.getSmisProviders() == null || param.getSmisProviders().isEmpty()) {
throw APIException.badRequests.invalidParameterSMISProviderListIsEmpty();
}
URI[] providers = new URI[param.getSmisProviders().size()];
int idx = 0;
for (URI provider : param.getSmisProviders()) {
StorageProvider providerObj = _dbClient.queryObject(StorageProvider.class, provider);
ArgValidator.checkEntity(providerObj, provider, isIdEmbeddedInURL(provider));
if (!providerObj.connected()) {
throw APIException.badRequests.invalidParameterSMISProviderNotConnected(providerObj.getIPAddress());
}
if (system.getProviders() != null && system.getProviders().contains(provider)) {
throw APIException.badRequests.invalidParameterSMISProviderAlreadyRegistered(providerObj.getIPAddress());
}
if (system.getProviders() != null && system.getProviders().contains(provider)) {
throw APIException.badRequests.invalidParameterSMISProviderAlreadyRegistered(providerObj.getIPAddress());
}
providers[idx++] = provider;
}
updateStorageObj(system, param);
// Update SMIS Providers for the storage
BlockController controller = getController(BlockController.class, system.getSystemType());
Operation op = _dbClient.createTaskOpStatus(StorageSystem.class, system.getId(), taskId, ResourceOperationTypeEnum.UPDATE_STORAGE_SYSTEM);
boolean activeProvider = (system.getProviders() == null) || (system.getProviders().isEmpty());
controller.addStorageSystem(system.getId(), providers, activeProvider, taskId);
return toTask(system, taskId, op);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class SMISProviderService method addStorageSystem.
/**
* Allows the user to manually create a SMIS managed storage system. This call is
* applicable to systems that cannot be discovered via an SMI-S provider.
* Only VNX storage system can be mapped programatically into SMIS Provider.
* Otherwise this method should be used to reinstall previously decommissioned Arrays.
* <p>
* The method is deprecated. Use /vdc/storage-providers/storage-systems instead.
*
* @param param The storage system details.
*
* @brief Create a storage system and add it to the SMI-S providers.
* @return An asynchronous task corresponding to the discovery job scheduled for the new Storage System.
*
* @throws BadRequestException When the system type is not valid or a
* storage system with the same native guid already exists.
* @throws com.emc.storageos.db.exceptions.DatabaseException When an error occurs querying the database.
* @throws ControllerException When an error occurs discovering the storage
* system.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
@Path("/storage-systems")
public TaskResourceRep addStorageSystem(StorageSystemSMISCreateParam param) throws ControllerException {
TaskResourceRep taskRep;
URIQueryResultList list = new URIQueryResultList();
ArgValidator.checkFieldNotEmpty(param.getSystemType(), "system_type");
if (!StorageSystem.Type.isProviderStorageSystem(param.getSystemType())) {
throw APIException.badRequests.cannotAddStorageSystemTypeToStorageProvider(param.getSystemType());
}
if ((Type.valueOf(param.getSystemType()) == Type.vnxblock) && StringUtils.isNotBlank(param.getIpAddress())) {
// If IP address is not null, the user will need to provide all remaining info
// to add VNX to the SMIS
ArgValidator.checkFieldNotEmpty(param.getSecondaryIPs(), "secondary_ips");
ArgValidator.checkFieldNotEmpty(param.getSecondaryIPs().get(0), "secondary_ips");
ArgValidator.checkFieldNotEmpty(param.getPassword(), "password");
ArgValidator.checkFieldNotEmpty(param.getUserName(), "userName");
}
if (param.getSmisProviders() == null || param.getSmisProviders().isEmpty()) {
throw APIException.badRequests.invalidParameterSMISProviderListIsEmpty();
}
ArgValidator.checkFieldNotEmpty(param.getSerialNumber(), "serialNumber");
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(param.getSystemType(), param.getSerialNumber());
// check for duplicate StorageSystem.
List<StorageSystem> systems = CustomQueryUtility.getActiveStorageSystemByNativeGuid(_dbClient, nativeGuid);
if (systems != null && !systems.isEmpty()) {
throw APIException.badRequests.invalidParameterProviderStorageSystemAlreadyExists("nativeGuid", nativeGuid);
}
String taskId = UUID.randomUUID().toString();
URI[] providers = new URI[param.getSmisProviders().size()];
int idx = 0;
for (URI provider : param.getSmisProviders()) {
StorageProvider providerObj = _dbClient.queryObject(StorageProvider.class, provider);
ArgValidator.checkEntity(providerObj, provider, isIdEmbeddedInURL(provider));
if (!providerObj.connected()) {
throw APIException.badRequests.invalidParameterSMISProviderNotConnected(providerObj.getIPAddress());
}
providers[idx++] = provider;
}
StorageSystem system = prepareStorageSystem(param);
BlockController controller = getController(BlockController.class, param.getSystemType());
Operation op = _dbClient.createTaskOpStatus(StorageSystem.class, system.getId(), taskId, ResourceOperationTypeEnum.CREATE_STORAGE_SYSTEM);
controller.addStorageSystem(system.getId(), providers, true, taskId);
return toTask(system, taskId, op);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class HostService method createHostArrayAffinityTasks.
/**
* Create array affinity tasks for hosts.
*
* @param hostIds
* the hosts whose preferred systems need to be discovered
*/
public TaskList createHostArrayAffinityTasks(List<URI> hostIds) {
TaskList taskList = new TaskList();
String taskId = UUID.randomUUID().toString();
String jobType = "";
Map<URI, List<URI>> providerToSystemsMap = new HashMap<URI, List<URI>>();
Map<URI, String> providerToSystemTypeMap = new HashMap<URI, String>();
List<URI> sysURIs = _dbClient.queryByType(StorageSystem.class, true);
Iterator<StorageSystem> storageSystems = _dbClient.queryIterativeObjects(StorageSystem.class, sysURIs);
while (storageSystems.hasNext()) {
StorageSystem systemObj = storageSystems.next();
if (systemObj == null) {
_log.warn("StorageSystem is no longer in the DB. It could have been deleted or decommissioned");
continue;
}
if (systemObj.deviceIsType(Type.vmax) || systemObj.deviceIsType(Type.vnxblock) || systemObj.deviceIsType(Type.xtremio)) {
if (systemObj.getActiveProviderURI() == null || NullColumnValueGetter.getNullURI().equals(systemObj.getActiveProviderURI())) {
_log.info("Skipping {} Job : StorageSystem {} does not have an active provider", jobType, systemObj.getLabel());
continue;
}
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, systemObj.getActiveProviderURI());
if (provider == null || provider.getInactive()) {
_log.info("Skipping {} Job : StorageSystem {} does not have a valid active provider", jobType, systemObj.getLabel());
continue;
}
List<URI> systemIds = providerToSystemsMap.get(provider.getId());
if (systemIds == null) {
systemIds = new ArrayList<URI>();
providerToSystemsMap.put(provider.getId(), systemIds);
providerToSystemTypeMap.put(provider.getId(), systemObj.getSystemType());
}
systemIds.add(systemObj.getId());
} else if (systemObj.deviceIsType(Type.unity)) {
List<URI> systemIds = new ArrayList<URI>();
systemIds.add(systemObj.getId());
providerToSystemsMap.put(systemObj.getId(), systemIds);
providerToSystemTypeMap.put(systemObj.getId(), systemObj.getSystemType());
} else {
_log.info("Skip unsupported system {}, system type {}", systemObj.getLabel(), systemObj.getSystemType());
continue;
}
}
for (Map.Entry<URI, List<URI>> entry : providerToSystemsMap.entrySet()) {
List<URI> systemIds = entry.getValue();
BlockController controller = getController(BlockController.class, providerToSystemTypeMap.get(entry.getKey()));
DiscoveredObjectTaskScheduler scheduler = new DiscoveredObjectTaskScheduler(_dbClient, new StorageSystemService.ArrayAffinityJobExec(controller));
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>();
tasks.add(new ArrayAffinityAsyncTask(StorageSystem.class, systemIds, hostIds, taskId));
taskList.getTaskList().addAll(scheduler.scheduleAsyncTasks(tasks).getTaskList());
}
return taskList;
}
Aggregations