当前位置: 首页>>代码示例>>Python>>正文


Python porttracker_db.get_port_hostid函数代码示例

本文整理汇总了Python中neutron.plugins.bigswitch.db.porttracker_db.get_port_hostid函数的典型用法代码示例。如果您正苦于以下问题:Python get_port_hostid函数的具体用法?Python get_port_hostid怎么用?Python get_port_hostid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_port_hostid函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _extend_port_dict_binding

    def _extend_port_dict_binding(self, context, port):
        cfg_vif_type = cfg.CONF.NOVA.vif_type.lower()
        if not cfg_vif_type in (portbindings.VIF_TYPE_OVS,
                                portbindings.VIF_TYPE_IVS):
            LOG.warning(_("Unrecognized vif_type in configuration "
                          "[%s]. Defaulting to ovs."),
                        cfg_vif_type)
            cfg_vif_type = portbindings.VIF_TYPE_OVS
        # In ML2, the host_id is already populated
        if portbindings.HOST_ID in port:
            hostid = port[portbindings.HOST_ID]
        else:
            hostid = porttracker_db.get_port_hostid(context, port['id'])
        if hostid:
            port[portbindings.HOST_ID] = hostid
            override = self._check_hostvif_override(hostid)
            if override:
                cfg_vif_type = override
        port[portbindings.VIF_TYPE] = cfg_vif_type

        port[portbindings.VIF_DETAILS] = {
            # TODO(rkukura): Replace with new VIF security details
            portbindings.CAP_PORT_FILTER:
            'security-group' in self.supported_extension_aliases,
            portbindings.OVS_HYBRID_PLUG: True
        }
        return port
开发者ID:COSHPC,项目名称:neutron,代码行数:27,代码来源:plugin.py

示例2: _extend_port_dict_binding

    def _extend_port_dict_binding(self, context, port):
        cfg_vif_type = cfg.CONF.NOVA.vif_type.lower()
        if not cfg_vif_type in (portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_IVS):
            LOG.warning(_("Unrecognized vif_type in configuration " "[%s]. Defaulting to ovs. "), cfg_vif_type)
            cfg_vif_type = portbindings.VIF_TYPE_OVS
        hostid = porttracker_db.get_port_hostid(context, port.get("device_id"))
        if hostid:
            override = self._check_hostvif_override(hostid)
            if override:
                cfg_vif_type = override
        port[portbindings.VIF_TYPE] = cfg_vif_type

        port[portbindings.CAPABILITIES] = {
            portbindings.CAP_PORT_FILTER: "security-group" in self.supported_extension_aliases
        }
        return port
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:16,代码来源:plugin.py


注:本文中的neutron.plugins.bigswitch.db.porttracker_db.get_port_hostid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。