Search in sources :

Example 56 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method createVolumeClone.

@Override
public DriverTask createVolumeClone(List<VolumeClone> clones, StorageCapabilities capabilities) {
    CreateVolumeCloneSimulatorOperation createCloneSimulatorOperation = new CreateVolumeCloneSimulatorOperation(clones);
    if (simulatorConfig.getSimulateAsynchronousResponses()) {
        DriverTask driverTask = createCloneSimulatorOperation.getDriverTask();
        taskOperationMap.put(driverTask.getTaskId(), createCloneSimulatorOperation);
        return driverTask;
    } else if (simulatorConfig.getSimulateFailures()) {
        String failMsg = createCloneSimulatorOperation.getFailureMessage();
        return createCloneSimulatorOperation.doFailure(failMsg);
    } else {
        createCloneSimulatorOperation.updateCloneInfo(clones);
        String successMsg = createCloneSimulatorOperation.getSuccessMessage(clones);
        return createCloneSimulatorOperation.doSuccess(successMsg);
    }
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) CreateVolumeCloneSimulatorOperation(com.emc.storageos.driver.driversimulator.operations.CreateVolumeCloneSimulatorOperation)

Example 57 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method discoverStorageProvider.

@Override
public DriverTask discoverStorageProvider(StorageProvider storageProvider, List<StorageSystem> storageSystems) {
    storageProvider.setIsSupportedVersion(true);
    StorageSystem providerSystem = new StorageSystem();
    providerSystem.setSystemType("providersystem");
    providerSystem.setNativeId("providerSystem-1");
    providerSystem.setSerialNumber("1234567-1");
    providerSystem.setFirmwareVersion("1.2.3");
    storageSystems.add(providerSystem);
    providerSystem = new StorageSystem();
    providerSystem.setSystemType("providersystem");
    providerSystem.setNativeId("providerSystem-2");
    providerSystem.setSerialNumber("1234567-2");
    providerSystem.setFirmwareVersion("1.2.3");
    storageSystems.add(providerSystem);
    providerSystem = new StorageSystem();
    providerSystem.setSystemType("providersystem");
    providerSystem.setNativeId("providerSystem-3");
    providerSystem.setSerialNumber("1234567-3");
    providerSystem.setFirmwareVersion("1.2.3");
    storageSystems.add(providerSystem);
    String taskType = "discover-storage-provider";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    task.setStatus(DriverTask.TaskStatus.READY);
    String msg = String.format("Discovered provider: %s, discovered %s storage systems.", storageProvider.getProviderName(), storageSystems.size());
    task.setMessage(msg);
    _log.info(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) StorageSystem(com.emc.storageos.storagedriver.model.StorageSystem)

Example 58 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method discoverStorageSystem.

// DiscoveryDriver implementation
@Override
public DriverTask discoverStorageSystem(StorageSystem storageSystem) {
    _log.info("StorageDriver: discoverStorageSystem information for storage system {}, name {} - start", storageSystem.getIpAddress(), storageSystem.getSystemName());
    String taskType = "discover-storage-system";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    try {
        if (storageSystem.getSerialNumber() == null) {
            storageSystem.setSerialNumber(storageSystem.getSystemName());
        }
        if (storageSystem.getNativeId() == null) {
            storageSystem.setNativeId(storageSystem.getSystemName());
        }
        storageSystem.setFirmwareVersion("2.4-3.12");
        storageSystem.setIsSupportedVersion(true);
        setConnInfoToRegistry(storageSystem.getNativeId(), storageSystem.getIpAddress(), storageSystem.getPortNumber(), storageSystem.getUsername(), storageSystem.getPassword());
        // Support both, element and group replicas.
        Set<StorageSystem.SupportedReplication> supportedReplications = new HashSet<>();
        supportedReplications.add(StorageSystem.SupportedReplication.elementReplica);
        supportedReplications.add(StorageSystem.SupportedReplication.groupReplica);
        storageSystem.setSupportedReplications(supportedReplications);
        task.setStatus(DriverTask.TaskStatus.READY);
        _log.info("StorageDriver: discoverStorageSystem information for storage system {}, nativeId {} - end", storageSystem.getIpAddress(), storageSystem.getNativeId());
        return task;
    } catch (Exception e) {
        task.setStatus(DriverTask.TaskStatus.FAILED);
        e.printStackTrace();
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) BeansException(org.springframework.beans.BeansException) HashSet(java.util.HashSet)

Example 59 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method stopManagement.

@Override
public DriverTask stopManagement(StorageSystem driverStorageSystem) {
    _log.info("Stopping management for StorageSystem {}", driverStorageSystem.getNativeId());
    String driverName = this.getClass().getSimpleName();
    String taskId = String.format("%s+%s+%s", driverName, "stopManagement", UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    task.setStatus(DriverTask.TaskStatus.READY);
    String msg = String.format("Driver stopped managing storage system %s.", driverStorageSystem.getNativeId());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 60 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method createConsistencyGroupClone.

@Override
public DriverTask createConsistencyGroupClone(VolumeConsistencyGroup consistencyGroup, List<VolumeClone> clones, List<CapabilityInstance> capabilities) {
    CreateGroupCloneSimulatorOperation createCloneSimulatorOperation = new CreateGroupCloneSimulatorOperation(consistencyGroup, clones);
    if (simulatorConfig.getSimulateAsynchronousResponses()) {
        DriverTask driverTask = createCloneSimulatorOperation.getDriverTask();
        taskOperationMap.put(driverTask.getTaskId(), createCloneSimulatorOperation);
        return driverTask;
    } else if (simulatorConfig.getSimulateFailures()) {
        String failMsg = createCloneSimulatorOperation.getFailureMessage();
        return createCloneSimulatorOperation.doFailure(failMsg);
    } else {
        createCloneSimulatorOperation.updateGroupCloneInfo(consistencyGroup, clones);
        String successMsg = createCloneSimulatorOperation.getSuccessMessage(clones);
        return createCloneSimulatorOperation.doSuccess(successMsg);
    }
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) CreateGroupCloneSimulatorOperation(com.emc.storageos.driver.driversimulator.operations.CreateGroupCloneSimulatorOperation)

Aggregations

DriverTask (com.emc.storageos.storagedriver.DriverTask)80 BlockStorageDriver (com.emc.storageos.storagedriver.BlockStorageDriver)26 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)26 ArrayList (java.util.ArrayList)26 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)22 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)21 Volume (com.emc.storageos.db.client.model.Volume)15 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)15 IOException (java.io.IOException)15 URI (java.net.URI)15 HashMap (java.util.HashMap)13 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)10 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)9 HashSet (java.util.HashSet)9 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)7 VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)7 BlockObject (com.emc.storageos.db.client.model.BlockObject)6 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)6 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)6