components/openstack/cinder/patches/04-volume-backup.patch
author Devjani Ray <devjani.ray@oracle.com>
Fri, 05 Feb 2016 17:54:17 -0500
changeset 5405 66fd59fecd68
parent 4545 538c0aeae836
child 6849 f9a2279efa0d
permissions -rw-r--r--
PSARC 2015/535 OpenStack service updates for Kilo PSARC 2015/458 aioeventlet - asyncio event loop scheduling callbacks in eventlet PSARC 2015/460 msgpack - C/Python bindings for MessagePack (de)serializer data PSARC 2015/466 openstackclient - OpenStack Command-line Client PSARC 2015/467 oslo.versionedobjects - Oslo Versioned Objects library PSARC 2015/468 pint - A physical quantities module PSARC 2015/469 pysaml2 - A pure Python implementation of SAML2 PSARC 2015/471 semantic_version - A library implementing the 'SemVer' scheme PSARC 2015/472 testresources - PyUnit extension for managing expensive test resources PSARC 2015/473 testscenarios - Extensions to Python unittest to support scenarios PSARC 2015/474 trollius - Port of the Tulip project (asyncio module, PEP 3156) on Python 2 PSARC 2015/475 urllib3 - HTTP library with thread-safe connection pooling, file post, and more PSARC 2015/520 oslo.concurrency - Oslo Concurrency library PSARC 2015/521 oslo.log - Oslo Logging Configuration library PSARC 2015/529 oslo.policy - Oslo Policy library PSARC 2015/530 psutil - Python system and process utilities PSARC 2015/538 fixtures - Python module to support reusable state for writing clean tests PSARC 2015/539 sqlparse - An SQL parser module for Python PSARC 2016/017 extras - Useful extra utilities for Python PSARC 2016/018 linecache2 - Port of the standard linecache module PSARC 2016/019 python-mimeparse - Basic functions for parsing mime-types PSARC 2016/020 testtools - Extensions to the Python unit testing framework PSARC 2016/021 traceback2 - Port of the standard traceback module PSARC 2016/014 OpenStack Cinder NFS driver for Solaris 22384068 OpenStack service updates for Kilo (Umbrella) 21974208 The Python module msgpack should be added to Userland 22010630 The Python trollius module should be added to Userland 22011755 The Python module pint should be added to Userland 22012256 The Python aioeventlet module should be added to Userland 22012282 The Python oslo.versionedobjects module should be added to Userland 22012317 The Python semantic_version module should be added to Userland 22012321 The Python testresources module should be added to Userland 22012329 The Python testscenarios module should be added to Userland 22012336 The Python urllib3 module should be added to Userland 22012343 The Python openstackclient module should be added to Userland 22299389 The Python oslo.concurrency module should be added to Userland 22299409 The Python oslo.log module should be added to Userland 22299418 The Python oslo.policy module should be added to Userland 22299469 The Python psutil module should be added to Userland 22337793 The Python sqlparse module should be added to Userland 22338325 The Python fixtures module should be added to Userland 22535728 The Python testtools module should be added to Userland 22535739 The Python extras module should be added to Userland 22535748 The Python linecache2 module should be added to Userland 22535753 The Python traceback2 module should be added to Userland 22535760 The Python python-mimeparse module should be added to Userland 18961001 Image filtering does not function as expected 21678935 NFS for Cinder in Solaris OpenStack 22548630 derived manifest should not enforce presence of global when installing from UAR 22629795 problem in SERVICE/KEYSTONE

This patch is to replace Linux-specific code with conditional checks in
the Cinder Brick code to support Cinder backup on Solaris. Patch has
not yet been submitted upstream.

--- cinder-2015.1.2/cinder/brick/initiator/connector.py.~1~	2015-10-13 09:27:35.000000000 -0700
+++ cinder-2015.1.2/cinder/brick/initiator/connector.py	2016-01-31 00:12:30.729547660 -0800
@@ -32,6 +32,8 @@ from cinder.brick.initiator import host_
 from cinder.brick.initiator import linuxfc
 from cinder.brick.initiator import linuxscsi
 from cinder.brick.remotefs import remotefs
+from cinder.brick.initiator import solarisfc
+from cinder.brick.initiator import solarisiscsi
 from cinder.i18n import _, _LE, _LW
 from cinder.openstack.common import loopingcall
 
@@ -72,7 +74,10 @@ def get_connector_properties(root_helper
     """
 
     iscsi = ISCSIConnector(root_helper=root_helper)
-    fc = linuxfc.LinuxFibreChannel(root_helper=root_helper)
+    if sys.platform == 'sunos5':
+        fc = solarisfc.SolarisFibreChannel()
+    else:
+        fc = linuxfc.LinuxFibreChannel(root_helper=root_helper)
 
     props = {}
     props['ip'] = my_ip
@@ -188,8 +193,11 @@ class InitiatorConnector(executor.Execut
                'of=/dev/null', 'count=1')
         out, info = None, None
         try:
-            out, info = self._execute(*cmd, run_as_root=run_as_root,
-                                      root_helper=self._root_helper)
+            if sys.platform == 'sunos5':
+                out, info = self._execute(*cmd)
+            else:
+                out, info = self._execute(*cmd, run_as_root=run_as_root,
+                                          root_helper=self._root_helper)
         except putils.ProcessExecutionError as e:
             LOG.error(_LE("Failed to access the device on the path "
                           "%(path)s: %(error)s %(info)s.") %
@@ -225,7 +233,10 @@ class ISCSIConnector(InitiatorConnector)
                  execute=putils.execute, use_multipath=False,
                  device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
                  *args, **kwargs):
-        self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
+        if sys.platform == 'sunos5':
+            self._solarisiscsi = solarisiscsi.SolarisiSCSI()
+        else:
+            self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
         super(ISCSIConnector, self).__init__(root_helper, driver=driver,
                                              execute=execute,
                                              device_scan_attempts=
@@ -235,6 +246,8 @@ class ISCSIConnector(InitiatorConnector)
 
     def set_execute(self, execute):
         super(ISCSIConnector, self).set_execute(execute)
+        if sys.platform == 'sunos5':
+            return
         self._linuxscsi.set_execute(execute)
 
     def _iterate_all_targets(self, connection_properties):
@@ -289,6 +302,9 @@ class ISCSIConnector(InitiatorConnector)
         Note that plural keys may be used when use_multipath=True
         """
 
+        if sys.platform == 'sunos5':
+            return self._solarisiscsi.connect_volume(connection_properties,
+                                                     self.device_scan_attempts)
         device_info = {'type': 'block'}
 
         if self.use_multipath:
@@ -365,6 +381,8 @@ class ISCSIConnector(InitiatorConnector)
         target_iqn(s) - iSCSI Qualified Name
         target_lun(s) - LUN id of the volume
         """
+        if sys.platform == 'sunos5':
+            return
         # Moved _rescan_iscsi and _rescan_multipath
         # from _disconnect_volume_multipath_iscsi to here.
         # Otherwise, if we do rescan after _linuxscsi.remove_multipath_device
@@ -431,6 +449,9 @@ class ISCSIConnector(InitiatorConnector)
 
     def get_initiator(self):
         """Secure helper to read file as root."""
+        if sys.platform == 'sunos5':
+            return self._solarisiscsi.get_initiator()
+
         file_path = '/etc/iscsi/initiatorname.iscsi'
         try:
             lines, _err = self._execute('cat', file_path, run_as_root=True,
@@ -674,8 +695,11 @@ class FibreChannelConnector(InitiatorCon
                  execute=putils.execute, use_multipath=False,
                  device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
                  *args, **kwargs):
-        self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
-        self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute)
+        if sys.platform == 'sunos5':
+            self._solarisfc = solarisfc.SolarisFibreChannel()
+        else:
+            self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
+            self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute)
         super(FibreChannelConnector, self).__init__(root_helper, driver=driver,
                                                     execute=execute,
                                                     device_scan_attempts=
@@ -685,6 +709,8 @@ class FibreChannelConnector(InitiatorCon
 
     def set_execute(self, execute):
         super(FibreChannelConnector, self).set_execute(execute)
+        if sys.platform == 'sunos5':
+            return
         self._linuxscsi.set_execute(execute)
         self._linuxfc.set_execute(execute)
 
@@ -697,6 +723,10 @@ class FibreChannelConnector(InitiatorCon
         target_iqn - iSCSI Qualified Name
         target_lun - LUN id of the volume
         """
+        if sys.platform == 'sunos5':
+            return self._solarisfc.connect_volume(connection_properties,
+                                                  self.device_scan_attempts)
+
         LOG.debug("execute = %s" % self._execute)
         device_info = {'type': 'block'}
 
@@ -830,6 +860,13 @@ class FibreChannelConnector(InitiatorCon
         target_wwn - iSCSI Qualified Name
         target_lun - LUN id of the volume
         """
+        if sys.platform == 'sunos5':
+            # There is some latency before the next time connection happens.
+            # The best practice is to offline the state of the switch now
+            # and online it at the next connection.
+            # But now, we just return without any operation.
+            return
+
         devices = device_info['devices']
 
         # If this is a multipath device, we need to search again
--- cinder-2015.1.2/cinder/utils.py.~1~	2015-10-13 09:27:35.000000000 -0700
+++ cinder-2015.1.2/cinder/utils.py	2016-01-31 00:12:30.730160694 -0800
@@ -138,8 +138,12 @@ def check_exclusive_options(**kwargs):
 
 def execute(*cmd, **kwargs):
     """Convenience wrapper around oslo's execute() method."""
-    if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
-        kwargs['root_helper'] = get_root_helper()
+    if sys.platform == 'sunos5':
+        if 'run_as_root' in kwargs:
+            kwargs['run_as_root'] = False
+    else:
+        if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
+            kwargs['root_helper'] = get_root_helper()
     return processutils.execute(*cmd, **kwargs)