question: private boolean maskHasInitiatorsBasedOnExportType ( ExportGroup exportGroup , ExportMask mask , Set < URI > otherMaskURIs , List < String > portsForComputeResource , Set < URI > partialMasks ) { Set < String > foundPorts = new HashSet < > ( ) ; if ( exportGroup . forHost ( ) || exportGroup . forCluster ( ) ) { if ( ExportMaskUtils . hasExactlyTheseInitiators ( mask , portsForComputeResource , _dbClient ) ) { return true ; } if ( mask . hasAnyInitiators ( ) && ExportMaskUtils . hasExactlySubsetOfTheseInitiators ( mask , portsForComputeResource , _dbClient ) ) { if ( exportGroup . forCluster ( ) && maskAppliesToMultipleHosts ( mask ) ) { return true ; } else if ( exportGroup . forHost ( ) ) { return ! maskAppliesToMultipleHosts ( mask ) ; } foundPorts . addAll ( ExportUtils . getExportMaskAllInitiatorPorts ( mask , _dbClient ) ) ; partialMasks . add ( mask . getId ( ) ) ; } else { return false ; } List < ExportMask > otherMasks = _dbClient . queryObject ( ExportMask . class , otherMaskURIs ) ; for ( ExportMask otherMask : otherMasks ) { if ( ! exportGroup . forCluster ( ) || ! maskAppliesToMultipleHosts ( otherMask ) ) { if ( otherMask . hasAnyInitiators ( ) && ExportMaskUtils . hasExactlySubsetOfTheseInitiators ( otherMask , portsForComputeResource , _dbClient ) ) { partialMasks . add ( otherMask . getId ( ) ) ; foundPorts . addAll ( ExportUtils . getExportMaskAllInitiatorPorts ( otherMask , _dbClient ) ) ; } } } if ( foundPorts . size ( ) == portsForComputeResource . size ( ) ) { return true ; } } partialMasks . clear ( ) ; return false ; }
target:  If the ExportGroup.Type is Host or Cluster, we need to check if the ExportMask has all the compute resource's initiators. If it does, it's a match. If the ExportGroup.Type is Initiator, then we just need to verify that the initiator is in it for it be considered a match.