← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1259088] Re: setup_rpc should be the last thing in __init__ method

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

** Changed in: neutron
    Milestone: None => icehouse-2

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1259088

Title:
  setup_rpc should be the last thing in __init__ method

Status in OpenStack Neutron (virtual network service):
  Fix Released

Bug description:
  if setup_rpc is too early, the dispatch maybe dispatch the rpc message to an unready agent.  take ovs plugin agent for instance,
  after setup_rpc is called, many of the initialization work are still needed to be done. If the message is coming during this time, the instance will  not be fully initialized:

      def __init__(self, integ_br, tun_br, local_ip,
                   bridge_mappings, root_helper,
                   polling_interval, tunnel_types=None,
                   veth_mtu=None, l2_population=False,
                   minimize_polling=False,
                   ovsdb_monitor_respawn_interval=(
                       constants.DEFAULT_OVSDBMON_RESPAWN)):
          '''Constructor.

          :param integ_br: name of the integration bridge.
          :param tun_br: name of the tunnel bridge.
          :param local_ip: local IP address of this hypervisor.
          :param bridge_mappings: mappings from physical network name to bridge.
          :param root_helper: utility to use when running shell cmds.
          :param polling_interval: interval (secs) to poll DB.
          :param tunnel_types: A list of tunnel types to enable support for in
                 the agent. If set, will automatically set enable_tunneling to
                 True.
          :param veth_mtu: MTU size for veth interfaces.
          :param minimize_polling: Optional, whether to minimize polling by
                 monitoring ovsdb for interface changes.
          :param ovsdb_monitor_respawn_interval: Optional, when using polling
                 minimization, the number of seconds to wait before respawning
                 the ovsdb monitor.
          '''
          self.veth_mtu = veth_mtu
          self.root_helper = root_helper
          self.available_local_vlans = set(xrange(q_const.MIN_VLAN_TAG,
                                                  q_const.MAX_VLAN_TAG))
          self.tunnel_types = tunnel_types or []
          self.l2_pop = l2_population
          self.agent_state = {
              'binary': 'neutron-openvswitch-agent',
              'host': cfg.CONF.host,
              'topic': q_const.L2_AGENT_TOPIC,
              'configurations': {'bridge_mappings': bridge_mappings,
                                 'tunnel_types': self.tunnel_types,
                                 'tunneling_ip': local_ip,
                                 'l2_population': self.l2_pop},
              'agent_type': q_const.AGENT_TYPE_OVS,
              'start_flag': True}

          # Keep track of int_br's device count for use by _report_state()
          self.int_br_device_count = 0

          self.int_br = ovs_lib.OVSBridge(integ_br, self.root_helper)
          self.setup_rpc()
          self.setup_integration_br()
          self.setup_physical_bridges(bridge_mappings)
          self.local_vlan_map = {}
          self.tun_br_ofports = {constants.TYPE_GRE: {},
                                 constants.TYPE_VXLAN: {}}

          self.polling_interval = polling_interval
          self.minimize_polling = minimize_polling
          self.ovsdb_monitor_respawn_interval = ovsdb_monitor_respawn_interval

          if tunnel_types:
              self.enable_tunneling = True
          else:
              self.enable_tunneling = False
          self.local_ip = local_ip
          self.tunnel_count = 0
          self.vxlan_udp_port = cfg.CONF.AGENT.vxlan_udp_port
          self._check_ovs_version()
          if self.enable_tunneling:
              self.setup_tunnel_br(tun_br)
          # Collect additional bridges to monitor
          self.ancillary_brs = self.setup_ancillary_bridges(integ_br, tun_br)

          # Security group agent supprot
          self.sg_agent = OVSSecurityGroupAgent(self.context,
                                                self.plugin_rpc,
                                                root_helper)
          # Initialize iteration counter
          self.iter_num = 0

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1259088/+subscriptions


References