Search in sources :

Example 26 with BlockController

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);
}
Also used : BlockController(com.emc.storageos.volumecontroller.BlockController) Controller(com.emc.storageos.Controller) BlockController(com.emc.storageos.volumecontroller.BlockController) AbstractDiscoveredSystemController(com.emc.storageos.impl.AbstractDiscoveredSystemController)

Example 27 with BlockController

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);
}
Also used : BlockController(com.emc.storageos.volumecontroller.BlockController) Controller(com.emc.storageos.Controller) BlockController(com.emc.storageos.volumecontroller.BlockController) AbstractDiscoveredSystemController(com.emc.storageos.impl.AbstractDiscoveredSystemController)

Example 28 with BlockController

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);
}
Also used : BlockController(com.emc.storageos.volumecontroller.BlockController) Operation(com.emc.storageos.db.client.model.Operation) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 29 with BlockController

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);
}
Also used : BlockController(com.emc.storageos.volumecontroller.BlockController) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) Operation(com.emc.storageos.db.client.model.Operation) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 30 with BlockController

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;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) BlockController(com.emc.storageos.volumecontroller.BlockController) TaskList(com.emc.storageos.model.TaskList) AsyncTask(com.emc.storageos.volumecontroller.AsyncTask) ArrayAffinityAsyncTask(com.emc.storageos.volumecontroller.ArrayAffinityAsyncTask) ArrayList(java.util.ArrayList) DiscoveredObjectTaskScheduler(com.emc.storageos.api.service.impl.resource.utils.DiscoveredObjectTaskScheduler) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) ArrayAffinityAsyncTask(com.emc.storageos.volumecontroller.ArrayAffinityAsyncTask) UnManagedExportMaskList(com.emc.storageos.model.block.UnManagedExportMaskList) UnManagedVolumeList(com.emc.storageos.model.block.UnManagedVolumeList) NamedElementQueryResultList(com.emc.storageos.db.client.constraint.NamedElementQueryResultList) InitiatorList(com.emc.storageos.model.host.InitiatorList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) MountInfoList(com.emc.storageos.model.file.MountInfoList) HostList(com.emc.storageos.model.host.HostList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) BulkList(com.emc.storageos.api.service.impl.response.BulkList) LinkedList(java.util.LinkedList) IpInterfaceList(com.emc.storageos.model.host.IpInterfaceList) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) TreeMap(java.util.TreeMap) NavigableMap(java.util.NavigableMap) HashMap(java.util.HashMap) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

BlockController (com.emc.storageos.volumecontroller.BlockController)48 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)32 Operation (com.emc.storageos.db.client.model.Operation)23 URI (java.net.URI)23 ArrayList (java.util.ArrayList)20 TaskList (com.emc.storageos.model.TaskList)16 Produces (javax.ws.rs.Produces)15 Volume (com.emc.storageos.db.client.model.Volume)13 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)13 Path (javax.ws.rs.Path)13 ControllerException (com.emc.storageos.volumecontroller.ControllerException)12 Consumes (javax.ws.rs.Consumes)12 POST (javax.ws.rs.POST)11 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)10 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)9 NamedURI (com.emc.storageos.db.client.model.NamedURI)8 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)8 AsyncTask (com.emc.storageos.volumecontroller.AsyncTask)8 Controller (com.emc.storageos.Controller)7 DiscoveredObjectTaskScheduler (com.emc.storageos.api.service.impl.resource.utils.DiscoveredObjectTaskScheduler)7