node.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
def get_bmc_accessible_nodes(self):
        """Return `QuerySet` of nodes that this rack controller can access.

        This looks at the IP address assigned to all BMC's and filters out
        only the BMC's this rack controller can access. Returning all nodes
        connected to those BMCs.
        """
        subnet_ids = set()
        for interface in self.interface_set.all().prefetch_related(
                "ip_addresses"):
            for ip_address in interface.ip_addresses.all():
                if ip_address.ip and ip_address.subnet_id is not None:
                    subnet_ids.add(ip_address.subnet_id)

        nodes = Node.objects.filter(
            bmc__ip_address__ip__isnull=False,
            bmc__ip_address__subnet_id__in=subnet_ids).distinct()
        return nodes
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号