def filter_datastores_by_hubs(hubs, datastores):
    """Get filtered subset of datastores corresponding to the given hub list.

    :param hubs: list of PbmPlacementHub morefs
    :param datastores: all candidate datastores
    :returns: subset of datastores corresponding to the given hub list
    """
    filtered_dss = []
    hub_ids = [hub.hubId for hub in hubs]
    for ds in datastores:
        if ds.value in hub_ids:
            filtered_dss.append(ds)
    return filtered_dss
dataset/ETHPy150Open openstack/oslo.vmware/oslo_vmware/pbm.py/filter_datastores_by_hubs/original