Search in sources :

Example 6 with VolumeConsistencyGroup

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);
}
Also used : VolumeConsistencyGroup(com.emc.storageos.storagedriver.model.VolumeConsistencyGroup) CreateGroupCloneDriverTask(com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone)

Example 7 with VolumeConsistencyGroup

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());
}
Also used : VolumeConsistencyGroup(com.emc.storageos.storagedriver.model.VolumeConsistencyGroup) UnManagedConsistencyGroup(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedConsistencyGroup)

Example 8 with VolumeConsistencyGroup

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;
}
Also used : VolumeConsistencyGroup(com.emc.storageos.storagedriver.model.VolumeConsistencyGroup)

Example 9 with 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.....");
    }
}
Also used : VolumeConsistencyGroup(com.emc.storageos.storagedriver.model.VolumeConsistencyGroup) DriverTask(com.emc.storageos.storagedriver.DriverTask) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockStorageDriver(com.emc.storageos.storagedriver.BlockStorageDriver) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) IOException(java.io.IOException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Aggregations

VolumeConsistencyGroup (com.emc.storageos.storagedriver.model.VolumeConsistencyGroup)9 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)4 BlockStorageDriver (com.emc.storageos.storagedriver.BlockStorageDriver)4 DriverTask (com.emc.storageos.storagedriver.DriverTask)4 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)4 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)3 IOException (java.io.IOException)3 URI (java.net.URI)3 Volume (com.emc.storageos.db.client.model.Volume)2 StoragePool (com.emc.storageos.storagedriver.model.StoragePool)2 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 UnManagedConsistencyGroup (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedConsistencyGroup)1