Blame SOURCES/0012-tcmu-add-control-constructor-arg.patch

4959d3
From 9637223b9d8cee3abc527f58fc9e14a1bcbe4b29 Mon Sep 17 00:00:00 2001
4959d3
From: Mike Christie <mchristi@redhat.com>
4959d3
Date: Wed, 7 Mar 2018 19:47:34 -0600
4959d3
Subject: [PATCH] tcmu: add control constructor arg
4959d3
4959d3
Add format control constructor arg so user does not have to hack
4959d3
in extra settings through the config option.
4959d3
4959d3
Signed-off-by: Mike Christie <mchristi@redhat.com>
4959d3
---
4959d3
 rtslib/tcm.py | 11 ++++++++---
4959d3
 1 file changed, 8 insertions(+), 3 deletions(-)
4959d3
4959d3
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
4959d3
index 1aeea23..efe685a 100644
4959d3
--- a/rtslib/tcm.py
4959d3
+++ b/rtslib/tcm.py
4959d3
@@ -787,7 +787,7 @@ class UserBackedStorageObject(StorageObject):
4959d3
     '''
4959d3
 
4959d3
     def __init__(self, name, config=None, size=None, wwn=None,
4959d3
-                 hw_max_sectors=None):
4959d3
+                 hw_max_sectors=None, control=None):
4959d3
         '''
4959d3
         @param name: The name of the UserBackedStorageObject.
4959d3
         @type name: string
4959d3
@@ -800,6 +800,9 @@ class UserBackedStorageObject(StorageObject):
4959d3
         @type wwn: string
4959d3
         @hw_max_sectors: Max sectors per command limit to export to initiators.
4959d3
         @type hw_max_sectors: int
4959d3
+        @control: String of control=value tuples separate by a ',' that will
4959d3
+            passed to the kernel control file.
4959d3
+        @type: string
4959d3
         @return: A UserBackedStorageObject object.
4959d3
         '''
4959d3
 
4959d3
@@ -812,14 +815,14 @@ class UserBackedStorageObject(StorageObject):
4959d3
                                   "from its configuration string")
4959d3
             super(UserBackedStorageObject, self).__init__(name, 'create')
4959d3
             try:
4959d3
-                self._configure(config, size, wwn, hw_max_sectors)
4959d3
+                self._configure(config, size, wwn, hw_max_sectors, control)
4959d3
             except:
4959d3
                 self.delete()
4959d3
                 raise
4959d3
         else:
4959d3
             super(UserBackedStorageObject, self).__init__(name, 'lookup')
4959d3
 
4959d3
-    def _configure(self, config, size, wwn, hw_max_sectors):
4959d3
+    def _configure(self, config, size, wwn, hw_max_sectors, control):
4959d3
         self._check_self()
4959d3
 
4959d3
         if ':' in config:
4959d3
@@ -828,6 +831,8 @@ class UserBackedStorageObject(StorageObject):
4959d3
         self._control("dev_size=%d" % size)
4959d3
         if hw_max_sectors is not None:
4959d3
             self._control("hw_max_sectors=%s" % hw_max_sectors)
4959d3
+        if control is not None:
4959d3
+            self._control(control)
4959d3
         self._enable()
4959d3
 
4959d3
         super(UserBackedStorageObject, self)._configure(wwn)
4959d3
-- 
4959d3
1.8.3.1
4959d3