private void detachVolumesFromInitiators(StorageSystem storage,List<Volume> volumes,List<Initiator> initiators) throws Exception {
  CinderEndPointInfo ep=CinderUtils.getCinderEndPoint(storage.getActiveProviderURI(),dbClient);
  log.debug("Getting the cinder APi for the provider with id {}",storage.getActiveProviderURI());
  CinderApi cinderApi=cinderApiFactory.getApi(storage.getActiveProviderURI(),ep);
  List<Initiator> iSCSIInitiators=new ArrayList<Initiator>();
  List<Initiator> fcInitiators=new ArrayList<Initiator>();
  splitInitiatorsByProtocol(initiators,iSCSIInitiators,fcInitiators);
  String host=getHostNameFromInitiators(initiators);
  Map<String,String[]> mapSettingVsValues=getFCInitiatorsArray(fcInitiators);
  String[] fcInitiatorsWwpns=mapSettingVsValues.get(WWPNS);
  String[] fcInitiatorsWwnns=mapSettingVsValues.get(WWNNS);
  for (  Volume volume : volumes) {
    String volumeId=volume.getNativeId();
    for (    Initiator initiator : iSCSIInitiators) {
      String initiatorPort=initiator.getInitiatorPort();
      log.debug(String.format("Detaching volume %s ( %s ) from initiator %s on Openstack cinder node",volumeId,volume.getId(),initiatorPort));
      cinderApi.detachVolume(volumeId,initiatorPort,null,null,host);
    }
    if (fcInitiatorsWwpns.length > 0) {
      log.debug(String.format("Detaching volume %s ( %s ) from initiator %s on Openstack cinder node",volumeId,volume.getId(),fcInitiatorsWwpns));
      cinderApi.detachVolume(volumeId,null,fcInitiatorsWwpns,fcInitiatorsWwnns,host);
    }
    removeITLsFromVolume(volume);
  }
}

private void detachVolumesFromInitiators ( StorageSystem storage , List < Volume > volumes , List < Initiator > initiators ) throws Exception { CinderEndPointInfo ep = CinderUtils . getCinderEndPoint ( storage . getActiveProviderURI ( ) , dbClient ) ; log . debug ( "Getting the cinder APi for the provider with id {}" , storage . getActiveProviderURI ( ) ) ; CinderApi cinderApi = cinderApiFactory . getApi ( storage . getActiveProviderURI ( ) , ep ) ; List < Initiator > iSCSIInitiators = new ArrayList < Initiator > ( ) ; List < Initiator > fcInitiators = new ArrayList < Initiator > ( ) ; splitInitiatorsByProtocol ( initiators , iSCSIInitiators , fcInitiators ) ; String host = getHostNameFromInitiators ( initiators ) ; Map < String , String [ ] > mapSettingVsValues = getFCInitiatorsArray ( fcInitiators ) ; String [ ] fcInitiatorsWwpns = mapSettingVsValues . get ( WWPNS ) ; String [ ] fcInitiatorsWwnns = mapSettingVsValues . get ( WWNNS ) ; for ( Volume volume : volumes ) { String volumeId = volume . getNativeId ( ) ; for ( Initiator initiator : iSCSIInitiators ) { String initiatorPort = initiator . getInitiatorPort ( ) ; log . debug ( String . format ( "Detaching volume %s ( %s ) from initiator %s on Openstack cinder node" , volumeId , volume . getId ( ) , initiatorPort ) ) ; cinderApi . detachVolume ( volumeId , initiatorPort , null , null , host ) ; } if ( fcInitiatorsWwpns . length > 0 ) { log . debug ( String . format ( "Detaching volume %s ( %s ) from initiator %s on Openstack cinder node" , volumeId , volume . getId ( ) , fcInitiatorsWwpns ) ) ; cinderApi . detachVolume ( volumeId , null , fcInitiatorsWwpns , fcInitiatorsWwnns , host ) ; } removeITLsFromVolume ( volume ) ; } }
detaches volumes from initiators .
