Search in sources :

Example 1 with StorageCenter

use of com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter in project coprhd-controller by CoprHD.

the class DellSCDiscovery method discoverStorageProvider.

/**
 * Perform discovery for a storage provider.
 *
 * @param storageProvider The provider.
 * @param storageSystems The storage systems collection to populate.
 * @return The driver task.
 */
public DriverTask discoverStorageProvider(StorageProvider storageProvider, List<StorageSystem> storageSystems) {
    DellSCDriverTask task = new DellSCDriverTask("discover");
    try {
        LOG.info("Getting information for storage provider [{}:{}] as user {}", storageProvider.getProviderHost(), storageProvider.getPortNumber(), storageProvider.getUsername());
        StorageCenterAPI api = connectionManager.getConnection(storageProvider.getProviderHost(), storageProvider.getPortNumber(), storageProvider.getUsername(), storageProvider.getPassword(), true);
        LOG.info("Connected to DSM {} as user {}", storageProvider.getProviderHost(), storageProvider.getUsername());
        // Populate the provider information
        storageProvider.setAccessStatus(AccessStatus.READ_WRITE);
        storageProvider.setManufacturer("Dell");
        storageProvider.setProviderVersion(driverVersion);
        storageProvider.setIsSupportedVersion(true);
        // Get some info about the DSM for debugging purposes
        EmDataCollector em = api.getDSMInfo();
        if (em != null) {
            LOG.info("Connected to {} DSM version {}, Java version {}", em.type, em.version, em.javaVersion);
            storageProvider.setProviderVersion(em.version);
        }
        // Populate the basic SC information
        StorageCenter[] scs = api.getStorageCenterInfo();
        for (StorageCenter sc : scs) {
            StorageSystem storageSystem = util.getStorageSystemFromStorageCenter(api, sc, null);
            storageSystem.setSystemType(driverName);
            storageSystems.add(storageSystem);
        }
        task.setStatus(DriverTask.TaskStatus.READY);
    } catch (Exception e) {
        String msg = String.format("Exception encountered getting storage provider information: %s", e);
        LOG.error(msg);
        task.setFailed(msg);
    }
    return task;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) EmDataCollector(com.emc.storageos.driver.dellsc.scapi.objects.EmDataCollector) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenter(com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException) StorageSystem(com.emc.storageos.storagedriver.model.StorageSystem)

Example 2 with StorageCenter

use of com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter in project coprhd-controller by CoprHD.

the class DellSCDiscovery method discoverStorageSystem.

/**
 * Discover storage systems and their capabilities.
 *
 * @param storageSystem Storage system to discover.
 * @return The discovery task.
 */
public DriverTask discoverStorageSystem(StorageSystem storageSystem) {
    DriverTask task = new DellSCDriverTask("discover");
    try {
        LOG.info("Getting information for storage system [{}] - {}", storageSystem.getIpAddress(), storageSystem.getSystemName());
        String sn = storageSystem.getSerialNumber();
        if (sn == null || sn.length() == 0) {
            // Directly added system, no SSN yet so we use the name field
            sn = storageSystem.getSystemName();
            // name with provider_name+serial_number
            if (sn.contains("+")) {
                String[] parts = sn.split("\\+");
                sn = parts[1];
            }
        }
        int port = storageSystem.getPortNumber();
        if (port == 0) {
            port = 3033;
        }
        StorageCenterAPI api = connectionManager.getConnection(storageSystem.getIpAddress(), port, storageSystem.getUsername(), storageSystem.getPassword(), false);
        // Populate the SC information
        StorageCenter sc = api.findStorageCenter(sn);
        util.getStorageSystemFromStorageCenter(api, sc, storageSystem);
        storageSystem.setSystemType(driverName);
        task.setStatus(DriverTask.TaskStatus.READY);
    } catch (Exception e) {
        String msg = String.format("Exception encountered getting storage system information: %s", e);
        LOG.error(msg);
        task.setMessage(msg);
        task.setStatus(DriverTask.TaskStatus.FAILED);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenter(com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 3 with StorageCenter

use of com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter in project coprhd-controller by CoprHD.

the class DellSCConnectionManager method getConnection.

/**
 * Gets a new Storage Center API connection.
 *
 * @param host The host name or IP.
 * @param port The connection port.
 * @param user The connection user name.
 * @param password The connection password.
 * @param isProvider The isProvider flag to indicate the provider call
 * @return The API connection.
 * @throws StorageCenterAPIException
 */
@SuppressWarnings("resource")
public StorageCenterAPI getConnection(String host, int port, String user, String password, boolean isProvider) throws StorageCenterAPIException {
    // First see if we already have a connection for this system
    StorageCenterAPI result = connectionMap.get(host);
    if (result == null) {
        result = StorageCenterAPI.openConnection(host, port, user, password);
        StorageCenter[] scs = result.getStorageCenterInfo();
        for (StorageCenter sc : scs) {
            // Saving per system for backward compatibility
            saveConnectionInfo(sc.scSerialNumber, host, port, user, password);
            systemLookup.put(sc.scSerialNumber, host);
        }
        saveConnectionInfo(host, host, port, user, password);
        connectionMap.put(host, result);
    } else {
        // Make sure our connection is still good
        result = validateConnection(result, result.getHost());
        /*
             * Update the SC Connection Info only during storage provider discovery
             * bugfix-COP-25081-dell-sc-fail-to-recognize-new-arrays
             */
        if (isProvider) {
            StorageCenter[] scs = result.getStorageCenterInfo();
            for (StorageCenter sc : scs) {
                // Saving per system for backward compatibility
                saveConnectionInfo(sc.scSerialNumber, host, port, user, password);
                systemLookup.put(sc.scSerialNumber, host);
            }
        }
    }
    return result;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) StorageCenter(com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter)

Aggregations

StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)3 StorageCenter (com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter)3 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)2 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)2 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)2 EmDataCollector (com.emc.storageos.driver.dellsc.scapi.objects.EmDataCollector)1 DriverTask (com.emc.storageos.storagedriver.DriverTask)1 StorageSystem (com.emc.storageos.storagedriver.model.StorageSystem)1