diff options
author | Mike Christie <mchristi@redhat.com> | 2017-01-03 13:17:09 -0600 |
---|---|---|
committer | Mike Christie <mchristi@redhat.com> | 2017-01-03 13:56:28 -0600 |
commit | 1f3abc3caddc8663abd529ace41e84088f4761c5 (patch) | |
tree | 808580047070f72b8519e67945cadd2fea8b05eb | |
parent | 39aba4c939fdaa93b59045df6169e2fc7c181719 (diff) | |
download | rtslib-fb-1f3abc3caddc8663abd529ace41e84088f4761c5.tar.gz |
Get/Set LUN's ALUA group
Add support to Get/Set a Lun's current ALUA group through
its alua_tg_pt_gp file.
Signed-off-by: Mike Christie <mchristi@redhat.com>
-rw-r--r-- | rtslib/target.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rtslib/target.py b/rtslib/target.py index c2836db..d8dc655 100644 --- a/rtslib/target.py +++ b/rtslib/target.py @@ -582,6 +582,22 @@ class LUN(CFSNode): if os.path.realpath("%s/%s" % (mlun.path, mlun.alias)) == self.path: yield mlun + def _get_alua_tg_pt_gp_name(self): + self._check_self() + + path = "%s/alua_tg_pt_gp" % self.path + group_name = fread(path).splitlines()[0] + return group_name.split(':')[1].strip() + + def _set_alua_tg_pt_gp_name(self, group_name): + self._check_self() + + path = "%s/alua_tg_pt_gp" % self.path + try: + fwrite(path, group_name) + except IOError as e: + raise RTSLibError("Cannot set ALUA Target Port Group: %s" % e) + # LUN public stuff def delete(self): @@ -615,6 +631,8 @@ class LUN(CFSNode): doc="Get the LUN alias.") mapped_luns = property(_list_mapped_luns, doc="List all MappedLUN objects referencing this LUN.") + alua_tg_pt_gp_name = property(_get_alua_tg_pt_gp_name, _set_alua_tg_pt_gp_name, + doc="Get and Set the LUN's ALUA Target Port Group") @classmethod def setup(cls, tpg_obj, lun, err_func): |