Skip to content

Commit

Permalink
Merge pull request #86 from mikechristie/alua-fixes
Browse files Browse the repository at this point in the history
Do not set alua_tg_pt_gp if not supported
  • Loading branch information
agrover committed Jan 20, 2017
2 parents 19efee2 + 59f3fc4 commit 572e9b4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rtslib/target.py
Expand Up @@ -586,13 +586,23 @@ 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()
info = fread(path)
if info:
group_line = info.splitlines()[0]
return group_line.split(':')[1].strip()
return None

def _set_alua_tg_pt_gp_name(self, group_name):
self._check_self()

path = "%s/alua_tg_pt_gp" % self.path

info = fread(path)
if not info:
# pass through backends will not have setup the default
# ALUA structs in the kernel.
raise RTSLibError("This LUN does not support setting the ALUA Target Port Group")

try:
fwrite(path, group_name)
except IOError as e:
Expand Down

0 comments on commit 572e9b4

Please sign in to comment.