|
1 Generalizes the dameon.py and external_process.py to work on Solaris. These |
|
2 changes will eventually be proposed upstream. |
|
3 |
|
4 *** neutron-2014.2.2/neutron/agent/linux/daemon.py 2015-02-05 07:45:33.000000000 -0800 |
|
5 --- NEW/neutron/agent/linux/daemon.py 2015-02-16 12:37:23.181739275 -0800 |
|
6 *************** |
|
7 *** 15,23 **** |
|
8 --- 15,25 ---- |
|
9 import atexit |
|
10 import fcntl |
|
11 import os |
|
12 + import platform |
|
13 import signal |
|
14 import sys |
|
15 |
|
16 + from neutron.agent.linux import utils |
|
17 from neutron.openstack.common import log as logging |
|
18 |
|
19 LOG = logging.getLogger(__name__) |
|
20 *************** |
|
21 *** 60,65 **** |
|
22 --- 62,76 ---- |
|
23 if not pid: |
|
24 return False |
|
25 |
|
26 + if platform.system() == "SunOS": |
|
27 + cmd = ['/usr/bin/pargs', pid] |
|
28 + try: |
|
29 + exec_out = utils.execute(cmd) |
|
30 + return self.procname in exec_out and (not self.uuid or |
|
31 + self.uuid in exec_out) |
|
32 + except RuntimeError: |
|
33 + return False |
|
34 + |
|
35 cmdline = '/proc/%s/cmdline' % pid |
|
36 try: |
|
37 with open(cmdline, "r") as f: |
|
38 *** neutron-2014.2.2/neutron/agent/linux/external_process.py 2015-02-05 07:45:33.000000000 -0800 |
|
39 --- NEW/neutron/agent/linux/external_process.py 2015-02-16 12:37:39.202659518 -0800 |
|
40 *************** |
|
41 *** 13,18 **** |
|
42 --- 13,19 ---- |
|
43 # under the License. |
|
44 |
|
45 import collections |
|
46 + import platform |
|
47 |
|
48 import eventlet |
|
49 from oslo.config import cfg |
|
50 *************** |
|
51 *** 75,82 **** |
|
52 cmd_callback = self.default_cmd_callback |
|
53 cmd = cmd_callback(self.get_pid_file_name(ensure_pids_dir=True)) |
|
54 |
|
55 ! ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace) |
|
56 ! ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env) |
|
57 elif reload_cfg: |
|
58 self.reload_cfg() |
|
59 |
|
60 --- 76,91 ---- |
|
61 cmd_callback = self.default_cmd_callback |
|
62 cmd = cmd_callback(self.get_pid_file_name(ensure_pids_dir=True)) |
|
63 |
|
64 ! if self.namespace: |
|
65 ! ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace) |
|
66 ! ip_wrapper.netns.execute(cmd, addl_env=self.cmd_addl_env) |
|
67 ! else: |
|
68 ! env_params = [] |
|
69 ! if self.cmd_addl_env: |
|
70 ! env_params = (['/usr/bin/env'] + |
|
71 ! ['%s=%s' % pair for pair in |
|
72 ! self.cmd_addl_env.items()]) |
|
73 ! utils.execute(env_params + list(cmd)) |
|
74 elif reload_cfg: |
|
75 self.reload_cfg() |
|
76 |
|
77 *************** |
|
78 *** 122,127 **** |
|
79 --- 131,144 ---- |
|
80 if pid is None: |
|
81 return False |
|
82 |
|
83 + if platform.system() == "SunOS": |
|
84 + cmd = ['/usr/bin/pargs', pid] |
|
85 + try: |
|
86 + exec_out = utils.execute(cmd) |
|
87 + return self.uuid in exec_out |
|
88 + except RuntimeError: |
|
89 + return False |
|
90 + |
|
91 cmdline = '/proc/%s/cmdline' % pid |
|
92 try: |
|
93 with open(cmdline, "r") as f: |