56 + else: |
56 + else: |
57 + self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
57 + self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
58 super(ISCSIConnector, self).__init__(root_helper, driver=driver, |
58 super(ISCSIConnector, self).__init__(root_helper, driver=driver, |
59 execute=execute, |
59 execute=execute, |
60 device_scan_attempts= |
60 device_scan_attempts= |
61 @@ -192,6 +204,9 @@ |
61 @@ -181,6 +193,8 @@ |
|
62 |
|
63 def set_execute(self, execute): |
|
64 super(ISCSIConnector, self).set_execute(execute) |
|
65 + if sys.platform == 'sunos5': |
|
66 + return |
|
67 self._linuxscsi.set_execute(execute) |
|
68 |
|
69 @synchronized('connect_volume') |
|
70 @@ -192,6 +206,9 @@ |
62 target_iqn - iSCSI Qualified Name |
71 target_iqn - iSCSI Qualified Name |
63 target_lun - LUN id of the volume |
72 target_lun - LUN id of the volume |
64 """ |
73 """ |
65 + if sys.platform == 'sunos5': |
74 + if sys.platform == 'sunos5': |
66 + return self._solarisiscsi.connect_volume(connection_properties, |
75 + return self._solarisiscsi.connect_volume(connection_properties, |
67 + self.device_scan_attempts) |
76 + self.device_scan_attempts) |
68 |
77 |
69 device_info = {'type': 'block'} |
78 device_info = {'type': 'block'} |
70 |
79 |
71 @@ -262,6 +277,10 @@ |
80 @@ -262,6 +279,9 @@ |
72 target_iqn - iSCSI Qualified Name |
81 target_iqn - iSCSI Qualified Name |
73 target_lun - LUN id of the volume |
82 target_lun - LUN id of the volume |
74 """ |
83 """ |
75 + if sys.platform == 'sunos5': |
84 + if sys.platform == 'sunos5': |
76 + self._solarisiscsi.disconnect_iscsi() |
|
77 + return |
85 + return |
78 + |
86 + |
79 # Moved _rescan_iscsi and _rescan_multipath |
87 # Moved _rescan_iscsi and _rescan_multipath |
80 # from _disconnect_volume_multipath_iscsi to here. |
88 # from _disconnect_volume_multipath_iscsi to here. |
81 # Otherwise, if we do rescan after _linuxscsi.remove_multipath_device |
89 # Otherwise, if we do rescan after _linuxscsi.remove_multipath_device |
82 @@ -306,6 +325,9 @@ |
90 @@ -306,6 +326,9 @@ |
83 |
91 |
84 def get_initiator(self): |
92 def get_initiator(self): |
85 """Secure helper to read file as root.""" |
93 """Secure helper to read file as root.""" |
86 + if sys.platform == 'sunos5': |
94 + if sys.platform == 'sunos5': |
87 + return self._solarisiscsi.get_initiator() |
95 + return self._solarisiscsi.get_initiator() |
88 + |
96 + |
89 file_path = '/etc/iscsi/initiatorname.iscsi' |
97 file_path = '/etc/iscsi/initiatorname.iscsi' |
90 try: |
98 try: |
91 lines, _err = self._execute('cat', file_path, run_as_root=True, |
99 lines, _err = self._execute('cat', file_path, run_as_root=True, |
92 @@ -555,8 +577,11 @@ |
100 @@ -555,8 +578,11 @@ |
93 execute=putils.execute, use_multipath=False, |
101 execute=putils.execute, use_multipath=False, |
94 device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT, |
102 device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT, |
95 *args, **kwargs): |
103 *args, **kwargs): |
96 - self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
104 - self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
97 - self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute) |
105 - self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute) |
101 + self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
109 + self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute) |
102 + self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute) |
110 + self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute) |
103 super(FibreChannelConnector, self).__init__(root_helper, driver=driver, |
111 super(FibreChannelConnector, self).__init__(root_helper, driver=driver, |
104 execute=execute, |
112 execute=execute, |
105 device_scan_attempts= |
113 device_scan_attempts= |
106 @@ -578,6 +603,10 @@ |
114 @@ -566,6 +592,8 @@ |
|
115 |
|
116 def set_execute(self, execute): |
|
117 super(FibreChannelConnector, self).set_execute(execute) |
|
118 + if sys.platform == 'sunos5': |
|
119 + return |
|
120 self._linuxscsi.set_execute(execute) |
|
121 self._linuxfc.set_execute(execute) |
|
122 |
|
123 @@ -578,6 +606,10 @@ |
107 target_iqn - iSCSI Qualified Name |
124 target_iqn - iSCSI Qualified Name |
108 target_lun - LUN id of the volume |
125 target_lun - LUN id of the volume |
109 """ |
126 """ |
110 + if sys.platform == 'sunos5': |
127 + if sys.platform == 'sunos5': |
111 + return self._solarisfc.connect_volume(connection_properties, |
128 + return self._solarisfc.connect_volume(connection_properties, |
112 + self.device_scan_attempts) |
129 + self.device_scan_attempts) |
113 + |
130 + |
114 LOG.debug("execute = %s" % self._execute) |
131 LOG.debug("execute = %s" % self._execute) |
115 device_info = {'type': 'block'} |
132 device_info = {'type': 'block'} |
116 |
133 |
117 @@ -686,6 +715,13 @@ |
134 @@ -686,6 +718,13 @@ |
118 target_wwn - iSCSI Qualified Name |
135 target_wwn - iSCSI Qualified Name |
119 target_lun - LUN id of the volume |
136 target_lun - LUN id of the volume |
120 """ |
137 """ |
121 + if sys.platform == 'sunos5': |
138 + if sys.platform == 'sunos5': |
122 + # There is some latency before the next time connection happens. |
139 + # There is some latency before the next time connection happens. |
128 devices = device_info['devices'] |
145 devices = device_info['devices'] |
129 |
146 |
130 # If this is a multipath device, we need to search again |
147 # If this is a multipath device, we need to search again |
131 |
148 |
132 |
149 |
133 --- cinder-2014.2.2/cinder/utils.py.~1~ 2014-10-16 06:26:26.000000000 -0700 |
150 --- cinder-2014.2.2/cinder/utils.py.~1~ 2015-02-05 08:03:26.000000000 -0800 |
134 +++ cinder-2014.2.2/cinder/utils.py 2015-01-04 23:26:04.305688145 -0800 |
151 +++ cinder-2014.2.2/cinder/utils.py 2015-04-20 20:46:27.658908715 -0700 |
135 @@ -137,8 +137,9 @@ |
152 @@ -137,8 +137,12 @@ |
136 |
153 |
137 def execute(*cmd, **kwargs): |
154 def execute(*cmd, **kwargs): |
138 """Convenience wrapper around oslo's execute() method.""" |
155 """Convenience wrapper around oslo's execute() method.""" |
139 - if 'run_as_root' in kwargs and 'root_helper' not in kwargs: |
156 - if 'run_as_root' in kwargs and 'root_helper' not in kwargs: |
140 - kwargs['root_helper'] = get_root_helper() |
157 - kwargs['root_helper'] = get_root_helper() |
141 + if sys.platform != 'sunos5': |
158 + if sys.platform == 'sunos5': |
|
159 + if 'run_as_root' in kwargs: |
|
160 + kwargs['run_as_root'] = False |
|
161 + else: |
142 + if 'run_as_root' in kwargs and 'root_helper' not in kwargs: |
162 + if 'run_as_root' in kwargs and 'root_helper' not in kwargs: |
143 + kwargs['root_helper'] = get_root_helper() |
163 + kwargs['root_helper'] = get_root_helper() |
144 return processutils.execute(*cmd, **kwargs) |
164 return processutils.execute(*cmd, **kwargs) |
145 |
165 |
146 |
166 |