summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <andy@groveronline.com>2017-01-19 16:41:11 -0800
committerGitHub <noreply@github.com>2017-01-19 16:41:11 -0800
commit572e9b41bae87023e5e5845786a15409246253aa (patch)
tree2dbab58a36d9d7a790fca997fc5c19553e1389b4
parent19efee2bc7e1239ce8a8bd7af599c4903439b2de (diff)
parent59f3fc46596ed0adfa1e9ed9f56dd71c5efdd47e (diff)
downloadrtslib-fb-572e9b41bae87023e5e5845786a15409246253aa.tar.gz
Merge pull request #86 from mikechristie/alua-fixes
Do not set alua_tg_pt_gp if not supported
-rw-r--r--rtslib/target.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/rtslib/target.py b/rtslib/target.py
index 4c06cf4..816be74 100644
--- a/rtslib/target.py
+++ b/rtslib/target.py
@@ -586,13 +586,23 @@ class LUN(CFSNode):
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: