Changes to the Neutron L3 agent to port it to Solaris. These changes
will eventually be proposed upstream.
--- neutron-8.1.2/neutron/agent/l3/config.py 2016-06-09 18:45:29.000000000 -0700
+++ new/neutron/agent/l3/config.py 2016-08-01 16:27:05.166039913 -0700
@@ -46,7 +46,6 @@
help=_("Send this many gratuitous ARPs for HA setup, if "
"less than or equal to 0, the feature is disabled")),
cfg.StrOpt('router_id', default='',
- deprecated_for_removal=True,
help=_("If non-empty, the l3 agent can only configure a router "
"that has the matching router ID.")),
cfg.BoolOpt('handle_internal_only_routers',
--- neutron-8.1.2/neutron/agent/linux/daemon.py.~1~ 2016-06-09 18:45:29.000000000 -0700
+++ neutron-8.1.2/neutron/agent/linux/daemon.py 2016-07-04 16:19:23.339906615 -0700
@@ -18,6 +18,7 @@ import grp
import logging as std_logging
from logging import handlers
import os
+import platform
import pwd
import signal
import sys
@@ -26,6 +27,7 @@ from oslo_log import log as logging
from neutron._i18n import _, _LE, _LI
from neutron.common import exceptions
+from neutron.agent.linux import utils
LOG = logging.getLogger(__name__)
@@ -152,6 +154,15 @@ class Pidfile(object):
if not pid:
return False
+ if platform.system() == "SunOS":
+ cmd = ['/usr/bin/pargs', '-l', pid]
+ try:
+ exec_out = utils.execute(cmd)
+ except RuntimeError:
+ return False
+ return self.procname in exec_out and (not self.uuid or
+ self.uuid in exec_out)
+
cmdline = '/proc/%s/cmdline' % pid
try:
with open(cmdline, "r") as f:
--- neutron-8.1.2/neutron/common/ipv6_utils.py.~1~ 2016-06-09 18:45:36.000000000 -0700
+++ neutron-8.1.2/neutron/common/ipv6_utils.py 2016-07-04 16:19:23.340616655 -0700
@@ -17,6 +17,7 @@
IPv6-related utilities and helper functions.
"""
import os
+import platform
import netaddr
from oslo_log import log
@@ -51,6 +52,11 @@ def get_ipv6_addr_by_EUI64(prefix, mac):
def is_enabled():
global _IS_IPV6_ENABLED
+ if platform.system() == "SunOS":
+ if _IS_IPV6_ENABLED is None:
+ _IS_IPV6_ENABLED = True
+ return _IS_IPV6_ENABLED
+
if _IS_IPV6_ENABLED is None:
disabled_ipv6_path = "/proc/sys/net/ipv6/conf/default/disable_ipv6"
if os.path.exists(disabled_ipv6_path):
--- neutron-8.1.2/neutron/agent/l3/agent.py.~1~ 2016-08-30 13:29:12.113143750 -0700
+++ neutron-8.1.2/neutron/agent/l3/agent.py 2016-08-30 13:20:22.455764906 -0700
@@ -13,6 +13,9 @@
# under the License.
#
+import os
+import platform
+
import eventlet
import netaddr
from oslo_config import cfg
@@ -32,12 +35,18 @@
from neutron.agent.l3 import ha
from neutron.agent.l3 import ha_router
from neutron.agent.l3 import legacy_router
-from neutron.agent.l3 import namespace_manager
+if platform.system() == "SunOS":
+ from neutron.agent.solaris import namespace_manager
+else:
+ from neutron.agent.l3 import namespace_manager
from neutron.agent.l3 import namespaces
from neutron.agent.l3 import router_processing_queue as queue
from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
-from neutron.agent.linux import pd
+if platform.system() == "SunOS":
+ from neutron.agent.solaris import pd
+else:
+ from neutron.agent.linux import pd
from neutron.agent.metadata import driver as metadata_driver
from neutron.agent import rpc as agent_rpc
from neutron.callbacks import events
@@ -268,6 +277,11 @@
"default value is 'br-ex' so it must be "
"explicitly set to a blank value."))
+ if not self.conf.router_id:
+ msg = _LE('Router id is required if not using namespaces.')
+ LOG.error(msg)
+ raise SystemExit(1)
+
# ipv6_gateway configured. Check for valid v6 link-local address.
try:
@@ -559,6 +573,12 @@
for i in range(0, len(router_ids), self.sync_routers_chunk_size):
routers = self.plugin_rpc.get_routers(
context, router_ids[i:i + self.sync_routers_chunk_size])
+ if not routers:
+ LOG.error(_LE('Server failed to return info for router '
+ 'with id %s. Make sure the correct router_id'
+ ' is specified in l3_agent.ini'),
+ os._exit(1)
LOG.debug('Processing :%r', routers)
for r in routers:
curr_router_ids.add(r['id'])
--- neutron-8.1.2/neutron/agent/l3_agent.py.~1~ 2016-06-09 18:45:29.000000000 -0700
+++ neutron-8.1.2/neutron/agent/l3_agent.py 2016-07-04 16:19:23.341146110 -0700
@@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import platform
import sys
from oslo_config import cfg
@@ -27,6 +28,7 @@ from neutron.agent.linux import interfac
from neutron.agent.linux import pd
from neutron.agent.linux import ra
from neutron.agent.metadata import config as metadata_config
+from neutron.agent.solaris import interface as solaris_interface
from neutron.common import config as common_config
from neutron.common import topics
from neutron import service as neutron_service
@@ -40,6 +42,7 @@ def register_opts(conf):
@@ -50,6 +53,8 @@ def main(manager='neutron.agent.l3.agent
register_opts(cfg.CONF)
+ if platform.system() == "SunOS":
+ manager = 'neutron.agent.l3.solaris_agent.L3NATAgent'
server = neutron_service.Service.create(
binary='neutron-l3-agent',
topic=topics.L3_AGENT,