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