Map<VolumeInfo,VPlexStorageVolumeInfo> findStorageVolumes(List<VolumeInfo> nativeVolumeInfoList,boolean discoveryRequired,List<VPlexClusterInfo> clusterInfoList) throws VPlexApiException {
  Map<VolumeInfo,VPlexStorageVolumeInfo> storageVolumeInfoMap=null;
  VPlexApiDiscoveryManager discoveryMgr=_vplexApiClient.getDiscoveryManager();
  if (discoveryRequired) {
    s_logger.info("Storage volume discovery is required.");
    int retryCount=0;
    while (++retryCount <= VPlexApiConstants.FIND_STORAGE_VOLUME_RETRY_COUNT) {
      try {
        s_logger.info("Executing storage volume discovery try {} of {}",retryCount,VPlexApiConstants.FIND_STORAGE_VOLUME_RETRY_COUNT);
        List<String> storageSystemGuids=new ArrayList<String>();
        for (        VolumeInfo nativeVolumeInfo : nativeVolumeInfoList) {
          String storageSystemGuid=nativeVolumeInfo.getStorageSystemNativeGuid();
          if (!storageSystemGuids.contains(storageSystemGuid)) {
            s_logger.info("Discover storage volumes on array {}",storageSystemGuid);
            storageSystemGuids.add(storageSystemGuid);
          }
        }
        discoveryMgr.rediscoverStorageSystems(storageSystemGuids);
        s_logger.info("Discovery completed");
        clusterInfoList.addAll(discoveryMgr.getClusterInfo(false,true));
        s_logger.info("Retrieved storage volume info for VPlex clusters");
        storageVolumeInfoMap=discoveryMgr.findStorageVolumes(nativeVolumeInfoList,clusterInfoList);
        s_logger.info("Found storage volumes to use for virtual volume");
        break;
      }
 catch (      VPlexApiException vae) {
        if (retryCount == VPlexApiConstants.FIND_STORAGE_VOLUME_RETRY_COUNT) {
          throw vae;
        }
        clusterInfoList.clear();
        VPlexApiUtils.pauseThread(VPlexApiConstants.FIND_STORAGE_VOLUME_SLEEP_TIME_MS);
      }
    }
  }
 else {
    s_logger.info("Storage volume discovery is not required.");
    if (clusterInfoList.isEmpty()) {
      clusterInfoList.addAll(discoveryMgr.getClusterInfo(false,true));
      s_logger.info("Retrieved storage volume info for VPlex clusters");
    }
    storageVolumeInfoMap=discoveryMgr.findStorageVolumes(nativeVolumeInfoList,clusterInfoList);
    s_logger.info("Found storage volumes");
  }
  return storageVolumeInfoMap;
}

Map < VolumeInfo , VPlexStorageVolumeInfo > findStorageVolumes ( List < VolumeInfo > nativeVolumeInfoList , boolean discoveryRequired , List < VPlexClusterInfo > clusterInfoList ) throws VPlexApiException { Map < VolumeInfo , VPlexStorageVolumeInfo > storageVolumeInfoMap = null ; VPlexApiDiscoveryManager discoveryMgr = _vplexApiClient . getDiscoveryManager ( ) ; if ( discoveryRequired ) { s_logger . info ( "Storage volume discovery is required." ) ; int retryCount = 0 ; while ( ++ retryCount <= VPlexApiConstants . FIND_STORAGE_VOLUME_RETRY_COUNT ) { try { s_logger . info ( "Executing storage volume discovery try {} of {}" , retryCount , VPlexApiConstants . FIND_STORAGE_VOLUME_RETRY_COUNT ) ; List < String > storageSystemGuids = new ArrayList < String > ( ) ; for ( VolumeInfo nativeVolumeInfo : nativeVolumeInfoList ) { String storageSystemGuid = nativeVolumeInfo . getStorageSystemNativeGuid ( ) ; if ( ! storageSystemGuids . contains ( storageSystemGuid ) ) { s_logger . info ( "Discover storage volumes on array {}" , storageSystemGuid ) ; storageSystemGuids . add ( storageSystemGuid ) ; } } discoveryMgr . rediscoverStorageSystems ( storageSystemGuids ) ; s_logger . info ( "Discovery completed" ) ; clusterInfoList . addAll ( discoveryMgr . getClusterInfo ( false , true ) ) ; s_logger . info ( "Retrieved storage volume info for VPlex clusters" ) ; storageVolumeInfoMap = discoveryMgr . findStorageVolumes ( nativeVolumeInfoList , clusterInfoList ) ; s_logger . info ( "Found storage volumes to use for virtual volume" ) ; break ; } catch ( VPlexApiException vae ) { if ( retryCount == VPlexApiConstants . FIND_STORAGE_VOLUME_RETRY_COUNT ) { throw vae ; } clusterInfoList . clear ( ) ; VPlexApiUtils . pauseThread ( VPlexApiConstants . FIND_STORAGE_VOLUME_SLEEP_TIME_MS ) ; } } } else { s_logger . info ( "Storage volume discovery is not required." ) ; if ( clusterInfoList . isEmpty ( ) ) { clusterInfoList . addAll ( discoveryMgr . getClusterInfo ( false , true ) ) ; s_logger . info ( "Retrieved storage volume info for VPlex clusters" ) ; } storageVolumeInfoMap = discoveryMgr . findStorageVolumes ( nativeVolumeInfoList , clusterInfoList ) ; s_logger . info ( "Found storage volumes" ) ; } return storageVolumeInfoMap ; }
find the storage volumes identified by the passed native volume info , discovering the storage volumes if required .
