• neutron bind port networking_baremetal


     _new_bound_segment

    293     def set_binding(self, segment_id, vif_type, vif_details,
    294                     status=None):
    295         # TODO(rkukura) Verify binding allowed, segment in network
    296         self._new_bound_segment = segment_id
    297         self._binding.vif_type = vif_type
    298         self._binding.vif_details = jsonutils.dumps(vif_details)
    299         self._new_port_status = status
    300 
    301     def continue_binding(self, segment_id, next_segments_to_bind):
    302         # TODO(rkukura) Verify binding allowed, segment in network
    303         self._new_bound_segment = segment_id
    304         self._next_segments_to_bind = next_segments_to_bind

    /usr/lib/python2.7/site-packages/networking_baremetal/plugins/ml2

    320     def try_to_bind_segment_for_agent(self, context, segment, agent):
    321         """Try to bind with segment for agent.
    322 
    323         :param context: PortContext instance describing the port
    324         :param segment: segment dictionary describing segment to bind
    325         :param agent: agents_db entry describing agent to bind
    326         :returns: True iff segment has been bound for agent
    327 
    328         Neutron segments api-ref:
    329           https://developer.openstack.org/api-ref/network/v2/#segments
    330 
    331         Example segment dictionary: {'segmentation_id': 'segmentation_id',
    332                                      'network_type': 'network_type',
    333                                      'id': 'segment_uuid'}
    334 
    335         Called outside any transaction during bind_port() so that
    336         derived MechanismDrivers can use agent_db data along with
    337         built-in knowledge of the corresponding agent's capabilities
    338         to attempt to bind to the specified network segment for the
    339         agent.
    340 
    341         If the segment can be bound for the agent, this function must
    342         call context.set_binding() with appropriate values and then
    343         return True. Otherwise, it must return False.
    344         """
    345         if self.check_segment_for_agent(segment, agent):
    346             port = context.current
    347             provisioning_blocks.add_provisioning_component(
    348                 context._plugin_context, port['id'], resources.PORT,
    349                 BAREMETAL_DRV_ENTITY)
    350             context.set_binding(segment[api.ID],
    351                                 self.get_vif_type(context, agent, segment),
    352                                 self.get_vif_details(context, agent, segment))
    353             return True
    354         else:
    355             return False
    def get_allowed_network_types(self, agent):

    check_segment_for_agent

  • 相关阅读:
    Moodle的安装和登陆(使用Https)
    Moodle 3.4中添加小组、大组、群
    【转】moodle中年级、班级、小组研讨
    函数式接口
    java实现数据库连接池
    转载---jboss简单使用
    转载---数据库优化方案
    转载---虚拟机类加载机制
    java中的hashcode
    父子类静态代码块,非静态代码块,有参,无参构造方法等的执行顺序问题
  • 原文地址:https://www.cnblogs.com/dream397/p/13100351.html
Copyright © 2020-2023  润新知