|
1 In-house patch to adapt Linux specific commands and command output |
|
2 parsing to Solaris. |
|
3 |
|
4 Patch may be suitable for pushing upsteam. |
|
5 |
|
6 --- cinder-2015.1.0/cinder/brick/remotefs/remotefs.py.orig 2015-10-13 13:33:37.708165135 -0700 |
|
7 +++ cinder-2015.1.0/cinder/brick/remotefs/remotefs.py 2015-10-13 13:42:40.978353719 -0700 |
|
8 @@ -17,6 +17,7 @@ |
|
9 |
|
10 import hashlib |
|
11 import os |
|
12 +import platform |
|
13 import re |
|
14 |
|
15 from oslo_concurrency import processutils as putils |
|
16 @@ -77,14 +78,21 @@ class RemoteFsClient(object): |
|
17 self._get_hash_str(device_name)) |
|
18 |
|
19 def _read_mounts(self): |
|
20 - (out, _err) = self._execute('mount', check_exit_code=0) |
|
21 + if platform.system() == "SunOS": |
|
22 + (out, _err) = self._execute('/usr/sbin/mount', check_exit_code=0) |
|
23 + else: |
|
24 + (out, _err) = self._execute('mount', check_exit_code=0) |
|
25 lines = out.split('\n') |
|
26 mounts = {} |
|
27 for line in lines: |
|
28 tokens = line.split() |
|
29 if 2 < len(tokens): |
|
30 - device = tokens[0] |
|
31 - mnt_point = tokens[2] |
|
32 + if platform.system() == "SunOS": |
|
33 + device = tokens[2] |
|
34 + mnt_point = tokens[0] |
|
35 + else: |
|
36 + device = tokens[0] |
|
37 + mnt_point = tokens[2] |
|
38 mounts[mnt_point] = device |
|
39 return mounts |
|
40 |
|
41 @@ -96,8 +104,12 @@ class RemoteFsClient(object): |
|
42 LOG.info(_LI('Already mounted: %s') % mount_path) |
|
43 return |
|
44 |
|
45 - self._execute('mkdir', '-p', mount_path, check_exit_code=0) |
|
46 - if self._mount_type == 'nfs': |
|
47 + if platform.system() == "SunOS": |
|
48 + self._execute('/usr/bin/mkdir', '-p', mount_path, |
|
49 + check_exit_code=0) |
|
50 + else: |
|
51 + self._execute('mkdir', '-p', mount_path, check_exit_code=0) |
|
52 + if self._mount_type == 'nfs' and platform.system() != "SunOS": |
|
53 self._mount_nfs(share, mount_path, flags) |
|
54 else: |
|
55 self._do_mount(self._mount_type, share, mount_path, |
|
56 @@ -106,15 +118,21 @@ class RemoteFsClient(object): |
|
57 def _do_mount(self, mount_type, share, mount_path, mount_options=None, |
|
58 flags=None): |
|
59 """Mounts share based on the specified params.""" |
|
60 - mnt_cmd = ['mount', '-t', mount_type] |
|
61 + if platform.system() == "SunOS": |
|
62 + mnt_cmd = ['/usr/sbin/mount', '-F', mount_type] |
|
63 + else: |
|
64 + mnt_cmd = ['mount', '-t', mount_type] |
|
65 if mount_options is not None: |
|
66 mnt_cmd.extend(['-o', mount_options]) |
|
67 if flags is not None: |
|
68 mnt_cmd.extend(flags) |
|
69 mnt_cmd.extend([share, mount_path]) |
|
70 |
|
71 - self._execute(*mnt_cmd, root_helper=self.root_helper, |
|
72 - run_as_root=True, check_exit_code=0) |
|
73 + if platform.system() == "SunOS": |
|
74 + self._execute(*mnt_cmd, check_exit_code=0) |
|
75 + else: |
|
76 + self._execute(*mnt_cmd, root_helper=self.root_helper, |
|
77 + run_as_root=True, check_exit_code=0) |
|
78 |
|
79 def _mount_nfs(self, nfs_share, mount_path, flags=None): |
|
80 """Mount nfs share using present mount types.""" |
|
81 |