Search in sources :

Example 6 with DellSCDriverTask

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

use of com.emc.storageos.driver.dellsc.DellSCDriverTask 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 8 with DellSCDriverTask

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

the class DellSCMirroring method splitVolumeMirror.

/**
 * Delete volume mirror but leave the destination volume intact.
 *
 * @param mirrors The mirrors to split.
 * @return The split task.
 */
public DriverTask splitVolumeMirror(List<VolumeMirror> mirrors) {
    LOG.info("Splitting volume mirror");
    DellSCDriverTask task = new DellSCDriverTask("splitVolumeMirror");
    StringBuilder errBuffer = new StringBuilder();
    int mirrorSplit = 0;
    for (VolumeMirror mirror : mirrors) {
        try {
            StorageCenterAPI api = connectionManager.getConnection(mirror.getStorageSystemId());
            api.deleteMirror(mirror.getNativeId());
            task.setStatus(TaskStatus.READY);
            mirrorSplit++;
        } catch (StorageCenterAPIException | DellSCDriverException dex) {
            String error = String.format("Error splitting volume mirror %s: %s", mirror.getDisplayName(), dex);
            LOG.error(error);
            errBuffer.append(String.format("%s%n", error));
        }
    }
    task.setMessage(errBuffer.toString());
    if (mirrorSplit == mirrors.size()) {
        task.setStatus(TaskStatus.READY);
    } else if (mirrorSplit == 0) {
        task.setStatus(TaskStatus.FAILED);
    } else {
        task.setStatus(TaskStatus.PARTIALLY_FAILED);
    }
    return task;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException) VolumeMirror(com.emc.storageos.storagedriver.model.VolumeMirror)

Example 9 with DellSCDriverTask

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

the class DellSCMirroring method resumeVolumeMirror.

/**
 * Resume volume mirrors. Not supported as once a mirror is split,
 * we no longer have any way of knowing what the target was.
 *
 * @param mirrors The mirrors to resume.
 * @return The mirror task.
 */
public DriverTask resumeVolumeMirror(List<VolumeMirror> mirrors) {
    LOG.info("Resuming volume mirror not supported.");
    DriverTask task = new DellSCDriverTask("resumeVolumeMirror");
    task.setStatus(TaskStatus.FAILED);
    return null;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask)

Example 10 with DellSCDriverTask

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

the class DellSCMirroring method restoreVolumeMirror.

/**
 * Restore a volume mirror.
 *
 * @param mirrors The mirrors.
 * @return The driver task.
 */
public DriverTask restoreVolumeMirror(List<VolumeMirror> mirrors) {
    LOG.info("Restoring volume mirror not supported");
    // Need to determine what this expects. Mirrors are... mirrored. So
    // nothing to restore to in SC terms.
    DriverTask task = new DellSCDriverTask("restoreVolumeMirror");
    task.setStatus(TaskStatus.FAILED);
    return null;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask)

Aggregations

DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)27 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)22 StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)22 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)22 DriverTask (com.emc.storageos.storagedriver.DriverTask)10 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)8 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)6 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)3 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)3 ArrayList (java.util.ArrayList)3 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)2 ScCopyMirrorMigrate (com.emc.storageos.driver.dellsc.scapi.objects.ScCopyMirrorMigrate)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)2 StorageCenter (com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter)2 StoragePort (com.emc.storageos.storagedriver.model.StoragePort)2 VolumeMirror (com.emc.storageos.storagedriver.model.VolumeMirror)2 List (java.util.List)2 EmDataCollector (com.emc.storageos.driver.dellsc.scapi.objects.EmDataCollector)1 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)1