[PATCH 18/24] Do not generate WWNs for fabrics that need specified WWNs

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

 



Some fabrics need WWNs to match with hardware values, and therefore
cannot be generated.

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

diff --git a/rtslib/target.py b/rtslib/target.py
index a4b7939..e751447 100644
--- a/rtslib/target.py
+++ b/rtslib/target.py
@@ -222,6 +222,13 @@ class FabricModule(CFSNode):
         '''
         return is_valid_wwn(self.spec['wwn_type'], wwn, self.spec['wwn_list'])
 
+    def needs_wwn(self):
+        '''
+        This fabric requires wwn to be specified when creating a target,
+        it cannot be autogenerated.
+        '''
+        return 'wwn_from_files' in self.spec or 'wwn_from_cmds' in self.spec
+
     def _assert_feature(self, feature):
         if not self.has_feature(feature):
             raise RTSLibError("This fabric module does not implement "
@@ -1280,6 +1287,10 @@ class Target(CFSNode):
         self.fabric_module = fabric_module
         self.wwn_type = fabric_module.spec['wwn_type']
 
+	if not wwn and self.fabric_module.needs_wwn():
+            raise RTSLibError("Must specify wwn for %s fabric" %
+                              self.fabric_module.name)
+
         if wwn is not None:
             wwn = str(wwn).strip()
         elif fabric_module.spec['wwn_list']:
-- 
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