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