コード例 #1
0
ファイル: lb_neutron_plugin.py プロジェクト: kavonm/neutron
 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
コード例 #2
0
 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
コード例 #3
0
ファイル: lb_neutron_plugin.py プロジェクト: kavonm/neutron
 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')
     host = kwargs.get('host')
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         entry = {'device': device,
                  'exists': True}
         if (host and not
             plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(_("Device %(device)s not bound to the"
                         " agent host %(host)s"),
                       {'device': device, 'host': host})
         elif 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
コード例 #4
0
 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')
     host = kwargs.get('host')
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         entry = {'device': device,
                  'exists': True}
         if (host and not
             plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(_("Device %(device)s not bound to the"
                         " agent host %(host)s"),
                       {'device': device, 'host': host})
         elif 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
コード例 #5
0
 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
コード例 #6
0
 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     host = kwargs.get('host')
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s up on %(agent_id)s"), {
         'device': device,
         'agent_id': agent_id
     })
     plugin = manager.NeutronManager.get_plugin()
     if port:
         if (host and
                 not plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(
                 _("Device %(device)s not bound to the"
                   " agent host %(host)s"), {
                       'device': device,
                       'host': host
                   })
             return
         elif port['status'] != q_const.PORT_STATUS_ACTIVE:
             db.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
 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
コード例 #10
0
 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     host = kwargs.get("host")
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s up on %(agent_id)s"), {"device": device, "agent_id": agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         if host and not plugin.get_port_host(rpc_context, port["id"]) == host:
             LOG.debug(
                 _("Device %(device)s not bound to the" " agent host %(host)s"), {"device": device, "host": host}
             )
             return
         elif port["status"] != q_const.PORT_STATUS_ACTIVE:
             db.set_port_status(port["id"], q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
コード例 #11
0
 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
コード例 #12
0
ファイル: lb_neutron_plugin.py プロジェクト: kavonm/neutron
 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     host = kwargs.get('host')
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s up on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         if (host and
             not plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(_("Device %(device)s not bound to the"
                         " agent host %(host)s"),
                       {'device': device, 'host': host})
             return
         elif port['status'] != q_const.PORT_STATUS_ACTIVE:
             db.set_port_status(port['id'],
                                q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
コード例 #13
0
 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")
     host = kwargs.get("host")
     port = self.get_port_from_device(device)
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"), {"device": device, "agent_id": agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         entry = {"device": device, "exists": True}
         if host and not plugin.get_port_host(rpc_context, port["id"]) == host:
             LOG.debug(
                 _("Device %(device)s not bound to the" " agent host %(host)s"), {"device": device, "host": host}
             )
         elif 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