[PATCH 11/37] Remove generate_wwn optional parameter

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

 



Generating WWNs is the default, and you pretty much always want one.
The only option we may want to add (it would be easy) would be to
optionally specify the WWN.

Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 targetcli/ui_backstore.py |   41 ++++++++++-------------------------------
 1 files changed, 10 insertions(+), 31 deletions(-)

diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 9abad40..ea23294 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -68,15 +68,6 @@ class UIBackstore(UINode):
             msg = "%d Storage Object" % no_storage_objects
         return (msg, None)
 
-    def prm_gen_wwn(self, generate_wwn):
-        generate_wwn = \
-                self.ui_eval_param(generate_wwn, 'bool', True)
-        if generate_wwn:
-            self.shell.log.info("Generating a wwn serial.")
-        else:
-            self.shell.log.info("Not generating a wwn serial.")
-        return generate_wwn
-
     def prm_buffered(self, buffered):
         buffered = \
                 self.ui_eval_param(buffered, 'bool', True)
@@ -198,12 +189,9 @@ class UIRDMCPBackstore(UIBackstore):
     def __init__(self, parent):
         UIBackstore.__init__(self, 'rd_mcp', parent)
 
-    def ui_command_create(self, name, size, generate_wwn=None):
+    def ui_command_create(self, name, size):
         '''
-        Creates an RDMCP storage object. I{size} is the size of the ramdisk,
-        and the optional I{generate_wwn} parameter is a boolean specifying
-        whether or not we should generate a T10 wwn Serial for the unit (by
-        default, yes).
+        Creates an RDMCP storage object. I{size} is the size of the ramdisk.
 
         SIZE SYNTAX
         ===========
@@ -219,8 +207,7 @@ class UIRDMCPBackstore(UIBackstore):
         self.assert_available_so_name(name)
         backstore = RDMCPBackstore(self.next_hba_index(), mode='create')
         try:
-            so = RDMCPStorageObject(backstore, name, size,
-                                    self.prm_gen_wwn(generate_wwn))
+            so = RDMCPStorageObject(backstore, name, size)
 
         except Exception, exception:
             backstore.delete()
@@ -238,17 +225,14 @@ class UIFileIOBackstore(UIBackstore):
     def __init__(self, parent):
         UIBackstore.__init__(self, 'fileio', parent)
 
-    def ui_command_create(self, name, file_or_dev, size=None,
-                          generate_wwn=None, buffered=None):
+    def ui_command_create(self, name, file_or_dev, size=None, buffered=None):
         '''
         Creates a FileIO storage object. If I{file_or_dev} is a path to a
         regular file to be used as backend, then the I{size} parameter is
         mandatory. Else, if I{file_or_dev} is a path to a block device, the
         size parameter B{must} be ommited. If present, I{size} is the size of
         the file to be used, I{file} the path to the file or I{dev} the path to
-        a block device.  The optional I{generate_wwn} parameter is a boolean
-        specifying whether or not we should generate a T10 wwn Serial for the
-        unit (by default, yes).  The I{buffered} parameter is a boolean stating
+        a block device. The I{buffered} parameter is a boolean stating
         whether or not to enable buffered mode. It is disabled by default
         (synchronous mode).
 
@@ -264,8 +248,8 @@ class UIFileIOBackstore(UIBackstore):
         '''
         self.assert_root()
         self.assert_available_so_name(name)
-        self.shell.log.debug("Using params size=%s generate_wwn=%s buffered=%s"
-                             % (size, generate_wwn, buffered))
+        self.shell.log.debug("Using params size=%s buffered=%s"
+                             % (size, buffered))
         is_dev = get_block_type(file_or_dev) is not None \
                 or is_disk_partition(file_or_dev)
                 
@@ -274,7 +258,6 @@ class UIFileIOBackstore(UIBackstore):
             try:
                 so = FileIOStorageObject(
                     backstore, name, file_or_dev,
-                    gen_wwn=self.prm_gen_wwn(generate_wwn),
                     buffered_mode=self.prm_buffered(buffered))
             except Exception, exception:
                 backstore.delete()
@@ -289,7 +272,6 @@ class UIFileIOBackstore(UIBackstore):
                 so = FileIOStorageObject(
                     backstore, name, file_or_dev,
                     size,
-                    gen_wwn=self.prm_gen_wwn(generate_wwn),
                     buffered_mode=self.prm_buffered(buffered))
             except Exception, exception:
                 backstore.delete()
@@ -309,19 +291,16 @@ class UIIBlockBackstore(UIBackstore):
     def __init__(self, parent):
         UIBackstore.__init__(self, 'iblock', parent)
 
-    def ui_command_create(self, name, dev, generate_wwn=None):
+    def ui_command_create(self, name, dev):
         '''
         Creates an IBlock Storage object. I{dev} is the path to the TYPE_DISK
-        block device to use and the optional I{generate_wwn} parameter is a
-        boolean specifying whether or not we should generate a T10 wwn Serial
-        for the unit (by default, yes).
+        block device to use.
         '''
         self.assert_root()
         self.assert_available_so_name(name)
         backstore = IBlockBackstore(self.next_hba_index(), mode='create')
         try:
-            so = IBlockStorageObject(backstore, name, dev,
-                                     self.prm_gen_wwn(generate_wwn))
+            so = IBlockStorageObject(backstore, name, dev)
         except Exception, exception:
             backstore.delete()
             raise exception
-- 
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