Search in sources :

Example 1 with StorageCenterAPI

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

the class DellSCDiscovery method getVolumeSnapshots.

/**
 * Gets all snapshots for a volume.
 *
 * @param storageVolume The volume.
 * @return The snapshots.
 */
public List<VolumeSnapshot> getVolumeSnapshots(StorageVolume storageVolume) {
    LOG.info("Getting snapshots for {}", storageVolume.getNativeId());
    List<VolumeSnapshot> result = new ArrayList<>();
    try {
        StorageCenterAPI api = connectionManager.getConnection(storageVolume.getStorageSystemId());
        ScReplay[] replays = api.getVolumeSnapshots(storageVolume.getNativeId());
        for (ScReplay replay : replays) {
            VolumeSnapshot snap = util.getVolumeSnapshotFromReplay(replay, null);
            result.add(snap);
        }
    } catch (DellSCDriverException e) {
        String msg = String.format("Error getting volume info: %s", e);
        LOG.warn(msg);
    }
    return result;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) ArrayList(java.util.ArrayList) ScReplay(com.emc.storageos.driver.dellsc.scapi.objects.ScReplay) VolumeSnapshot(com.emc.storageos.storagedriver.model.VolumeSnapshot)

Example 2 with StorageCenterAPI

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

the class DellSCDiscovery method getVolumeMirrors.

/**
 * Gets all mirrors of a volume.
 *
 * @param storageVolume The volume.
 * @return The mirrors.
 */
public List<VolumeMirror> getVolumeMirrors(StorageVolume storageVolume) {
    LOG.info("Getting mirrors for volume {}", storageVolume.getNativeId());
    List<VolumeMirror> result = new ArrayList<>();
    try {
        StorageCenterAPI api = connectionManager.getConnection(storageVolume.getStorageSystemId());
        ScVolume scVolume = api.getVolume(storageVolume.getNativeId());
        if (scVolume != null && scVolume.cmmSource) {
            ScCopyMirrorMigrate[] cmms = api.getVolumeCopyMirrorMigrate(scVolume.instanceId);
            for (ScCopyMirrorMigrate cmm : cmms) {
                if ("Mirror".equals(cmm.type)) {
                    ScVolume targetVol = api.getVolume(cmm.destinationVolume.instanceId);
                    VolumeMirror mirror = new VolumeMirror();
                    mirror.setAccessStatus(AccessStatus.READ_WRITE);
                    mirror.setDeviceLabel(targetVol.name);
                    mirror.setDisplayName(targetVol.name);
                    mirror.setNativeId(targetVol.instanceId);
                    mirror.setParentId(cmm.sourceVolume.instanceId);
                    mirror.setStorageSystemId(storageVolume.getStorageSystemId());
                    SynchronizationState syncState = SynchronizationState.SYNCHRONIZED;
                    if (cmm.percentComplete != 100) {
                        syncState = SynchronizationState.COPYINPROGRESS;
                    }
                    mirror.setSyncState(syncState);
                    mirror.setWwn(targetVol.deviceId);
                    result.add(mirror);
                }
            }
        }
    } catch (DellSCDriverException e) {
        String msg = String.format("Error getting mirrors for volume %s", storageVolume.getNativeId(), e);
        LOG.warn(msg);
    }
    return result;
}
Also used : ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) ScCopyMirrorMigrate(com.emc.storageos.driver.dellsc.scapi.objects.ScCopyMirrorMigrate) VolumeMirror(com.emc.storageos.storagedriver.model.VolumeMirror) ArrayList(java.util.ArrayList) SynchronizationState(com.emc.storageos.storagedriver.model.VolumeMirror.SynchronizationState)

Example 3 with StorageCenterAPI

use of com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI 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 4 with StorageCenterAPI

use of com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI 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 5 with StorageCenterAPI

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

the class DellSCDiscovery method discoverStoragePorts.

/**
 * Discover storage ports and their capabilities.
 *
 * @param storageSystem The storage system on which to discover.
 * @param storagePorts The storage ports.
 * @return The discovery task.
 */
public DriverTask discoverStoragePorts(StorageSystem storageSystem, List<StoragePort> storagePorts) {
    LOG.info("Discovering storage ports for [{}] {} {}", storageSystem.getSystemName(), storageSystem.getIpAddress(), storageSystem.getNativeId());
    DellSCDriverTask task = new DellSCDriverTask("discoverStoragePorts");
    try {
        String ssn = storageSystem.getNativeId();
        StorageCenterAPI api = connectionManager.getConnection(ssn);
        Map<String, List<ScControllerPort>> ports = getPortList(api, ssn);
        for (Entry<String, List<ScControllerPort>> entry : ports.entrySet()) {
            for (ScControllerPort scPort : entry.getValue()) {
                StoragePort port = util.getStoragePortForControllerPort(api, scPort, entry.getKey());
                LOG.info("Discovered Port {}, storageSystem {}", scPort.instanceId, scPort.scSerialNumber);
                storagePorts.add(port);
            }
        }
        task.setStatus(DriverTask.TaskStatus.READY);
    } catch (Exception e) {
        String failureMessage = String.format("Error getting port information: %s", e);
        task.setFailed(failureMessage);
        LOG.warn(failureMessage);
    }
    return task;
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StoragePort(com.emc.storageos.storagedriver.model.StoragePort) ArrayList(java.util.ArrayList) List(java.util.List) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Aggregations

StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)27 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)25 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)24 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)22 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)11 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)7 DriverTask (com.emc.storageos.storagedriver.DriverTask)5 ArrayList (java.util.ArrayList)5 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)4 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)4 ScCopyMirrorMigrate (com.emc.storageos.driver.dellsc.scapi.objects.ScCopyMirrorMigrate)3 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)3 StorageCenter (com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter)3 StoragePort (com.emc.storageos.storagedriver.model.StoragePort)3 VolumeMirror (com.emc.storageos.storagedriver.model.VolumeMirror)3 VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)3 List (java.util.List)3 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)2 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2