/** * Validate the SourceVolume VArray details with ingested target volumes VArray. * * @param unManagedVolume * @param VirtualPool * @return */ private void validateSourceVolumeVarrayWithTargetVPool( UnManagedVolume unManagedVolume, VirtualPool sourceVPool) { StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation(); // find whether all targets are ingested StringSet targetUnManagedVolumeGuids = unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()); if (null != targetUnManagedVolumeGuids && !targetUnManagedVolumeGuids.isEmpty()) { StringSet targetVolumeNativeGuids = VolumeIngestionUtil.getListofVolumeIds(targetUnManagedVolumeGuids); // check whether target exists List<URI> targetUris = VolumeIngestionUtil.getVolumeUris(targetVolumeNativeGuids, _dbClient); if (null == targetUris || targetUris.isEmpty()) { _logger.info( "None of the targets ingested for source volume: {}", unManagedVolume.getNativeGuid()); } else { List<Volume> targetVolumes = _dbClient.queryObject(Volume.class, targetUris); for (Volume targetVolume : targetVolumes) { Map<URI, VpoolRemoteCopyProtectionSettings> settings = sourceVPool.getRemoteProtectionSettings(sourceVPool, _dbClient); if (null == settings || settings.size() == 0 || !settings.containsKey(targetVolume.getVirtualArray())) { _logger.info( "Target Volume's VArray {} is not matching already ingested source volume virtual pool's remote VArray {}", targetVolume.getVirtualArray(), Joiner.on(",").join(settings.keySet())); throw IngestionException.exceptions.unmanagedSRDFSourceVolumeVArrayMismatch( unManagedVolume.getLabel(), targetVolume.getVirtualArray().toString()); } } } } }
/** * Return the rdfGroupId based on the personality. For source volume, we will not have RDFGroup * hence we should get it from its targets. * * @param unManagedVolumeInformation * @return */ private URI getRDFGroupBasedOnPersonality(StringSetMap unManagedVolumeInformation) { String type = PropertySetterUtil.extractValueFromStringSet( SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString(), unManagedVolumeInformation); URI rdfGroupId = null; if (RemoteMirrorObject.Types.SOURCE.toString().equalsIgnoreCase(type)) { StringSet targetUnManagedVolumeGuids = unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()); if (null != targetUnManagedVolumeGuids && !targetUnManagedVolumeGuids.isEmpty()) { StringSet targetVolumeNativeGuids = VolumeIngestionUtil.getListofVolumeIds(targetUnManagedVolumeGuids); List<URI> targetUris = VolumeIngestionUtil.getVolumeUris(targetVolumeNativeGuids, _dbClient); if (null == targetUris || targetUris.isEmpty()) { List<URI> unmanagedTargetVolumes = VolumeIngestionUtil.getUnManagedVolumeUris(targetUnManagedVolumeGuids, _dbClient); for (URI targetUmv : unmanagedTargetVolumes) { _logger.info("RDFGroup Found using unmanaged Target volume {}", targetUmv); UnManagedVolume umv = _dbClient.queryObject(UnManagedVolume.class, targetUmv); rdfGroupId = URI.create( PropertySetterUtil.extractValueFromStringSet( SupportedVolumeInformation.REMOTE_MIRROR_RDF_GROUP.toString(), umv.getVolumeInformation())); break; } } else { // If targets are already ingested. List<Volume> targetVolumes = _dbClient.queryObject(Volume.class, targetUris); if (null != targetVolumes && !targetVolumes.isEmpty()) { for (Volume targetVolume : targetVolumes) { _logger.info( "RDFGroup Found for using ingested Target volumes {}.", targetVolume.getNativeGuid()); rdfGroupId = targetVolume.getSrdfGroup(); break; } } } } } else if (RemoteMirrorObject.Types.TARGET.toString().equalsIgnoreCase(type)) { rdfGroupId = URI.create( PropertySetterUtil.extractValueFromStringSet( SupportedVolumeInformation.REMOTE_MIRROR_RDF_GROUP.toString(), unManagedVolumeInformation)); } return rdfGroupId; }