components/openstack/neutron/patches/01-dhcp-agent-add-solaris.patch
author Devjani Ray <devjani.ray@oracle.com>
Fri, 05 Feb 2016 17:54:17 -0500
changeset 5405 66fd59fecd68
parent 3998 5bd484384122
child 6031 1aaf20a19738
permissions -rw-r--r--
PSARC 2015/535 OpenStack service updates for Kilo PSARC 2015/458 aioeventlet - asyncio event loop scheduling callbacks in eventlet PSARC 2015/460 msgpack - C/Python bindings for MessagePack (de)serializer data PSARC 2015/466 openstackclient - OpenStack Command-line Client PSARC 2015/467 oslo.versionedobjects - Oslo Versioned Objects library PSARC 2015/468 pint - A physical quantities module PSARC 2015/469 pysaml2 - A pure Python implementation of SAML2 PSARC 2015/471 semantic_version - A library implementing the 'SemVer' scheme PSARC 2015/472 testresources - PyUnit extension for managing expensive test resources PSARC 2015/473 testscenarios - Extensions to Python unittest to support scenarios PSARC 2015/474 trollius - Port of the Tulip project (asyncio module, PEP 3156) on Python 2 PSARC 2015/475 urllib3 - HTTP library with thread-safe connection pooling, file post, and more PSARC 2015/520 oslo.concurrency - Oslo Concurrency library PSARC 2015/521 oslo.log - Oslo Logging Configuration library PSARC 2015/529 oslo.policy - Oslo Policy library PSARC 2015/530 psutil - Python system and process utilities PSARC 2015/538 fixtures - Python module to support reusable state for writing clean tests PSARC 2015/539 sqlparse - An SQL parser module for Python PSARC 2016/017 extras - Useful extra utilities for Python PSARC 2016/018 linecache2 - Port of the standard linecache module PSARC 2016/019 python-mimeparse - Basic functions for parsing mime-types PSARC 2016/020 testtools - Extensions to the Python unit testing framework PSARC 2016/021 traceback2 - Port of the standard traceback module PSARC 2016/014 OpenStack Cinder NFS driver for Solaris 22384068 OpenStack service updates for Kilo (Umbrella) 21974208 The Python module msgpack should be added to Userland 22010630 The Python trollius module should be added to Userland 22011755 The Python module pint should be added to Userland 22012256 The Python aioeventlet module should be added to Userland 22012282 The Python oslo.versionedobjects module should be added to Userland 22012317 The Python semantic_version module should be added to Userland 22012321 The Python testresources module should be added to Userland 22012329 The Python testscenarios module should be added to Userland 22012336 The Python urllib3 module should be added to Userland 22012343 The Python openstackclient module should be added to Userland 22299389 The Python oslo.concurrency module should be added to Userland 22299409 The Python oslo.log module should be added to Userland 22299418 The Python oslo.policy module should be added to Userland 22299469 The Python psutil module should be added to Userland 22337793 The Python sqlparse module should be added to Userland 22338325 The Python fixtures module should be added to Userland 22535728 The Python testtools module should be added to Userland 22535739 The Python extras module should be added to Userland 22535748 The Python linecache2 module should be added to Userland 22535753 The Python traceback2 module should be added to Userland 22535760 The Python python-mimeparse module should be added to Userland 18961001 Image filtering does not function as expected 21678935 NFS for Cinder in Solaris OpenStack 22548630 derived manifest should not enforce presence of global when installing from UAR 22629795 problem in SERVICE/KEYSTONE

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():
     cfg.CONF.register_opts(dhcp_config.DNSMASQ_OPTS)
     cfg.CONF.register_opts(metadata_config.DRIVER_OPTS)
     cfg.CONF.register_opts(metadata_config.SHARED_OPTS)
+    if platform.system() == "SunOS":
+        interface = \
+            importutils.import_module("neutron.agent.solaris.interface")
+    else:
+        interface = \
+            importutils.import_module("neutron.agent.linux.interface")
     cfg.CONF.register_opts(interface.OPTS)
 
 
--- 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:
             self.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)