Fabric modules track discovery auth settings. These need to be persisted. Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> --- rtslib/root.py | 14 ++++++++++++-- rtslib/target.py | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/rtslib/root.py b/rtslib/root.py index 1141309..29ed577 100644 --- a/rtslib/root.py +++ b/rtslib/root.py @@ -163,6 +163,9 @@ class RTSRoot(CFSNode): so_dump['plugin'] = bs.plugin d['storage_objects'].append(so_dump) d['targets'] = [t.dump() for t in self.targets] + d['fabric_modules'] = [f.dump() for f in self.fabric_modules + if f.has_feature("discovery_auth") + if f.discovery_enable_auth] return d def clear_existing(self, confirm=False): @@ -213,11 +216,18 @@ class RTSRoot(CFSNode): so_obj = bs_obj._storage_object_class(bs_obj, **kwargs) set_attributes(so_obj, so['attributes']) + for fm in config['fabric_modules']: + # will not have config for FMs that don't support discovery_auth + fm_obj = FabricModule(fm['name']) + del fm['name'] + for name, value in fm.iteritems(): + setattr(fm_obj, name, value) + for t in config['targets']: - fm = FabricModule(t['fabric']) + fm_obj = FabricModule(t['fabric']) # Instantiate target - t_obj = Target(fm, t.get('wwn')) + t_obj = Target(fm_obj, t.get('wwn')) for tpg in t['tpgs']: tpg_obj = TPG(t_obj) diff --git a/rtslib/target.py b/rtslib/target.py index e577c39..0be96b2 100644 --- a/rtslib/target.py +++ b/rtslib/target.py @@ -350,6 +350,17 @@ class FabricModule(CFSNode): version = property(_get_version, doc="Get the fabric module version string.") + def dump(self): + d = super(FabricModule, self).dump() + d['name'] = self.name + for attr in ("userid", "password", "mutual_userid", "mutual_password"): + val = getattr(self, "discovery_" + attr, None) + if val: + d["discovery_" + attr] = val + d['discovery_enable_auth'] = bool(int(self.discovery_enable_auth)) + return d + + class LUN(CFSNode): ''' This is an interface to RTS Target LUNs in configFS. -- 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