[PATCH 18/37] Move consecutive number generation to rtslib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This lets other users of rtslib let it generate tags/lun indexes for them.

Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 targetcli/ui_target.py |   42 ------------------------------------------
 1 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py
index 5aaf73d..3ae8139 100644
--- a/targetcli/ui_target.py
+++ b/targetcli/ui_target.py
@@ -261,27 +261,6 @@ class UIMultiTPGTarget(UIRTSLibNode):
         B{delete}
         '''
         self.assert_root()
-        if tag is None:
-            tags = [tpg.tag for tpg in self.rtsnode.tpgs]
-            for index in range(1048576):
-                if index not in tags and index > 0:
-                    tag = index
-                    break
-            if tag is None:
-                self.shell.log.error("Cannot find an available TPG Tag.")
-                return
-            else:
-                self.shell.log.info("Selected TPG Tag %d." % tag)
-        else:
-            try:
-                tag = int(tag)
-            except ValueError:
-                self.shell.log.error("The TPG Tag must be an integer value.")
-                return
-            else:
-                if tag < 1:
-                    self.shell.log.error("The TPG Tag must be >0.")
-                    return
 
         tpg = TPG(self.rtsnode, tag, mode='create')
         if self.shell.prefs['auto_enable_tpgt']:
@@ -706,27 +685,6 @@ class UILUNs(UINode):
         B{delete}
         '''
         self.assert_root()
-        if lun is None:
-            luns = [lun.lun for lun in self.tpg.luns]
-            for index in range(1048576):
-                if index not in luns:
-                    lun = index
-                    break
-            if lun is None:
-                self.shell.log.error("Cannot find an available LUN.")
-                return
-            else:
-                self.shell.log.info("Selected LUN %d." % lun)
-        else:
-            try:
-                lun = int(lun)
-            except ValueError:
-                self.shell.log.error("The LUN must be an integer value.")
-                return
-            else:
-                if lun < 0:
-                    self.shell.log.error("The LUN cannot be negative.")
-                    return
 
         add_mapped_luns = \
                 self.ui_eval_param(add_mapped_luns, 'bool',
-- 
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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux