'Choose NFS share among available ones for given volume size.
For instances with more than one share that meets the criteria, the
share with the least "allocated" space will be selected.
:param volume: the volume to be created.'

def _find_share(self, volume):

    if (not self._mounted_shares):
        raise exception.NfsNoSharesMounted()
    target_share = None
    target_share_reserved = 0
    for nfs_share in self._mounted_shares:
        (total_size, total_available, total_allocated) = self._get_capacity_info(nfs_share)
        share_info = {'total_size': total_size, 'total_available': total_available, 'total_allocated': total_allocated}
        if (not self._is_share_eligible(nfs_share, volume.size, share_info)):
            continue
        if (target_share is not None):
            if (target_share_reserved > total_allocated):
                target_share = nfs_share
                target_share_reserved = total_allocated
        else:
            target_share = nfs_share
            target_share_reserved = total_allocated
    if (target_share is None):
        raise exception.NfsNoSuitableShareFound(volume_size=volume.size)
    LOG.debug('Selected    %s    as    target    NFS    share.', target_share)
    return target_share
