• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python l2network_db_v2.set_port_status函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_device_details

 def get_device_details(self, rpc_context, **kwargs):
     """Agent requests device details."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = self.get_port_from_device(device)
     if port:
         binding = db.get_network_binding(db_api.get_session(),
                                          port['network_id'])
         (network_type,
          segmentation_id) = constants.interpret_vlan_id(binding.vlan_id)
         entry = {'device': device,
                  'network_type': network_type,
                  'physical_network': binding.physical_network,
                  'segmentation_id': segmentation_id,
                  'network_id': port['network_id'],
                  'port_id': port['id'],
                  'admin_state_up': port['admin_state_up']}
         if cfg.CONF.AGENT.rpc_support_old_agents:
             entry['vlan_id'] = binding.vlan_id
         new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up']
                       else q_const.PORT_STATUS_DOWN)
         if port['status'] != new_status:
             db.set_port_status(port['id'], new_status)
     else:
         entry = {'device': device}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:citrix-openstack,项目名称:neutron,代码行数:29,代码来源:lb_quantum_plugin.py


示例2: get_device_details

 def get_device_details(self, rpc_context, **kwargs):
     """Agent requests device details"""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
               locals())
     port = self.get_port_from_device(device)
     if port:
         binding = db.get_network_binding(db_api.get_session(),
                                          port['network_id'])
         entry = {'device': device,
                  'physical_network': binding.physical_network,
                  'network_type': binding.network_type,
                  'vlan_id': binding.vlan_id,
                  'network_id': port['network_id'],
                  'port_id': port['id'],
                  'admin_state_up': port['admin_state_up']}
         new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up']
                       else q_const.PORT_STATUS_DOWN)
         if port['status'] != new_status:
             db.set_port_status(port['id'], new_status)
     else:
         entry = {'device': device}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:tpaszkowski,项目名称:quantum,代码行数:25,代码来源:lb_quantum_plugin.py


示例3: update_device_up

 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent"""
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug(_("Device %(device)s up %(agent_id)s"), locals())
     port = self.get_port_from_device(device)
     if port:
         if port["status"] != q_const.PORT_STATUS_ACTIVE:
             # Set port status to ACTIVE
             db.set_port_status(port["id"], q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
开发者ID:lucian,项目名称:quantum,代码行数:12,代码来源:lb_quantum_plugin.py


示例4: update_device_up

 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s up %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = self.get_port_from_device(device)
     if port:
         if port['status'] != q_const.PORT_STATUS_ACTIVE:
             # Set port status to ACTIVE
             db.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
开发者ID:CiscoAS,项目名称:quantum,代码行数:13,代码来源:lb_quantum_plugin.py


示例5: update_device_down

 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent"""
     # (TODO) garyk - live migration and port status
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"), locals())
     port = self.get_port_from_device(device)
     if port:
         entry = {"device": device, "exists": True}
         # Set port status to DOWN
         db.set_port_status(port["id"], q_const.PORT_STATUS_DOWN)
     else:
         entry = {"device": device, "exists": False}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:wph540,项目名称:quantum,代码行数:15,代码来源:lb_quantum_plugin.py


示例6: update_device_down

 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent"""
     # (TODO) garyk - live migration and port status
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug("Device %s no longer exists on %s", device, agent_id)
     port = db.get_port_from_device(device[self.TAP_PREFIX_LEN:])
     if port:
         entry = {'device': device,
                  'exists': True}
         # Set port status to DOWN
         db.set_port_status(port['id'], q_const.PORT_STATUS_DOWN)
     else:
         entry = {'device': device,
                  'exists': False}
         LOG.debug("%s can not be found in database", device)
     return entry
开发者ID:apech,项目名称:quantum,代码行数:17,代码来源:lb_quantum_plugin.py


示例7: update_device_down

 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent."""
     # TODO(garyk) - live migration and port status
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = self.get_port_from_device(device)
     if port:
         entry = {'device': device,
                  'exists': True}
         if port['status'] != q_const.PORT_STATUS_DOWN:
             # Set port status to DOWN
             db.set_port_status(port['id'], q_const.PORT_STATUS_DOWN)
     else:
         entry = {'device': device,
                  'exists': False}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:CiscoAS,项目名称:quantum,代码行数:19,代码来源:lb_quantum_plugin.py


示例8: get_device_details

 def get_device_details(self, rpc_context, **kwargs):
     """Agent requests device details"""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug("Device %s details requested from %s", device, agent_id)
     port = db.get_port_from_device(device[self.TAP_PREFIX_LEN:])
     if port:
         binding = db.get_network_binding(db_api.get_session(),
                                          port['network_id'])
         entry = {'device': device,
                  'physical_network': binding.physical_network,
                  'vlan_id': binding.vlan_id,
                  'network_id': port['network_id'],
                  'port_id': port['id'],
                  'admin_state_up': port['admin_state_up']}
         # Set the port status to UP
         db.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE)
     else:
         entry = {'device': device}
         LOG.debug("%s can not be found in database", device)
     return entry
开发者ID:apech,项目名称:quantum,代码行数:21,代码来源:lb_quantum_plugin.py


示例9: get_device_details

 def get_device_details(self, rpc_context, **kwargs):
     """Agent requests device details"""
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug(_("Device %(device)s details requested from %(agent_id)s"), locals())
     port = self.get_port_from_device(device)
     if port:
         binding = db.get_network_binding(db_api.get_session(), port["network_id"])
         entry = {
             "device": device,
             "physical_network": binding.physical_network,
             "vlan_id": binding.vlan_id,
             "network_id": port["network_id"],
             "port_id": port["id"],
             "admin_state_up": port["admin_state_up"],
         }
         # Set the port status to UP
         db.set_port_status(port["id"], q_const.PORT_STATUS_ACTIVE)
     else:
         entry = {"device": device}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:wph540,项目名称:quantum,代码行数:22,代码来源:lb_quantum_plugin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python meta_db_v2.get_flavor_by_network函数代码示例发布时间:2022-05-26
下一篇:
Python l2network_db_v2.get_network_binding函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap