Search in sources :

Example 21 with VolumeSnapshot

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

the class HP3PARCGHelper method deleteConsistencyGroupSnapshot.

public DriverTask deleteConsistencyGroupSnapshot(List<VolumeSnapshot> snapshots, DriverTask task, Registry driverRegistry) {
    String storageSystemId = null;
    HP3PARApi hp3parApi = null;
    // For each requested CG volume snapshot
    for (VolumeSnapshot snap : snapshots) {
        try {
            _log.info("3PARDriver: deleteConsistencyGroupSnapshot for storage system native id {}, volume name {} , native id {} - start", snap.getStorageSystemId(), snap.getDisplayName(), snap.getNativeId());
            String localStorageSystemId = snap.getStorageSystemId();
            // get Api client
            if (storageSystemId == null || storageSystemId != localStorageSystemId) {
                storageSystemId = localStorageSystemId;
                hp3parApi = hp3parUtil.getHP3PARDeviceFromNativeId(localStorageSystemId, driverRegistry);
            }
            // Delete virtual copy
            hp3parApi.deleteVirtualCopy(snap.getNativeId());
            task.setStatus(DriverTask.TaskStatus.READY);
            _log.info("3PARDriver: deleteConsistencyGroupSnapshot for storage system native id {}, volume name {} - end", snap.getStorageSystemId(), snap.getDisplayName());
        } catch (Exception e) {
            String msg = String.format("3PARDriver: deleteConsistencyGroupSnapshot Unable to delete cg snapshot name %s with native id %s for storage system native id %s; Error: %s.\n", snap.getDisplayName(), snap.getNativeId(), snap.getStorageSystemId(), e.getMessage());
            _log.error(msg);
            task.setMessage(msg);
            task.setStatus(DriverTask.TaskStatus.PARTIALLY_FAILED);
            e.printStackTrace();
        }
    }
    return task;
}
Also used : VolumeSnapshot(com.emc.storageos.storagedriver.model.VolumeSnapshot)

Example 22 with VolumeSnapshot

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

the class ExternalBlockStorageDevice method hasExports.

/**
 * Check if block object has exports on device
 *
 * @param driver storage driver
 * @param driverBlockObject driver block object
 * @return true/false
 */
private boolean hasExports(BlockStorageDriver driver, StorageBlockObject driverBlockObject) {
    Map<String, HostExportInfo> blocObjectToHostExportInfo = null;
    // get HostExportInfo data for this block object from the driver
    if (driverBlockObject instanceof VolumeClone) {
        VolumeClone driverClone = (VolumeClone) driverBlockObject;
        blocObjectToHostExportInfo = driver.getCloneExportInfoForHosts(driverClone);
        _log.info("Export info for clone {} is {}:", driverClone, blocObjectToHostExportInfo);
    } else if (driverBlockObject instanceof VolumeSnapshot) {
        VolumeSnapshot driverSnapshot = (VolumeSnapshot) driverBlockObject;
        blocObjectToHostExportInfo = driver.getSnapshotExportInfoForHosts(driverSnapshot);
        _log.info("Export info for snapshot {} is {}:", driverSnapshot, blocObjectToHostExportInfo);
    } else if (driverBlockObject instanceof StorageVolume) {
        StorageVolume driverVolume = (StorageVolume) driverBlockObject;
        blocObjectToHostExportInfo = driver.getVolumeExportInfoForHosts(driverVolume);
        _log.info("Export info for volume {} is {}:", driverVolume, blocObjectToHostExportInfo);
    } else {
        // not supported type in this method
        String errorMsg = String.format("Method is not supported for %s objects.", driverBlockObject.getClass().getSimpleName());
        throw new RuntimeException(errorMsg);
    }
    return !(blocObjectToHostExportInfo == null || blocObjectToHostExportInfo.isEmpty());
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) HostExportInfo(com.emc.storageos.storagedriver.HostExportInfo) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone) VolumeSnapshot(com.emc.storageos.storagedriver.model.VolumeSnapshot)

Aggregations

VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)22 DriverTask (com.emc.storageos.storagedriver.DriverTask)8 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)7 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)7 ArrayList (java.util.ArrayList)7 Volume (com.emc.storageos.db.client.model.Volume)6 BlockStorageDriver (com.emc.storageos.storagedriver.BlockStorageDriver)5 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)5 URI (java.net.URI)4 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)3 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)3 VolumeDetailsCommandResult (com.emc.storageos.hp3par.command.VolumeDetailsCommandResult)3 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)2 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)2 StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)2 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)2 HashMap (java.util.HashMap)2 StringSet (com.emc.storageos.db.client.model.StringSet)1 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1