--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/cinder/patches/03-emc_smis_iscsi.patch Mon Mar 31 16:44:02 2014 -0700
@@ -0,0 +1,61 @@
+In-house patch to adopt EMC driver to use Solaris' iscsiadm(1M) rather
+than that from Linux. Patch has not yet been submitted upstream.
+
+--- cinder-2013.1.4/cinder/volume/drivers/emc/emc_smis_iscsi.py.~1~ 2013-10-17 11:21:37.000000000 -0700
++++ cinder-2013.1.4/cinder/volume/drivers/emc/emc_smis_iscsi.py 2014-03-12 17:07:06.500560732 -0700
+@@ -21,6 +21,7 @@
+ """
+
+ import os
++import sys
+ import time
+
+ from cinder import exception
+@@ -118,13 +119,41 @@
+
+ LOG.warn(_("ISCSI provider_location not stored, using discovery"))
+
+- (out, _err) = self._execute('iscsiadm', '-m', 'discovery',
+- '-t', 'sendtargets', '-p',
+- self.configuration.iscsi_ip_address,
+- run_as_root=True)
+ targets = []
+- for target in out.splitlines():
+- targets.append(target)
++
++ if sys.platform == 'sunos5':
++ data = _("Unexpected response while retrieving discovery-address "
++ "objects for volume '%s'") % volume["name"]
++
++ self._execute('/usr/sbin/iscsiadm', 'add', 'discovery-address',
++ self.configuration.iscsi_ip_address)
++ (out, _err) = self._execute('/usr/sbin/iscsiadm', 'list',
++ 'discovery-address', '-v',
++ self.configuration.iscsi_ip_address)
++ lines = out.splitlines()
++ if not lines[0].strip().startswith('Discovery Address: '):
++ raise exception.VolumeBackendAPIException(data=data)
++
++ for i in range(1, len(lines), 2):
++ name = lines[i].strip()
++ if not name.startswith('Target name: '):
++ raise exception.VolumeBackendAPIException(data=data)
++ (_, _, name) = name.split()
++
++ address = lines[i + 1].strip()
++ if not address.startswith('Target address: '):
++ raise exception.VolumeBackendAPIException(data=data)
++ (_, _, address, tpgt) = address.split()
++ target = address + tpgt + ' ' + name
++ targets.append(target)
++
++ else:
++ (out, _err) = self._execute('iscsiadm', '-m', 'discovery',
++ '-t', 'sendtargets', '-p',
++ self.configuration.iscsi_ip_address,
++ run_as_root=True)
++ for target in out.splitlines():
++ targets.append(target)
+
+ return targets
+