4070N/AChanges to the Neutron DHCP agent to port it to Solaris. These changes
4070N/Awill eventually be proposed upstream.
4070N/A
6033N/A--- neutron-2015.1.2/neutron/agent/dhcp_agent.py.~1~ 2015-10-13 10:35:16.000000000 -0700
6033N/A+++ neutron-2015.1.2/neutron/agent/dhcp_agent.py 2016-01-28 23:07:42.219218977 -0800
6033N/A@@ -14,9 +14,11 @@
6033N/A # License for the specific language governing permissions and limitations
2900N/A # under the License.
2900N/A
2900N/A+import platform
4070N/A import sys
2900N/A
6033N/A from oslo_config import cfg
6033N/A+from oslo_utils import importutils
2900N/A
2900N/A from neutron.agent.common import config
6033N/A from neutron.agent.dhcp import config as dhcp_config
6033N/A@@ -37,6 +39,12 @@ def register_options():
6033N/A cfg.CONF.register_opts(dhcp_config.DNSMASQ_OPTS)
6033N/A cfg.CONF.register_opts(metadata_config.DRIVER_OPTS)
6033N/A cfg.CONF.register_opts(metadata_config.SHARED_OPTS)
2900N/A+ if platform.system() == "SunOS":
2900N/A+ interface = \
2900N/A+ importutils.import_module("neutron.agent.solaris.interface")
2900N/A+ else:
2900N/A+ interface = \
2900N/A+ importutils.import_module("neutron.agent.linux.interface")
2900N/A cfg.CONF.register_opts(interface.OPTS)
2900N/A
6033N/A
6033N/A--- neutron-2015.1.2/neutron/agent/linux/external_process.py.~1~ 2015-10-13 10:35:16.000000000 -0700
6033N/A+++ neutron-2015.1.2/neutron/agent/linux/external_process.py 2016-01-28 23:07:42.221029379 -0800
6033N/A@@ -15,6 +15,7 @@
6033N/A import abc
6033N/A import collections
6033N/A import os.path
6033N/A+import platform
6033N/A import six
6033N/A
6033N/A import eventlet
6033N/A@@ -86,9 +87,17 @@ class ProcessManager(MonitoredProcess):
6033N/A cmd_callback = self.default_cmd_callback
6033N/A cmd = cmd_callback(self.get_pid_file_name())
6033N/A
6033N/A- ip_wrapper = ip_lib.IPWrapper(namespace=self.namespace)
6033N/A- ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env,
6033N/A- run_as_root=self.run_as_root)
6033N/A+ if self.namespace:
6033N/A+ ip_wrapper = ip_lib.IPWrapper(namespace=self.namespace)
6033N/A+ ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env,
6033N/A+ run_as_root=self.run_as_root)
6033N/A+ else:
6033N/A+ env_params = []
6033N/A+ if self.cmd_addl_env:
6033N/A+ env_params = (['/usr/bin/env'] +
6033N/A+ ['%s=%s' % pair for pair in
6033N/A+ self.cmd_addl_env.items()])
6033N/A+ utils.execute(env_params + list(cmd))
6033N/A elif reload_cfg:
6033N/A self.reload_cfg()
6033N/A
6033N/A@@ -131,6 +140,14 @@ class ProcessManager(MonitoredProcess):
6033N/A if pid is None:
6033N/A return False
6033N/A
6033N/A+ if platform.system() == "SunOS":
6033N/A+ cmd = ['/usr/bin/pargs', pid]
6033N/A+ try:
6033N/A+ exec_out = utils.execute(cmd)
6033N/A+ except RuntimeError:
6033N/A+ return False
6033N/A+ return self.uuid in exec_out
6033N/A+
6033N/A cmdline = '/proc/%s/cmdline' % pid
6033N/A try:
6033N/A with open(cmdline, "r") as f:
6033N/A--- neutron-2015.1.2/neutron/agent/linux/utils.py.~1~ 2015-10-13 10:35:16.000000000 -0700
6033N/A+++ neutron-2015.1.2/neutron/agent/linux/utils.py 2016-01-28 23:20:12.736969284 -0800
6033N/A@@ -31,7 +31,10 @@ from eventlet import greenthread
6033N/A from oslo_config import cfg
6033N/A from oslo_log import log as logging
6033N/A from oslo_log import loggers
6033N/A-from oslo_rootwrap import client
6033N/A+try:
6033N/A+ from oslo_rootwrap import client
6033N/A+except:
6033N/A+ pass
6033N/A from oslo_utils import excutils
6033N/A
6033N/A from neutron.agent.common import config
6033N/A--- neutron-2015.1.2/neutron/api/rpc/handlers/dhcp_rpc.py.~1~ 2015-10-13 10:35:16.000000000 -0700
6033N/A+++ neutron-2015.1.2/neutron/api/rpc/handlers/dhcp_rpc.py 2016-01-28 23:07:42.219930998 -0800
6033N/A@@ -188,11 +188,13 @@ class DhcpRpcCallback(object):
2900N/A for fixed_ip in port['fixed_ips']:
2900N/A if fixed_ip['subnet_id'] in dhcp_enabled_subnet_ids:
2900N/A dhcp_enabled_subnet_ids.remove(fixed_ip['subnet_id'])
2900N/A- port['fixed_ips'].extend(
2900N/A- [dict(subnet_id=s) for s in dhcp_enabled_subnet_ids])
2900N/A-
2900N/A- retval = plugin.update_port(context, port['id'],
2900N/A- dict(port=port))
2900N/A+ if dhcp_enabled_subnet_ids:
2900N/A+ port['fixed_ips'].extend(
2900N/A+ [dict(subnet_id=s) for s in dhcp_enabled_subnet_ids])
2900N/A+ retval = plugin.update_port(context, port['id'],
2900N/A+ dict(port=port))
2900N/A+ else:
2900N/A+ retval = port
2900N/A
2900N/A except n_exc.NotFound as e:
2900N/A LOG.warning(e)