'List volumes on the backend available for management by Cinder.
Rule out volumes that are mapped to an SDC or
are already in the list of cinder_volumes.
Return references of the volume ids for any others.'

def get_manageable_volumes(self, cinder_volumes, marker, limit, offset, sort_keys, sort_dirs):

    all_sio_volumes = self._get_all_scaleio_volumes()
    existing_vols = {}
    for cinder_vol in cinder_volumes:
        provider_id = cinder_vol['provider_id']
        existing_vols[provider_id] = cinder_vol.name_id
    manageable_volumes = []
    for sio_vol in all_sio_volumes:
        cinder_id = existing_vols.get(sio_vol['id'])
        is_safe = True
        reason = None
        if sio_vol['mappedSdcInfo']:
            is_safe = False
            numHosts = len(sio_vol['mappedSdcInfo'])
            reason = (_('Volume    mapped    to    %d    host(s).') % numHosts)
        if cinder_id:
            is_safe = False
            reason = _('Volume    already    managed.')
        if (sio_vol['volumeType'] != 'Snapshot'):
            manageable_volumes.append({'reference': {'source-id': sio_vol['id']}, 'size': self._convert_kb_to_gib(sio_vol['sizeInKb']), 'safe_to_manage': is_safe, 'reason_not_safe': reason, 'cinder_id': cinder_id, 'extra_info': {'volumeType': sio_vol['volumeType'], 'name': sio_vol['name']}})
    return volume_utils.paginate_entries_list(manageable_volumes, marker, limit, offset, sort_keys, sort_dirs)
