components/openstack/neutron/patches/02-l3-agent-add-solaris.patch
changeset 6848 8e252a37ed0d
parent 6678 6e93d2f59ffb
equal deleted inserted replaced
6847:57069587975f 6848:8e252a37ed0d
     1 Changes to the Neutron L3 agent to port it to Solaris. These changes
     1 Changes to the Neutron L3 agent to port it to Solaris. These changes
     2 will eventually be proposed upstream.
     2 will eventually be proposed upstream.
     3 
     3 
     4 --- neutron-2015.1.2/neutron/agent/linux/daemon.py.~1~	2015-10-13 10:35:16.000000000 -0700
     4 --- neutron-8.1.2/neutron/agent/l3/config.py	2016-06-09 18:45:29.000000000 -0700
     5 +++ neutron-2015.1.2/neutron/agent/linux/daemon.py	2016-01-28 23:07:42.234372590 -0800
     5 +++ new/neutron/agent/l3/config.py	2016-08-01 16:27:05.166039913 -0700
     6 @@ -18,12 +18,14 @@ import grp
     6 @@ -46,7 +46,6 @@
       
     7                 help=_("Send this many gratuitous ARPs for HA setup, if "
       
     8                        "less than or equal to 0, the feature is disabled")),
       
     9      cfg.StrOpt('router_id', default='',
       
    10 -               deprecated_for_removal=True,
       
    11                 help=_("If non-empty, the l3 agent can only configure a router "
       
    12                        "that has the matching router ID.")),
       
    13      cfg.BoolOpt('handle_internal_only_routers',
       
    14 --- neutron-8.1.2/neutron/agent/linux/daemon.py.~1~	2016-06-09 18:45:29.000000000 -0700
       
    15 +++ neutron-8.1.2/neutron/agent/linux/daemon.py	2016-07-04 16:19:23.339906615 -0700
       
    16 @@ -18,6 +18,7 @@ import grp
     7  import logging as std_logging
    17  import logging as std_logging
     8  from logging import handlers
    18  from logging import handlers
     9  import os
    19  import os
    10 +import platform
    20 +import platform
    11  import pwd
    21  import pwd
    12  import signal
    22  import signal
    13  import sys
    23  import sys
       
    24 @@ -26,6 +27,7 @@ from oslo_log import log as logging
    14  
    25  
    15  from oslo_log import log as logging
    26  from neutron._i18n import _, _LE, _LI
       
    27  from neutron.common import exceptions
       
    28 +from neutron.agent.linux import utils
    16  
    29  
    17 +from neutron.agent.linux import utils
    30  LOG = logging.getLogger(__name__)
    18  from neutron.common import exceptions
       
    19  from neutron.i18n import _LE, _LI
       
    20  
    31  
    21 @@ -140,6 +142,15 @@ class Pidfile(object):
    32 @@ -152,6 +154,15 @@ class Pidfile(object):
    22          if not pid:
    33          if not pid:
    23              return False
    34              return False
    24  
    35  
    25 +        if platform.system() == "SunOS":
    36 +        if platform.system() == "SunOS":
    26 +            cmd = ['/usr/bin/pargs', '-l', pid]
    37 +            cmd = ['/usr/bin/pargs', '-l', pid]
    32 +                                                  self.uuid in exec_out)
    43 +                                                  self.uuid in exec_out)
    33 +
    44 +
    34          cmdline = '/proc/%s/cmdline' % pid
    45          cmdline = '/proc/%s/cmdline' % pid
    35          try:
    46          try:
    36              with open(cmdline, "r") as f:
    47              with open(cmdline, "r") as f:
    37 --- neutron-2015.1.2/neutron/common/ipv6_utils.py.~1~	2015-10-13 10:35:16.000000000 -0700
    48 --- neutron-8.1.2/neutron/common/ipv6_utils.py.~1~	2016-06-09 18:45:36.000000000 -0700
    38 +++ neutron-2015.1.2/neutron/common/ipv6_utils.py	2016-01-28 23:28:34.771113032 -0800
    49 +++ neutron-8.1.2/neutron/common/ipv6_utils.py	2016-07-04 16:19:23.340616655 -0700
    39 @@ -17,6 +17,7 @@
    50 @@ -17,6 +17,7 @@
    40  IPv6-related utilities and helper functions.
    51  IPv6-related utilities and helper functions.
    41  """
    52  """
    42  import os
    53  import os
    43 +import platform
    54 +import platform
    54 +        return _IS_IPV6_ENABLED
    65 +        return _IS_IPV6_ENABLED
    55 +
    66 +
    56      if _IS_IPV6_ENABLED is None:
    67      if _IS_IPV6_ENABLED is None:
    57          disabled_ipv6_path = "/proc/sys/net/ipv6/conf/default/disable_ipv6"
    68          disabled_ipv6_path = "/proc/sys/net/ipv6/conf/default/disable_ipv6"
    58          if os.path.exists(disabled_ipv6_path):
    69          if os.path.exists(disabled_ipv6_path):
    59 *** neutron-2015.1.2/neutron/agent/l3_agent.py	2015-10-13 10:35:16.000000000 -0700
    70 --- neutron-8.1.2/neutron/agent/l3/agent.py.~1~	2016-08-30 13:29:12.113143750 -0700
    60 --- new/neutron/agent/l3_agent.py	2016-05-14 07:44:53.695396597 -0700
    71 +++ neutron-8.1.2/neutron/agent/l3/agent.py	2016-08-30 13:20:22.455764906 -0700
    61 ***************
    72 @@ -13,6 +13,9 @@
    62 *** 14,19 ****
    73  #    under the License.
    63 --- 14,20 ----
    74  #
    64   #    License for the specific language governing permissions and limitations
    75  
    65   #    under the License.
    76 +import os
    66   
    77 +import platform
    67 + import platform
    78 +
    68   import sys
    79  import eventlet
    69   
    80  import netaddr
    70   from oslo_config import cfg
    81  from oslo_config import cfg
    71 ***************
    82 @@ -32,12 +35,18 @@
    72 *** 24,29 ****
    83  from neutron.agent.l3 import ha
    73 --- 25,31 ----
    84  from neutron.agent.l3 import ha_router
    74   from neutron.agent.linux import external_process
    85  from neutron.agent.l3 import legacy_router
    75   from neutron.agent.linux import interface
    86 -from neutron.agent.l3 import namespace_manager
    76   from neutron.agent.metadata import config as metadata_config
    87 +if platform.system() == "SunOS":
    77 + from neutron.agent.solaris import interface as solaris_interface
    88 +    from neutron.agent.solaris import namespace_manager
    78   from neutron.common import config as common_config
    89 +else:
    79   from neutron.common import topics
    90 +    from neutron.agent.l3 import namespace_manager
    80   from neutron.openstack.common import service
    91  from neutron.agent.l3 import namespaces
    81 ***************
    92  from neutron.agent.l3 import router_processing_queue as queue
    82 *** 39,44 ****
    93  from neutron.agent.linux import external_process
    83 --- 41,47 ----
    94  from neutron.agent.linux import ip_lib
    84       config.register_use_namespaces_opts_helper(conf)
    95 -from neutron.agent.linux import pd
    85       config.register_agent_state_opts_helper(conf)
    96 +if platform.system() == "SunOS":
    86       conf.register_opts(interface.OPTS)
    97 +    from neutron.agent.solaris import pd
    87 +     conf.register_opts(solaris_interface.OPTS)
    98 +else:
    88       conf.register_opts(external_process.OPTS)
    99 +    from neutron.agent.linux import pd
    89   
   100  from neutron.agent.metadata import driver as metadata_driver
    90   
   101  from neutron.agent import rpc as agent_rpc
    91 ***************
   102  from neutron.callbacks import events
    92 *** 46,51 ****
   103 @@ -268,6 +277,11 @@
    93 --- 49,56 ----
   104                              "default value is 'br-ex' so it must be "
    94       register_opts(cfg.CONF)
   105                              "explicitly set to a blank value."))
    95       common_config.init(sys.argv[1:])
   106  
    96       config.setup_logging()
   107 +        if not self.conf.router_id:
    97 +     if platform.system() == "SunOS":
   108 +            msg = _LE('Router id is required if not using namespaces.')
    98 +         manager = 'neutron.agent.l3.solaris_agent.L3NATAgent'
   109 +            LOG.error(msg)
    99       server = neutron_service.Service.create(
   110 +            raise SystemExit(1)
   100           binary='neutron-l3-agent',
   111 +
   101           topic=topics.L3_AGENT,
   112          if self.conf.ipv6_gateway:
   102 --- neutron-2015.1.2/neutron/agent/l3/agent.py.~1~	2015-10-13 10:35:16.000000000 -0700
   113              # ipv6_gateway configured. Check for valid v6 link-local address.
   103 +++ neutron-2015.1.2/neutron/agent/l3/agent.py	2016-08-19 20:29:49.000000000 -0700
   114              try:
   104 @@ -523,6 +523,12 @@
   115 @@ -559,6 +573,12 @@
   105              else:
   116              for i in range(0, len(router_ids), self.sync_routers_chunk_size):
   106                  routers = self.plugin_rpc.get_routers(context,
   117                  routers = self.plugin_rpc.get_routers(
   107                                                        [self.conf.router_id])
   118                      context, router_ids[i:i + self.sync_routers_chunk_size])
   108 +                if not routers:
   119 +                if not routers:
   109 +                    LOG.error(_LE('Server failed to return info for router '
   120 +                    LOG.error(_LE('Server failed to return info for router '
   110 +                                  'with id: %s. Make sure the correct '
   121 +                                  'with id %s. Make sure the correct router_id'
   111 +                                  'router_id is specified in l3_agent.ini'),
   122 +                                  ' is specified in l3_agent.ini'),
   112 +                              self.conf.router_id)
   123 +                              self.conf.router_id)
   113 +                    raise SystemExit(1)
   124 +                    os._exit(1)
       
   125                  LOG.debug('Processing :%r', routers)
       
   126                  for r in routers:
       
   127                      curr_router_ids.add(r['id'])
       
   128 --- neutron-8.1.2/neutron/agent/l3_agent.py.~1~	2016-06-09 18:45:29.000000000 -0700
       
   129 +++ neutron-8.1.2/neutron/agent/l3_agent.py	2016-07-04 16:19:23.341146110 -0700
       
   130 @@ -14,6 +14,7 @@
       
   131  #    License for the specific language governing permissions and limitations
       
   132  #    under the License.
   114  
   133  
   115          except oslo_messaging.MessagingException:
   134 +import platform
   116              LOG.exception(_LE("Failed synchronizing routers due to RPC error"))
   135  import sys
       
   136  
       
   137  from oslo_config import cfg
       
   138 @@ -27,6 +28,7 @@ from neutron.agent.linux import interfac
       
   139  from neutron.agent.linux import pd
       
   140  from neutron.agent.linux import ra
       
   141  from neutron.agent.metadata import config as metadata_config
       
   142 +from neutron.agent.solaris import interface as solaris_interface
       
   143  from neutron.common import config as common_config
       
   144  from neutron.common import topics
       
   145  from neutron import service as neutron_service
       
   146 @@ -40,6 +42,7 @@ def register_opts(conf):
       
   147      config.register_interface_driver_opts_helper(conf)
       
   148      config.register_agent_state_opts_helper(conf)
       
   149      conf.register_opts(interface.OPTS)
       
   150 +    conf.register_opts(solaris_interface.OPTS)
       
   151      conf.register_opts(external_process.OPTS)
       
   152      conf.register_opts(pd.OPTS)
       
   153      conf.register_opts(ra.OPTS)
       
   154 @@ -50,6 +53,8 @@ def main(manager='neutron.agent.l3.agent
       
   155      register_opts(cfg.CONF)
       
   156      common_config.init(sys.argv[1:])
       
   157      config.setup_logging()
       
   158 +    if platform.system() == "SunOS":
       
   159 +        manager = 'neutron.agent.l3.solaris_agent.L3NATAgent'
       
   160      server = neutron_service.Service.create(
       
   161          binary='neutron-l3-agent',
       
   162          topic=topics.L3_AGENT,