|
1 In-house patch to adopt EMC driver to use Solaris' iscsiadm(1M) rather |
|
2 than that from Linux. Patch has not yet been submitted upstream. |
|
3 |
|
4 --- cinder-2014.2.2/cinder/volume/drivers/emc/emc_vmax_iscsi.py.orig 2014-10-16 06:26:26.000000000 -0700 |
|
5 +++ cinder-2014.2.2/cinder/volume/drivers/emc/emc_vmax_iscsi.py 2014-10-27 00:12:22.034201865 -0700 |
|
6 @@ -16,6 +16,8 @@ |
|
7 ISCSI Drivers for EMC VMAX arrays based on SMI-S. |
|
8 |
|
9 """ |
|
10 +import sys |
|
11 + |
|
12 import six |
|
13 |
|
14 from cinder import context |
|
15 @@ -155,17 +157,43 @@ class EMCVMAXISCSIDriver(driver.ISCSIDri |
|
16 |
|
17 LOG.info(_("ISCSI provider_location not stored, using discovery.")) |
|
18 |
|
19 - (out, _err) = self._execute('iscsiadm', '-m', 'discovery', |
|
20 - '-t', 'sendtargets', '-p', |
|
21 - self.configuration.iscsi_ip_address, |
|
22 - run_as_root=True) |
|
23 - |
|
24 - LOG.info(_( |
|
25 - "smis_do_iscsi_discovery is: %(out)s") |
|
26 - % {'out': out}) |
|
27 targets = [] |
|
28 - for target in out.splitlines(): |
|
29 - targets.append(target) |
|
30 + if sys.platform == 'sunos5': |
|
31 + data = _("Unexpected response while retrieving discovery-address " |
|
32 + "objects for volume '%s'") % volume["name"] |
|
33 + |
|
34 + self._execute('/usr/sbin/iscsiadm', 'add', 'discovery-address', |
|
35 + self.configuration.iscsi_ip_address) |
|
36 + (out, _err) = self._execute('/usr/sbin/iscsiadm', 'list', |
|
37 + 'discovery-address', '-v', |
|
38 + self.configuration.iscsi_ip_address) |
|
39 + lines = out.splitlines() |
|
40 + if not lines[0].strip().startswith('Discovery Address: '): |
|
41 + raise exception.VolumeBackendAPIException(data=data) |
|
42 + |
|
43 + for i in range(1, len(lines), 2): |
|
44 + name = lines[i].strip() |
|
45 + if not name.startswith('Target name: '): |
|
46 + raise exception.VolumeBackendAPIException(data=data) |
|
47 + (_, _, name) = name.split() |
|
48 + |
|
49 + address = lines[i + 1].strip() |
|
50 + if not address.startswith('Target address: '): |
|
51 + raise exception.VolumeBackendAPIException(data=data) |
|
52 + (_, _, address, tpgt) = address.split() |
|
53 + target = address + tpgt + ' ' + name |
|
54 + targets.append(target) |
|
55 + else: |
|
56 + (out, _err) = self._execute('iscsiadm', '-m', 'discovery', |
|
57 + '-t', 'sendtargets', '-p', |
|
58 + self.configuration.iscsi_ip_address, |
|
59 + run_as_root=True) |
|
60 + |
|
61 + LOG.info(_( |
|
62 + "smis_do_iscsi_discovery is: %(out)s") |
|
63 + % {'out': out}) |
|
64 + for target in out.splitlines(): |
|
65 + targets.append(target) |
|
66 |
|
67 return targets |
|
68 |