[PATCH] rtslib/tcm: Add NULLIO support for rd_dr/rd_mcp
by sagi grimberg
When the user creates a RAM device with size=0 we
interperet it as implicit NULLIO option (Instead
of modifying size to 1).
We still set the size to a fixed NULLIO_SIZE of 1T
in order to emulate a large storage device to the
fabric.
Signed-off-by: Sagi Grimberg <sagig(a)mellanox.com>
Reported-by: Slava Shwartsman <valyushash(a)gmail.com>
---
rtslib/tcm.py | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
index 1b1b8c3..dfe0f7d 100644
--- a/rtslib/tcm.py
+++ b/rtslib/tcm.py
@@ -27,6 +27,9 @@ from utils import convert_scsi_path_to_hctl, convert_scsi_hctl_to_path
from utils import convert_human_to_bytes, is_dev_in_use, get_block_type
from utils import is_disk_partition, get_disk_size
+# Publish 1T size for NULLIO
+NULLIO_SIZE = 1024 * 1024 * 1024 * 1024 / 4096
+
class Backstore(CFSNode):
# Backstore private stuff
@@ -715,10 +718,13 @@ class RDDRStorageObject(StorageObject):
def _configure(self, size, wwn):
self._check_self()
size = convert_human_to_bytes(size)
- # convert to 4k pages
- size = round(float(size)/4096)
- if size == 0:
- size = 1
+ if size == 0:
+ # size 0 given, implicit meaning NULL device
+ self._control("rd_nullio=1")
+ size = NULLIO_SIZE
+ else:
+ # convert to 4k pages
+ size = round(float(size)/4096)
self._control("rd_pages=%d" % size)
self._enable()
@@ -810,10 +816,13 @@ class RDMCPStorageObject(StorageObject):
def _configure(self, size, wwn):
self._check_self()
size = convert_human_to_bytes(size)
- # convert to 4k pages
- size = round(float(size)/4096)
- if size == 0:
- size = 1
+ if size == 0:
+ # size 0 given, implicit meaning NULL device
+ self._control("rd_nullio=1")
+ size = NULLIO_SIZE
+ else:
+ # convert to 4k pages
+ size = round(float(size)/4096)
self._control("rd_pages=%d" % size)
self._enable()
--
1.7.1
9 years, 12 months
targetctl restore and OSError: [Errno 22] Invalid argument
by Krzysztof Chojnowski
Hi,
I'm testing targetcli-fb on my Archlinux box and restore functionality
is failing with following:
# /usr/bin/targetctl restore
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/rtslib/node.py", line 140, in
set_attribute
fwrite(path, "%s" % str(value))
File "/usr/lib/python3.4/site-packages/rtslib/utils.py", line 67, in
fwrite
file_fd.write(str(string))
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/targetctl", line 87, in <module>
main()
File "/usr/bin/targetctl", line 84, in main
funcs[sys.argv[1]](savefile)
File "/usr/bin/targetctl", line 47, in restore
errors = RTSRoot().restore_from_file(restore_file=from_file)
File "/usr/lib/python3.4/site-packages/rtslib/root.py", line 260, in
restore_from_file
abort_on_error=abort_on_error)
File "/usr/lib/python3.4/site-packages/rtslib/root.py", line 201, in
restore
set_attributes(so_obj, so.get('attributes', {}))
File "/usr/lib/python3.4/site-packages/rtslib/utils.py", line 440, in
set_attributes
obj.set_attribute(name, value)
File "/usr/lib/python3.4/site-packages/rtslib/node.py", line 142, in
set_attribute
msg = msg[1]
TypeError: 'OSError' object is not subscriptable
I debugged it to following file and value:
# echo 0 >
/sys/kernel/config/target/core/iblock_0/windows_data/attrib/pi_prot_type
bash: echo: write error: Invalid argument
Dmesg logs following:
[168897.460098] DIF protection not supported by backend: iblock
Is it kernel or targetcli-fb issue?
targetcli-fb 2.1.fb35-1
python-rtslib-fb 2.1.fb47-1
python-configshell-fb 1.1.fb13-1
linux 3.14-4
10 years
Re: ErrorRecoveryLevel Set as read-only Randomly.
by Andy Grover
On 04/17/2014 01:42 PM, Nicholas A. Bellinger wrote:
> Hi Arshad,
>
> On Wed, 2014-04-09 at 14:51 +0530, Arshad Hussain wrote:
>> Hi Nab,
>>
>> Randomly my targetcli sets 'ErrorRecoveyLevel' as read only.
>> I have checked the configfs and debugfs they are both mounted
>> with permission of read and write. What surprises me is that
>> the ERL and default_erl under 'tpg1' is fine. It is only the
>> ERL parameter under 'acls/iqn...' which is marked read-only.
>>
>> Could you comment on this please ? Is there a work-around to
>> get over this issue?
>>
>> I have provided the details below. Please let me know if there any
>> other info you require?
>>
>> Thanks,
>> Arshad
>>
>> <snip>
>> /iscsi/iqn.20...t:981fc286f48> get parameter ErrorRecoveryLevel
>> ErrorRecoveryLevel=No Active iSCSI Session [ro]
>> /iscsi/iqn.20...t:981fc286f48> set parameter ErrorRecoveryLevel=2
>> Parameter ErrorRecoveryLevel is read-only.
>> /iscsi/iqn.20...t:981fc286f48>
>>
>> /iscsi/iqn.20...t:981fc286f48> get attribute default_erl
>> default_erl=2
>> /iscsi/iqn.20...t:981fc286f48>
>>
>> /iscsi/iqn.20...093081c0/tpg1> pwd
>> /iscsi/iqn.2003-01.org.linux-iscsi.wfs.x8664:sn.a6fd093081c0/tpg1
>> /iscsi/iqn.20...093081c0/tpg1> get parameter ErrorRecoveryLevel
>> ErrorRecoveryLevel=2
>> /iscsi/iqn.20...093081c0/tpg1> get attribute default_erl
>> default_erl=2
>> /iscsi/iqn.20...093081c0/tpg1>
> I'm not able to reproduce using upstream targetcli code, so I can only
> assume it's some -fb specific breakage. CC'ing Grover.
[adding CC targetcli-fb-devel]
Is this really random? it looks to me like all params under the acl are ro.
from iscsi_target_configfs.c:601
#define NACL_PARAM_ATTR(_name) TF_NACL_PARAM_ATTR_RO(iscsi, _name);
^^
...
DEF_NACL_PARAM(ErrorRecoveryLevel);
so yes it's read-only for the acl.
Is it just that you can set ERL in the tpg but not per-acl? And you only
get the value (instead of "no active iscsi session") when there is a
session. Is that the problem or something else?
Regards -- Andy
10 years