components/openstack/neutron/patches/03-metadata-agent-add-solaris.patch
branchs11u2-sru
changeset 4156 4b1def16fe9b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/neutron/patches/03-metadata-agent-add-solaris.patch	Mon Apr 20 12:35:51 2015 -0700
@@ -0,0 +1,93 @@
+Generalizes the dameon.py and external_process.py to work on Solaris. These
+changes will eventually be proposed upstream.
+
+*** neutron-2014.2.2/neutron/agent/linux/daemon.py	2015-02-05 07:45:33.000000000 -0800
+--- NEW/neutron/agent/linux/daemon.py	2015-02-16 12:37:23.181739275 -0800
+***************
+*** 15,23 ****
+--- 15,25 ----
+  import atexit
+  import fcntl
+  import os
++ import platform
+  import signal
+  import sys
+  
++ from neutron.agent.linux import utils
+  from neutron.openstack.common import log as logging
+  
+  LOG = logging.getLogger(__name__)
+***************
+*** 60,65 ****
+--- 62,76 ----
+          if not pid:
+              return False
+  
++         if platform.system() == "SunOS":
++             cmd = ['/usr/bin/pargs', pid]
++             try:
++                 exec_out = utils.execute(cmd)
++                 return self.procname in exec_out and (not self.uuid or
++                                                       self.uuid in exec_out)
++             except RuntimeError:
++                 return False
++ 
+          cmdline = '/proc/%s/cmdline' % pid
+          try:
+              with open(cmdline, "r") as f:
+*** neutron-2014.2.2/neutron/agent/linux/external_process.py	2015-02-05 07:45:33.000000000 -0800
+--- NEW/neutron/agent/linux/external_process.py	2015-02-16 12:37:39.202659518 -0800
+***************
+*** 13,18 ****
+--- 13,19 ----
+  #    under the License.
+  
+  import collections
++ import platform
+  
+  import eventlet
+  from oslo.config import cfg
+***************
+*** 75,82 ****
+                  cmd_callback = self.default_cmd_callback
+              cmd = cmd_callback(self.get_pid_file_name(ensure_pids_dir=True))
+  
+!             ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace)
+!             ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env)
+          elif reload_cfg:
+              self.reload_cfg()
+  
+--- 76,91 ----
+                  cmd_callback = self.default_cmd_callback
+              cmd = cmd_callback(self.get_pid_file_name(ensure_pids_dir=True))
+  
+!             if self.namespace:
+!                 ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace)
+!                 ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env)
+!             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()
+  
+***************
+*** 122,127 ****
+--- 131,144 ----
+          if pid is None:
+              return False
+  
++         if platform.system() == "SunOS":
++             cmd = ['/usr/bin/pargs', pid]
++             try:
++                 exec_out = utils.execute(cmd)
++                 return self.uuid in exec_out
++             except RuntimeError:
++                 return False
++ 
+          cmdline = '/proc/%s/cmdline' % pid
+          try:
+              with open(cmdline, "r") as f: