[PATCH 21/24] Clear fabric discovery auth settings from clearconfig

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

 



It's a little different from the other object types.

Return an int from _get_discovery_enable_auth so it evaluates to
false if 0 ("0" returns true, not what we want.)

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

diff --git a/rtslib/root.py b/rtslib/root.py
index 29ed577..2e3a10d 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -179,6 +179,8 @@ class RTSRoot(CFSNode):
         # Deleting backstores deletes associated storageobjects.
         for t in self.targets:
             t.delete()
+        for fm in (f for f in self.fabric_modules if f.has_feature("discovery_auth")):
+            fm.clear_discovery_auth_settings()
         for bs in self.backstores:
             bs.delete()
 
diff --git a/rtslib/target.py b/rtslib/target.py
index 0be96b2..61d3fa7 100644
--- a/rtslib/target.py
+++ b/rtslib/target.py
@@ -234,6 +234,15 @@ class FabricModule(CFSNode):
             raise RTSLibError("This fabric module does not implement "
                               + "the %s feature." % feature)
 
+    def clear_discovery_auth_settings(self):
+        self._check_self()
+        self._assert_feature('discovery_auth')
+        self.discovery_mutual_password = ''
+        self.discovery_mutual_userid = ''
+        self.discovery_password = ''
+        self.discovery_userid = ''
+        self.discovery_enable_auth = False
+
     def _get_discovery_mutual_password(self):
         self._check_self()
         self._assert_feature('discovery_auth')
@@ -311,7 +320,7 @@ class FabricModule(CFSNode):
         self._assert_feature('discovery_auth')
         path = "%s/discovery_auth/enforce_discovery_auth" % self.path
         value = fread(path).strip()
-        return value
+        return int(value)
 
     def _set_discovery_enable_auth(self, enable):
         self._check_self()
-- 
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