|
|
4959d3 |
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
|
|
|
4959d3 |
index bf681fe..cb52386 100644
|
|
|
4959d3 |
--- a/rtslib/tcm.py
|
|
|
4959d3 |
+++ b/rtslib/tcm.py
|
|
|
4959d3 |
@@ -785,7 +785,8 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
An interface to configFS storage objects for userspace-backed backstore.
|
|
|
4959d3 |
'''
|
|
|
4959d3 |
|
|
|
4959d3 |
- def __init__(self, name, config=None, size=None, wwn=None):
|
|
|
4959d3 |
+ def __init__(self, name, config=None, size=None, wwn=None,
|
|
|
4959d3 |
+ hw_max_sectors=None):
|
|
|
4959d3 |
'''
|
|
|
4959d3 |
@param name: The name of the UserBackedStorageObject.
|
|
|
4959d3 |
@type name: string
|
|
|
4959d3 |
@@ -796,6 +797,8 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
@type size: int
|
|
|
4959d3 |
@param wwn: T10 WWN Unit Serial, will generate if None
|
|
|
4959d3 |
@type wwn: string
|
|
|
4959d3 |
+ @hw_max_sectors: Max sectors per command limit to export to initiators.
|
|
|
4959d3 |
+ @type hw_max_sectors: int
|
|
|
4959d3 |
@return: A UserBackedStorageObject object.
|
|
|
4959d3 |
'''
|
|
|
4959d3 |
|
|
|
4959d3 |
@@ -808,20 +811,22 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
"from its configuration string")
|
|
|
4959d3 |
super(UserBackedStorageObject, self).__init__(name, 'create')
|
|
|
4959d3 |
try:
|
|
|
4959d3 |
- self._configure(config, size, wwn)
|
|
|
4959d3 |
+ self._configure(config, size, wwn, hw_max_sectors)
|
|
|
4959d3 |
except:
|
|
|
4959d3 |
self.delete()
|
|
|
4959d3 |
raise
|
|
|
4959d3 |
else:
|
|
|
4959d3 |
super(UserBackedStorageObject, self).__init__(name, 'lookup')
|
|
|
4959d3 |
|
|
|
4959d3 |
- def _configure(self, config, size, wwn):
|
|
|
4959d3 |
+ def _configure(self, config, size, wwn, hw_max_sectors):
|
|
|
4959d3 |
self._check_self()
|
|
|
4959d3 |
|
|
|
4959d3 |
if ':' in config:
|
|
|
4959d3 |
raise RTSLibError("':' not allowed in config string")
|
|
|
4959d3 |
self._control("dev_config=%s" % config)
|
|
|
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 |
self._enable()
|
|
|
4959d3 |
|
|
|
4959d3 |
super(UserBackedStorageObject, self)._configure(wwn)
|
|
|
4959d3 |
@@ -830,6 +835,10 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
self._check_self()
|
|
|
4959d3 |
return int(self._parse_info('Size'))
|
|
|
4959d3 |
|
|
|
4959d3 |
+ def _get_hw_max_sectors(self):
|
|
|
4959d3 |
+ self._check_self()
|
|
|
4959d3 |
+ return int(self._parse_info('HwMaxSectors'))
|
|
|
4959d3 |
+
|
|
|
4959d3 |
def _get_config(self):
|
|
|
4959d3 |
self._check_self()
|
|
|
4959d3 |
val = self._parse_info('Config')
|
|
|
4959d3 |
@@ -841,6 +850,8 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
self._check_self()
|
|
|
4959d3 |
return storage_object_get_alua_support_attr(self)
|
|
|
4959d3 |
|
|
|
4959d3 |
+ hw_max_sectors = property(_get_hw_max_sectors,
|
|
|
4959d3 |
+ doc="Get the max sectors per command.")
|
|
|
4959d3 |
size = property(_get_size,
|
|
|
4959d3 |
doc="Get the size in bytes.")
|
|
|
4959d3 |
config = property(_get_config,
|
|
|
4959d3 |
@@ -853,6 +864,8 @@ class UserBackedStorageObject(StorageObject):
|
|
|
4959d3 |
d['wwn'] = self.wwn
|
|
|
4959d3 |
d['size'] = self.size
|
|
|
4959d3 |
d['config'] = self.config
|
|
|
4959d3 |
+ d['hw_max_sectors'] = self.hw_max_sectors
|
|
|
4959d3 |
+
|
|
|
4959d3 |
return d
|
|
|
4959d3 |
|
|
|
4959d3 |
|