components/openstack/cinder/patches/03-emc_smis_iscsi.patch
author Drew Fisher <drew.fisher@oracle.com>
Mon, 17 Mar 2014 09:51:44 -0600
changeset 1760 353323c7bdc1
child 1944 56ac2df1785b
permissions -rw-r--r--
PSARC/2013/350 OpenStack for Solaris (Umbrella) PSARC/2014/007 OpenStack client API components for Grizzly PSARC/2014/054 OpenStack Cinder (OpenStack Block Storage Service) PSARC/2014/055 OpenStack Glance (OpenStack Image Service) PSARC/2014/058 OpenStack Horizon (OpenStack Dashboard) PSARC/2014/048 OpenStack Keystone (OpenStack Identity Service) PSARC/2014/059 OpenStack Neutron (OpenStack Networking Service) PSARC/2014/049 OpenStack Nova (OpenStack Compute Service) 18290089 integrate cinderclient 18290097 integrate glanceclient 18290102 integrate keystoneclient 18290109 integrate neutronclient 18290113 integrate novaclient 18290119 integrate swiftclient 18290125 integrate quantumclient 18307582 Request to integrate Cinder into userland 18307595 Request to integrate Glance into userland 18307626 Request to integrate Horizon into userland 18307641 Request to integrate Keystone into userland 18307650 Request to integrate Neutron into userland 18307659 Request to integrate Nova into userland 18321909 a few Python packages deliver both po and mo files

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