01-dhcp-agent-add-solaris.patch revision 4070
4070N/AChanges to the Neutron DHCP agent to port it to Solaris. These changes
4070N/Awill eventually be proposed upstream.
4070N/A
4070N/A--- neutron-2014.2.2/neutron/agent/dhcp_agent.py.~1~ 2015-02-05 07:45:33.000000000 -0800
4070N/A+++ neutron-2014.2.2/neutron/agent/dhcp_agent.py 2015-02-25 00:44:00.464466509 -0800
4070N/A@@ -14,6 +14,7 @@
2900N/A # under the License.
2900N/A
2900N/A import os
2900N/A+import platform
4070N/A import sys
2900N/A
2900N/A import eventlet
4070N/A@@ -22,9 +23,7 @@ eventlet.monkey_patch()
2900N/A from oslo.config import cfg
2900N/A
2900N/A from neutron.agent.common import config
2900N/A-from neutron.agent.linux import dhcp
2900N/A from neutron.agent.linux import external_process
2900N/A-from neutron.agent.linux import interface
4070N/A from neutron.agent.linux import ovs_lib # noqa
2900N/A from neutron.agent import rpc as agent_rpc
4070N/A from neutron.common import config as common_config
4070N/A@@ -42,6 +41,9 @@ from neutron.openstack.common import ser
2900N/A from neutron import service as neutron_service
2900N/A
2900N/A LOG = logging.getLogger(__name__)
2900N/A+# dynamic module import
2900N/A+dhcp = None
2900N/A+interface = None
2900N/A
2900N/A
2900N/A class DhcpAgent(manager.Manager):
4070N/A@@ -609,6 +611,16 @@ def register_options():
4070N/A config.register_use_namespaces_opts_helper(cfg.CONF)
2900N/A config.register_agent_state_opts_helper(cfg.CONF)
2900N/A config.register_root_helper(cfg.CONF)
2900N/A+ global dhcp
2900N/A+ global interface
2900N/A+ if platform.system() == "SunOS":
2900N/A+ dhcp = importutils.import_module("neutron.agent.solaris.dhcp")
2900N/A+ interface = \
2900N/A+ importutils.import_module("neutron.agent.solaris.interface")
2900N/A+ else:
2900N/A+ dhcp = importutils.import_module("neutron.agent.linux.dhcp")
2900N/A+ interface = \
2900N/A+ importutils.import_module("neutron.agent.linux.interface")
2900N/A cfg.CONF.register_opts(dhcp.OPTS)
2900N/A cfg.CONF.register_opts(interface.OPTS)
2900N/A
4070N/A--- neutron-2014.2.2/neutron/api/rpc/handlers/dhcp_rpc.py.~1~ 2015-02-05 07:45:33.000000000 -0800
4070N/A+++ neutron-2014.2.2/neutron/api/rpc/handlers/dhcp_rpc.py 2015-02-25 00:44:00.464738154 -0800
4070N/A@@ -168,11 +168,13 @@ class DhcpRpcCallback(n_rpc.RpcCallback)
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)