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@xxxxxxxxxxxx> Reported-by: Slava Shwartsman <valyushash@xxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html