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;
}
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());
}
Aggregations