Search in sources :

Example 16 with DriverTask

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

the class DefaultDriverTask method abort.

@Override
public DriverTask abort(DriverTask task) {
    DriverTask abortTaskTask = new DriverTask("AbortTask_" + task.getTaskId()) {

        public DriverTask abort(DriverTask task) {
            throw new UnsupportedOperationException("Cannot abort abort task");
        }
    };
    abortTaskTask.setStatus(TaskStatus.FAILED);
    abortTaskTask.setMessage("abort operation is not supported for default tasks.");
    return abortTaskTask;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 17 with DriverTask

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

the class HP3PARStorageDriver method discoverStoragePorts.

/**
 * Get storage port information
 */
@Override
public DriverTask discoverStoragePorts(StorageSystem storageSystem, List<StoragePort> storagePorts) {
    // For this 3PAR system
    _log.info("3PARDriver: discoverStoragePorts information for storage system {}, nativeId {} - start", storageSystem.getIpAddress(), storageSystem.getNativeId());
    DriverTask task = createDriverTask(HP3PARConstants.TASK_TYPE_DISCOVER_STORAGE_PORTS);
    try {
        hp3parUtil.discoverStoragePortsById(storageSystem.getNativeId(), storagePorts, this.driverRegistry);
        storageSystem.setAccessStatus(AccessStatus.READ_WRITE);
        task.setStatus(DriverTask.TaskStatus.READY);
        _log.info("3PARDriver: discoverStoragePorts information for storage system {}, nativeId {} - end", storageSystem.getIpAddress(), storageSystem.getNativeId());
    } catch (Exception e) {
        String msg = String.format("3PARDriver: Unable to discover the storage port information for storage system %s native id %s; Error: %s.\n", storageSystem.getSystemName(), storageSystem.getNativeId(), e);
        _log.error(msg);
        _log.error(CompleteError.getStackTrace(e));
        task.setMessage(msg);
        task.setStatus(DriverTask.TaskStatus.FAILED);
        e.printStackTrace();
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 18 with DriverTask

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

the class HP3PARStorageDriver method discoverStorageSystem.

/**
 * Get storage system information and capabilities
 */
@Override
public DriverTask discoverStorageSystem(StorageSystem storageSystem) {
    DriverTask task = createDriverTask(HP3PARConstants.TASK_TYPE_DISCOVER_STORAGE_SYSTEM);
    try {
        _log.info("3PARDriver:discoverStorageSystem information for storage system {}, name {} - start", storageSystem.getIpAddress(), storageSystem.getSystemName());
        URI deviceURI = new URI("https", null, storageSystem.getIpAddress(), storageSystem.getPortNumber(), "/", null, null);
        // remove '/' as lock fails with this name
        String uniqueId = deviceURI.toString();
        uniqueId = uniqueId.replace("/", "");
        HP3PARApi hp3parApi = hp3parUtil.getHP3PARDevice(storageSystem);
        String authToken = hp3parApi.getAuthToken(storageSystem.getUsername(), storageSystem.getPassword());
        if (authToken == null) {
            throw new HP3PARException("Could not get authentication token");
        }
        // Verify user role
        hp3parApi.verifyUserRole(storageSystem.getUsername());
        // get storage details
        SystemCommandResult systemRes = hp3parApi.getSystemDetails();
        storageSystem.setSerialNumber(systemRes.getSerialNumber());
        storageSystem.setMajorVersion(systemRes.getSystemVersion());
        // as there is no individual portion in 3par api
        storageSystem.setMinorVersion("0");
        // protocols supported
        List<String> protocols = new ArrayList<String>();
        protocols.add(Protocols.iSCSI.toString());
        protocols.add(Protocols.FC.toString());
        storageSystem.setProtocols(protocols);
        storageSystem.setFirmwareVersion(systemRes.getSystemVersion());
        if (systemRes.getSystemVersion().startsWith("3.1") || systemRes.getSystemVersion().startsWith("3.2.1")) {
            // SDK is taking care of unsupported message
            storageSystem.setIsSupportedVersion(false);
        } else {
            storageSystem.setIsSupportedVersion(true);
        }
        storageSystem.setModel(systemRes.getModel());
        storageSystem.setProvisioningType(SupportedProvisioningType.THIN_AND_THICK);
        Set<StorageSystem.SupportedReplication> supportedReplications = new HashSet<>();
        supportedReplications.add(StorageSystem.SupportedReplication.elementReplica);
        supportedReplications.add(StorageSystem.SupportedReplication.groupReplica);
        storageSystem.setSupportedReplications(supportedReplications);
        // Storage object properties
        storageSystem.setNativeId(uniqueId + ":" + systemRes.getSerialNumber());
        if (storageSystem.getDeviceLabel() == null) {
            if (storageSystem.getDisplayName() != null) {
                storageSystem.setDeviceLabel(storageSystem.getDisplayName());
            } else if (systemRes.getName() != null) {
                storageSystem.setDeviceLabel(systemRes.getName());
                storageSystem.setDisplayName(systemRes.getName());
            }
        }
        storageSystem.setAccessStatus(AccessStatus.READ_WRITE);
        setConnInfoToRegistry(storageSystem.getNativeId(), storageSystem.getIpAddress(), storageSystem.getPortNumber(), storageSystem.getUsername(), storageSystem.getPassword());
        task.setStatus(DriverTask.TaskStatus.READY);
        _log.info("3PARDriver: Successfull discovery storage system {}, name {} - end", storageSystem.getIpAddress(), storageSystem.getSystemName());
    } catch (Exception e) {
        String msg = String.format("3PARDriver: Unable to discover the storage system %s ip %s; Error: %s.\n", storageSystem.getSystemName(), storageSystem.getIpAddress(), e);
        _log.error(msg);
        _log.error(CompleteError.getStackTrace(e));
        task.setMessage(msg);
        task.setStatus(DriverTask.TaskStatus.FAILED);
        e.printStackTrace();
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) ArrayList(java.util.ArrayList) SystemCommandResult(com.emc.storageos.hp3par.command.SystemCommandResult) URI(java.net.URI) HashSet(java.util.HashSet)

Example 19 with DriverTask

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

the class HP3PARStorageDriver method addVolumesToConsistencyGroup.

@Override
public DriverTask addVolumesToConsistencyGroup(List<StorageVolume> volumes, StorageCapabilities capabilities) {
    int addVolume = 1;
    DriverTask task = createDriverTask(HP3PARConstants.TASK_TYPE_ADD_VOLUME_TO_CONSISTENCY_GROUP);
    return cgHelper.addOrRemoveConsistencyGroupVolume(volumes, task, driverRegistry, addVolume);
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 20 with DriverTask

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

the class DellSCDriverTask method abort.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.storagedriver.DriverTask#abort(com.emc.storageos.storagedriver.DriverTask)
     */
@Override
public DriverTask abort(DriverTask task) {
    DriverTask abortTask = new DriverTask("Abort driver task") {

        @Override
        public DriverTask abort(DriverTask task) {
            return null;
        }
    };
    abortTask.setStatus(TaskStatus.FAILED);
    abortTask.setMessage("Operation is not supported.");
    return abortTask;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

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