Search in sources :

Example 1 with UnManagedDiscoveredObject

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

the class ImplicitUnManagedObjectsMatcher method addVPoolToUnManagedObjectSupportedVPools.

/**
 * add VPool to Supported VPool List of UnManaged Objects.
 * @param virtualPool the virtual pool
 * @param unManagedObjectInfo the un managed object info
 * @param system the system (for Block systems, to verify policy matching)
 * @param srdfEnabledTargetVPools SRDF enabled target vpools
 * @param rpEnabledTargetVPools RP enabled target vpools
 * @param supportedVPoolsList the supported v pools list
 * @param unManagedObjectURI the un managed object uri
 *
 * @return true, if successful
 */
private static boolean addVPoolToUnManagedObjectSupportedVPools(VirtualPool virtualPool, StringSetMap unManagedObjectInfo, UnManagedDiscoveredObject unManagedObject, StorageSystem system, Set<URI> srdfEnabledTargetVPools, Set<URI> rpEnabledTargetVPools) {
    // if virtual pool is already part of supported vpool
    // List, then continue;
    StringSet supportedVPoolsList = unManagedObject.getSupportedVpoolUris();
    if (null != supportedVPoolsList && supportedVPoolsList.contains(virtualPool.getId().toString())) {
        _log.debug("Matched VPool already there {}", virtualPool.getId().toString());
        return false;
    }
    if (VirtualPool.Type.block.name().equals(virtualPool.getType())) {
        // Before adding this vPool to supportedVPoolList, check if Tiering policy matches
        if (system != null && system.getAutoTieringEnabled()) {
            String autoTierPolicyId = null;
            if (unManagedObjectInfo.containsKey(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString())) {
                for (String policyName : unManagedObjectInfo.get(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString())) {
                    autoTierPolicyId = NativeGUIDGenerator.generateAutoTierPolicyNativeGuid(system.getNativeGuid(), policyName, NativeGUIDGenerator.getTieringPolicyKeyForSystem(system));
                    break;
                }
            }
            if (!DiscoveryUtils.checkVPoolValidForUnManagedVolumeAutoTieringPolicy(virtualPool, autoTierPolicyId, system)) {
                String msg = "VPool %s is not added to UnManaged Volume's (%s) supported vPool list " + "since Auto-tiering Policy %s in UnManaged Volume does not match with vPool's (%s)";
                _log.debug(String.format(msg, new Object[] { virtualPool.getId(), unManagedObject.getId(), autoTierPolicyId, virtualPool.getAutoTierPolicyName() }));
                return false;
            }
        }
        // don't add vplex virtual pools to non vplex volumes
        if (VirtualPool.vPoolSpecifiesHighAvailability(virtualPool) && (unManagedObject instanceof UnManagedVolume)) {
            UnManagedVolume unManagedVolume = (UnManagedVolume) unManagedObject;
            if (null != unManagedVolume.getVolumeCharacterstics()) {
                String isVplexVolume = unManagedVolume.getVolumeCharacterstics().get(SupportedVolumeCharacterstics.IS_VPLEX_VOLUME.toString());
                if (isVplexVolume == null || isVplexVolume.isEmpty() || !TRUE.equals(isVplexVolume)) {
                    _log.debug(String.format("VPool %s is not added to UnManaged Volume's (%s) supported vPool list " + "since the vpool has high availability set and the volume is non VPLEX.", new Object[] { virtualPool.getId(), unManagedVolume.forDisplay() }));
                    return false;
                }
            }
        }
        // Verify whether unmanaged volume SRDF properties with the Vpool
        boolean srdfSourceVpool = (null != virtualPool.getProtectionRemoteCopySettings() && !virtualPool.getProtectionRemoteCopySettings().isEmpty());
        boolean srdfTargetVpool = srdfEnabledTargetVPools == null ? false : (srdfEnabledTargetVPools.contains(virtualPool.getId()));
        StringSet remoteVolType = unManagedObjectInfo.get(SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString());
        boolean isRegularVolume = (null == remoteVolType);
        boolean isSRDFSourceVolume = (null != remoteVolType && remoteVolType.contains(RemoteMirrorObject.Types.SOURCE.toString()));
        boolean isSRDFTargetVolume = (null != remoteVolType && remoteVolType.contains(RemoteMirrorObject.Types.TARGET.toString()));
        if (isRegularVolume && (srdfSourceVpool || srdfTargetVpool)) {
            _log.debug("Found a regular volume with SRDF Protection Virtual Pool. No need to update.");
            return false;
        } else if (isSRDFSourceVolume && !(srdfSourceVpool || srdfTargetVpool)) {
            _log.debug("Found a SRDF unmanaged volume with non-srdf virtualpool. No need to update.");
            return false;
        } else if (isSRDFSourceVolume && srdfTargetVpool) {
            _log.debug("Found a SRDF source volume & target srdf vpool. No need to update.");
            return false;
        } else if (isSRDFTargetVolume && srdfSourceVpool) {
            _log.debug("Found a SRDFTarget volume & source srdf source vpool No need to update.");
            return false;
        }
        // Verify whether unmanaged volume RP properties with the Vpool
        boolean isRPSourceVpool = (null != virtualPool.getProtectionVarraySettings() && !virtualPool.getProtectionVarraySettings().isEmpty());
        boolean isRPTargetVpool = rpEnabledTargetVPools == null ? false : (rpEnabledTargetVPools.contains(virtualPool.getId()));
        remoteVolType = unManagedObjectInfo.get(SupportedVolumeInformation.RP_PERSONALITY.toString());
        isRegularVolume = (null == remoteVolType);
        boolean isRPSourceVolume = (null != remoteVolType && remoteVolType.contains(Volume.PersonalityTypes.SOURCE.toString()));
        if (isRegularVolume && (isRPSourceVpool || isRPTargetVpool)) {
            _log.debug("Found a regular volume with RP Protection Virtual Pool. No need to update.");
            return false;
        } else if (isRPSourceVolume && !isRPSourceVpool) {
            _log.debug("Found a RP unmanaged volume with non-rp virtualpool. No need to update.");
            return false;
        } else if (isRPSourceVolume && isRPTargetVpool) {
            _log.debug("Found a RP source volume & target rp vpool. No need to update.");
            return false;
        }
    }
    // empty
    if (null == supportedVPoolsList) {
        _log.debug("Adding a new Supported VPool List {}", virtualPool.getId().toString());
        supportedVPoolsList = new StringSet();
    }
    // updating the vpool list with new vpool
    supportedVPoolsList.add(virtualPool.getId().toString());
    return true;
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) StringSet(com.emc.storageos.db.client.model.StringSet) RemoteMirrorObject(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery.RemoteMirrorObject) DataObject(com.emc.storageos.db.client.model.DataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject)

Aggregations

DataObject (com.emc.storageos.db.client.model.DataObject)1 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 UnManagedDiscoveredObject (com.emc.storageos.db.client.model.UnManagedDiscoveredObject)1 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)1 RemoteMirrorObject (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery.RemoteMirrorObject)1