use of com.emc.storageos.storagedriver.model.VolumeConsistencyGroup in project coprhd-controller by CoprHD.
the class CreateGroupCloneSimulatorOperation method updateOnAsynchronousSuccess.
@Override
public void updateOnAsynchronousSuccess() {
CreateGroupCloneDriverTask createCloneTask = (CreateGroupCloneDriverTask) _task;
List<VolumeClone> clones = createCloneTask.getClones();
VolumeConsistencyGroup consistencyGroup = createCloneTask.getConsistencyGroup();
updateGroupCloneInfo(consistencyGroup, clones);
}
use of com.emc.storageos.storagedriver.model.VolumeConsistencyGroup in project coprhd-controller by CoprHD.
the class ExternalDeviceUnManagedVolumeDiscoverer method addObjectToUnManagedConsistencyGroup.
/**
* Add storage object to unManaged consistency group.
* Sets consistency group related attributes in the object and adds object to the list of unManaged
* objects in the unManaged consistency group instance.
*
* @param storageSystem storage system of the object [IN]
* @param cgNativeId native id of umanaged consistency group [IN]
* @param unManagedVolume unManaged object [IN/OUT] unmanaged obect (volume/snap/clone) with CG information
* @param allCurrentUnManagedCgURIs set of unManaged CG uris found in the current discovery [OUT]
* @param unManagedCGToUpdateMap map of unManaged CG GUID to unManaged CG instance [IN/OUT]
* @param driver storage driver [IN]
* @param dbClient reference to db client [IN]
* @throws Exception
*/
private void addObjectToUnManagedConsistencyGroup(com.emc.storageos.db.client.model.StorageSystem storageSystem, String cgNativeId, UnManagedVolume unManagedVolume, Set<URI> allCurrentUnManagedCgURIs, Map<String, UnManagedConsistencyGroup> unManagedCGToUpdateMap, BlockStorageDriver driver, DbClient dbClient) throws Exception {
log.info("UnManaged storage object {} belongs to consistency group {} on the array", unManagedVolume.getLabel(), cgNativeId);
// determine the native guid for the unManaged CG
String unManagedCGNativeGuid = NativeGUIDGenerator.generateNativeGuidForCG(storageSystem.getNativeGuid(), cgNativeId);
log.info("UnManaged consistency group has nativeGuid {} ", unManagedCGNativeGuid);
// determine if the unManaged CG already exists in the unManagedCGToUpdateMap or in the database
// if the the unManaged CG is not in either, create a new one
UnManagedConsistencyGroup unManagedCG = null;
if (unManagedCGToUpdateMap.containsKey(unManagedCGNativeGuid)) {
unManagedCG = unManagedCGToUpdateMap.get(unManagedCGNativeGuid);
log.info("UnManaged consistency group {} was previously added to the unManagedCGToUpdateMap", unManagedCG.getNativeGuid());
} else {
unManagedCG = DiscoveryUtils.checkUnManagedCGExistsInDB(dbClient, unManagedCGNativeGuid);
if (null == unManagedCG) {
// unManaged CG does not exist in the database, create it
VolumeConsistencyGroup driverCG = driver.getStorageObject(storageSystem.getNativeId(), cgNativeId, VolumeConsistencyGroup.class);
if (driverCG != null) {
unManagedCG = createUnManagedCG(driverCG, storageSystem, dbClient);
log.info("Created unManaged consistency group: {} with nativeGuid {}", unManagedCG.getId().toString(), unManagedCG.getNativeGuid());
} else {
String msg = String.format("Driver VolumeConsistencyGroup with native id %s does not exist on storage system %s", cgNativeId, storageSystem.getNativeId());
log.error(msg);
throw new Exception(msg);
}
} else {
log.info("UnManaged consistency group {} was previously added to the database (by previous unManaged discovery).", unManagedCG.getNativeGuid());
// clean out the list of unManaged objects if this unManaged cg was already
// in the database and its first time being used in this discovery operation
// the list should be re-populated by the current discovery operation
log.info("Cleaning out unManaged object map from unManaged consistency group: {}", unManagedCG.getNativeGuid());
unManagedCG.getUnManagedVolumesMap().clear();
}
}
log.info("Adding unManaged storage object {} to unManaged consistency group {}", unManagedVolume.getLabel(), unManagedCG.getNativeGuid());
// Update the unManagedVolume object with CG information
unManagedVolume.getVolumeCharacterstics().put(UnManagedVolume.SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(), Boolean.TRUE.toString());
// set the uri of the unManaged CG in the unManaged volume object
unManagedVolume.getVolumeInformation().remove(UnManagedVolume.SupportedVolumeInformation.UNMANAGED_CONSISTENCY_GROUP_URI.toString());
unManagedVolume.getVolumeInformation().put(UnManagedVolume.SupportedVolumeInformation.UNMANAGED_CONSISTENCY_GROUP_URI.toString(), unManagedCG.getId().toString());
// add the unManaged volume object to the unManaged CG
unManagedCG.getUnManagedVolumesMap().put(unManagedVolume.getNativeGuid(), unManagedVolume.getId().toString());
// add the unManaged CG to the map of unManaged CGs to be updated in the database once all volumes have been processed
unManagedCGToUpdateMap.put(unManagedCGNativeGuid, unManagedCG);
// add the unManaged CG to the current set of CGs being discovered on the array. This is for book keeping later.
allCurrentUnManagedCgURIs.add(unManagedCG.getId());
}
use of com.emc.storageos.storagedriver.model.VolumeConsistencyGroup in project coprhd-controller by CoprHD.
the class DellSCUtil method getVolumeConsistencyGroupFromReplayProfile.
/**
* Gets a consistency group object from an SC replay profile.
*
* @param cg The ScReplayProfile.
* @param volumeConsistencyGroup The consistency group object or null.
* @return The consistency group object.
*/
public VolumeConsistencyGroup getVolumeConsistencyGroupFromReplayProfile(ScReplayProfile cg, VolumeConsistencyGroup volumeConsistencyGroup) {
if (volumeConsistencyGroup == null) {
volumeConsistencyGroup = new VolumeConsistencyGroup();
}
volumeConsistencyGroup.setAccessStatus(AccessStatus.READ_WRITE);
volumeConsistencyGroup.setNativeId(cg.instanceId);
volumeConsistencyGroup.setDeviceLabel(cg.name);
volumeConsistencyGroup.setStorageSystemId(cg.scSerialNumber);
return volumeConsistencyGroup;
}
use of com.emc.storageos.storagedriver.model.VolumeConsistencyGroup in project coprhd-controller by CoprHD.
the class ExternalBlockStorageDevice method doCreateConsistencyGroup.
@Override
public void doCreateConsistencyGroup(StorageSystem storageSystem, URI consistencyGroup, String replicationGroupName, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("Creating consistency group for volumes START.....");
BlockConsistencyGroup cg = null;
try {
VolumeConsistencyGroup driverCG = new VolumeConsistencyGroup();
cg = dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
driverCG.setDisplayName(cg.getLabel());
driverCG.setStorageSystemId(storageSystem.getNativeId());
// call driver
BlockStorageDriver driver = getDriver(storageSystem.getSystemType());
DriverTask task = driver.createConsistencyGroup(driverCG);
// todo: need to implement support for async case.
if (task.getStatus() == DriverTask.TaskStatus.READY) {
cg.setNativeId(driverCG.getNativeId());
cg.addSystemConsistencyGroup(storageSystem.getId().toString(), cg.getLabel());
cg.addConsistencyGroupTypes(BlockConsistencyGroup.Types.LOCAL.name());
if (NullColumnValueGetter.isNullURI(cg.getStorageController())) {
cg.setStorageController(storageSystem.getId());
}
dbClient.updateObject(cg);
String msg = String.format("doCreateConsistencyGroup -- Created consistency group: %s .", task.getMessage());
_log.info(msg);
taskCompleter.ready(dbClient);
} else {
cg.setInactive(true);
dbClient.updateObject(cg);
String errorMsg = String.format("doCreateConsistencyGroup -- Failed to create Consistency Group: %s .", task.getMessage());
_log.error(errorMsg);
ServiceError serviceError = ExternalDeviceException.errors.createConsistencyGroupFailed("doCreateConsistencyGroup", errorMsg);
taskCompleter.error(dbClient, serviceError);
}
} catch (Exception e) {
if (cg != null) {
cg.setInactive(true);
dbClient.updateObject(cg);
}
String errorMsg = String.format("doCreateConsistencyGroup -- Failed to create Consistency Group: %s .", e.getMessage());
_log.error(errorMsg, e);
ServiceError serviceError = ExternalDeviceException.errors.createConsistencyGroupFailed("doCreateConsistencyGroup", errorMsg);
taskCompleter.error(dbClient, serviceError);
} finally {
_log.info("Creating consistency group for volumes END.....");
}
}
Aggregations