private void processVolumes(
      CloseableIterator<CIMInstance> volumeInstances, Map<String, Object> keyMap)
      throws IOException {

    List<CIMObjectPath> metaVolumes = new ArrayList<>();
    while (volumeInstances.hasNext()) {
      CIMInstance volumeViewInstance = volumeInstances.next();
      String nativeGuid = getVolumeViewNativeGuid(volumeViewInstance.getObjectPath(), keyMap);

      if (isSnapShot(volumeViewInstance)) {
        BlockSnapshot snapShot = checkSnapShotExistsInDB(nativeGuid, _dbClient);
        if (null == snapShot || snapShot.getInactive()) {
          _logger.debug("Skipping Snapshot, as its not being managed in Bourne");
          continue;
        }
        updateBlockSnapShot(volumeViewInstance, snapShot, keyMap);
        if (_updateSnapShots.size() > BATCH_SIZE) {
          _partitionManager.updateInBatches(
              _updateSnapShots, getPartitionSize(keyMap), _dbClient, BLOCK_SNAPSHOT);
          _updateSnapShots.clear();
        }
      } else if (isMirror(volumeViewInstance)) {
        BlockMirror mirror = checkBlockMirrorExistsInDB(nativeGuid, _dbClient);
        if (null == mirror || mirror.getInactive()) {
          _logger.debug("Skipping Mirror, as its not being managed in Bourne");
          continue;
        }
        updateBlockMirror(volumeViewInstance, mirror, keyMap);
        if (_updateMirrors.size() > BATCH_SIZE) {
          _partitionManager.updateInBatches(
              _updateMirrors, getPartitionSize(keyMap), _dbClient, BLOCK_MIRROR);
          _updateMirrors.clear();
        }
      } else {
        Volume storageVolume = checkStorageVolumeExistsInDB(nativeGuid, _dbClient);
        if (null == storageVolume || storageVolume.getInactive()) {
          continue;
        }
        _logger.debug("Volume managed by Bourne :" + storageVolume.getNativeGuid());
        updateStorageVolume(volumeViewInstance, storageVolume, keyMap);

        // Check if this is a meta volume and if we need to set missing meta volume related
        // properties.
        // This is applicable for meta volumes discovered as unmanaged volumes and ingested prior to
        // vipr controller 2.2 .
        if (storageVolume.getIsComposite()
            && (storageVolume.getCompositionType() == null
                || storageVolume.getCompositionType().isEmpty())) {
          // meta volume is missing meta related data. Need to discover this data and set in the
          // volume.
          metaVolumes.add(volumeViewInstance.getObjectPath());
          _logger.info(
              "Found meta volume in vipr with missing data: {}, name: {}",
              volumeViewInstance.getObjectPath(),
              storageVolume.getLabel());
        }
      }
      if (_updateVolumes.size() > BATCH_SIZE) {
        _partitionManager.updateInBatches(
            _updateVolumes, getPartitionSize(keyMap), _dbClient, VOLUME);
        _updateVolumes.clear();
      }
    }

    // Add meta volumes to the keyMap
    try {
      if (metaVolumes != null && !metaVolumes.isEmpty()) {
        _metaVolumeViewPaths.addAll(metaVolumes);
        _logger.info("Added  {} meta volumes.", metaVolumes.size());
      }
    } catch (Exception ex) {
      _logger.error("Processing meta volumes.", ex);
    }
  }