Search in sources :

Example 26 with UnManagedVolume

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.

the class RemoteReplicationIngestor method runRemoteReplicationStepsOnPartiallyIngestedVolume.

public static boolean runRemoteReplicationStepsOnPartiallyIngestedVolume(UnManagedVolume unManagedVolume, BlockObject bo, List<UnManagedVolume> unManagedVolumes, DbClient dbClient) {
    Volume volume = (Volume) bo;
    StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
    boolean remoteLinksEstablished = false;
    String type = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString(), unManagedVolumeInformation);
    if (null == type) {
        return true;
    }
    if (RemoteMirrorObject.Types.SOURCE.toString().equalsIgnoreCase(type)) {
        volume.setPersonality(PersonalityTypes.SOURCE.toString());
        remoteLinksEstablished = runRemoteReplicationStepsOnSource(unManagedVolume, volume, unManagedVolumes, type, dbClient);
    } else if (RemoteMirrorObject.Types.TARGET.toString().equalsIgnoreCase(type)) {
        volume.setPersonality(PersonalityTypes.TARGET.toString());
        remoteLinksEstablished = runRemoteReplicationStepsOnTarget(unManagedVolume, volume, unManagedVolumes, type, dbClient);
    }
    return remoteLinksEstablished;
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume)

Example 27 with UnManagedVolume

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method getUnManagedSnaphots.

/**
 * Returns a List of UnManagedVolumes that are snapshots of the given
 * source UnManagedVolume.
 *
 * @param unManagedVolume the volume to check for snapshots
 * @param dbClient a reference to the database client
 *
 * @return a List of UnManagedVolumes that are snapshots of the given
 *         source UnManagedVolume
 */
public static List<UnManagedVolume> getUnManagedSnaphots(UnManagedVolume unManagedVolume, DbClient dbClient) {
    List<UnManagedVolume> snapshots = new ArrayList<UnManagedVolume>();
    _logger.info("checking for snapshots related to unmanaged volume " + unManagedVolume.getLabel());
    if (checkUnManagedVolumeHasReplicas(unManagedVolume)) {
        StringSet snapshotNativeIds = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.SNAPSHOTS.toString(), unManagedVolume.getVolumeInformation());
        List<URI> snapshotUris = new ArrayList<URI>();
        if (null != snapshotNativeIds && !snapshotNativeIds.isEmpty()) {
            for (String nativeId : snapshotNativeIds) {
                _logger.info("   found snapshot native id " + nativeId);
                URIQueryResultList unManagedVolumeList = new URIQueryResultList();
                dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(nativeId), unManagedVolumeList);
                if (unManagedVolumeList.iterator().hasNext()) {
                    snapshotUris.add(unManagedVolumeList.iterator().next());
                }
            }
        }
        if (!snapshotUris.isEmpty()) {
            snapshots = dbClient.queryObject(UnManagedVolume.class, snapshotUris, true);
            _logger.info("   returning snapshot objects: " + snapshots);
        }
    }
    return snapshots;
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) ArrayList(java.util.ArrayList) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 28 with UnManagedVolume

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method getUnManagedVolumeForBlockObject.

/**
 * Returns an UnManagedVolume object if the blockObject has an UnManagedVolume.
 * Otherwise, returns null;
 *
 * @param blockObject the block object to check
 * @param dbClient a reference to the database client
 * @return a UnManagedVolume object
 */
public static UnManagedVolume getUnManagedVolumeForBlockObject(BlockObject blockObject, DbClient dbClient) {
    String unmanagedVolumeGUID = blockObject.getNativeGuid().replace(VOLUME, UNMANAGEDVOLUME);
    URIQueryResultList umvUriList = new URIQueryResultList();
    dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(unmanagedVolumeGUID), umvUriList);
    while (umvUriList.iterator().hasNext()) {
        URI umvUri = (umvUriList.iterator().next());
        UnManagedVolume umVolume = dbClient.queryObject(UnManagedVolume.class, umvUri);
        _logger.info("block object {} is UnManagedVolume {}", blockObject.getLabel(), umVolume.getId());
        return umVolume;
    }
    return null;
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 29 with UnManagedVolume

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method getRPVolume.

/**
 * Gets the RP block object corresponding to the passed in block object.
 * The unamanged volume corresponding to the block object is retrieved to determine the RP properties
 * because the RP properties might not yet be set in the BlockObject.
 *
 * If the passed in block object is RP protected, returns back the same block object.
 *
 * If the passed in block object is a VPLEX backend volume, returns the block object
 * corresponding to the VPLEX virtual volume
 *
 * @param requestContext current unManagedVolume Ingestion context.
 * @param blockObject Block object
 * @param dbClient dbClient reference
 * @return RP protected block object, null if not RP protected.
 */
public static BlockObject getRPVolume(IngestionRequestContext requestContext, BlockObject blockObject, DbClient dbClient) {
    UnManagedVolume umVolume = getUnManagedVolumeForBlockObject(blockObject, dbClient);
    if (umVolume != null && checkUnManagedResourceIsRecoverPointEnabled(umVolume)) {
        return blockObject;
    }
    // If this is a vplex backend volume, then check if the vplex virtual volume is RP enabled
    if (umVolume != null && isVplexBackendVolume(umVolume)) {
        String vplexParentVolumeGUID = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.VPLEX_PARENT_VOLUME.toString(), umVolume.getVolumeInformation());
        String vplexParentBlockObjectGUID = vplexParentVolumeGUID.replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
        BlockObject vplexParentBlockObject = requestContext.findCreatedBlockObject(vplexParentBlockObjectGUID);
        if (vplexParentBlockObject == null) {
            vplexParentBlockObject = VolumeIngestionUtil.getBlockObject(vplexParentBlockObjectGUID, dbClient);
        }
        URIQueryResultList unManagedVolumeList = new URIQueryResultList();
        dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(vplexParentVolumeGUID), unManagedVolumeList);
        if (unManagedVolumeList.iterator().hasNext()) {
            UnManagedVolume umv = dbClient.queryObject(UnManagedVolume.class, unManagedVolumeList.iterator().next());
            if (umv != null && checkUnManagedResourceIsRecoverPointEnabled(umv)) {
                return vplexParentBlockObject;
            }
        }
    }
    return null;
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) BlockObject(com.emc.storageos.db.client.model.BlockObject) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 30 with UnManagedVolume

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method getUnManagedClones.

/**
 * Returns a List of UnManagedVolumes that are clones of the given
 * source UnManagedVolume.
 *
 * @param unManagedVolume the volume to check for clones
 * @param dbClient a reference to the database client
 *
 * @return a List of UnManagedVolumes that are clones of the given
 *         source UnManagedVolume
 */
public static List<UnManagedVolume> getUnManagedClones(UnManagedVolume unManagedVolume, DbClient dbClient) {
    List<UnManagedVolume> clones = new ArrayList<UnManagedVolume>();
    _logger.info("checking for clones (full copies) related to unmanaged volume " + unManagedVolume.getLabel());
    if (checkUnManagedVolumeHasReplicas(unManagedVolume)) {
        StringSet cloneNativeIds = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.FULL_COPIES.toString(), unManagedVolume.getVolumeInformation());
        List<URI> cloneUris = new ArrayList<URI>();
        if (null != cloneNativeIds && !cloneNativeIds.isEmpty()) {
            for (String nativeId : cloneNativeIds) {
                _logger.info("   found clone native id " + nativeId);
                URIQueryResultList unManagedVolumeList = new URIQueryResultList();
                dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(nativeId), unManagedVolumeList);
                if (unManagedVolumeList.iterator().hasNext()) {
                    cloneUris.add(unManagedVolumeList.iterator().next());
                }
            }
        }
        if (!cloneUris.isEmpty()) {
            clones = dbClient.queryObject(UnManagedVolume.class, cloneUris, true);
            _logger.info("   returning clone objects: " + clones);
        }
    }
    return clones;
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) ArrayList(java.util.ArrayList) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Aggregations

UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)146 StringSet (com.emc.storageos.db.client.model.StringSet)66 URI (java.net.URI)53 Volume (com.emc.storageos.db.client.model.Volume)48 ArrayList (java.util.ArrayList)48 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)33 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)31 BlockObject (com.emc.storageos.db.client.model.BlockObject)30 HashMap (java.util.HashMap)29 HashSet (java.util.HashSet)24 NamedURI (com.emc.storageos.db.client.model.NamedURI)19 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)19 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)18 DataObject (com.emc.storageos.db.client.model.DataObject)13 UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)13 CIMObjectPath (javax.cim.CIMObjectPath)13 UnManagedProtectionSet (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)12 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)11 Map (java.util.Map)11 StringMap (com.emc.storageos.db.client.model.StringMap)10