diff options
author | Andy Grover <andy@groveronline.com> | 2017-02-07 09:09:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 09:09:20 -0800 |
commit | 2c65d971ab1e77cad6cc637b1cf39148be87dab2 (patch) | |
tree | 9dc9f0d7ef17f441f12531f2f43a4ff52ef7f6ae /rtslib/tcm.py | |
parent | 572e9b41bae87023e5e5845786a15409246253aa (diff) | |
parent | 13dfb1aadbba3d1e2fa64133e9e2392071d58a5a (diff) | |
download | rtslib-fb-2c65d971ab1e77cad6cc637b1cf39148be87dab2.tar.gz |
Merge pull request #89 from mikechristie/alua-exception
Fix crash during restore due to ALUA exception
Diffstat (limited to 'rtslib/tcm.py')
-rw-r--r-- | rtslib/tcm.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/rtslib/tcm.py b/rtslib/tcm.py index 5452f92..aa3530a 100644 --- a/rtslib/tcm.py +++ b/rtslib/tcm.py @@ -222,7 +222,15 @@ class StorageObject(CFSNode): ''' self._check_self() for tpg in os.listdir("%s/alua" % self.path): - yield ALUATargetPortGroup(self, tpg) + if self.alua_supported: + yield ALUATargetPortGroup(self, tpg) + + def _get_alua_supported(self): + ''' + Children should override and return false if ALUA setup is not supported. + ''' + self._check_self() + return True # StorageObject public stuff @@ -279,6 +287,8 @@ class StorageObject(CFSNode): doc="Get the list of all LUN objects attached.") alua_tpgs = property(_list_alua_tpgs, doc="Get list of ALUA Target Port Groups attached.") + alua_supported = property(_get_alua_supported, + doc="Returns true if ALUA can be setup. False if not supported.") def dump(self): d = super(StorageObject, self).dump() @@ -408,6 +418,10 @@ class PSCSIStorageObject(StorageObject): self._check_self() return int(self._parse_info('Host ID')) + def _get_alua_supported(self): + self._check_self() + return False + # PSCSIStorageObject public stuff wwn = property(StorageObject._get_wwn, _set_wwn, @@ -427,6 +441,8 @@ class PSCSIStorageObject(StorageObject): doc="Get the SCSI device target id") lun = property(_get_lun, doc="Get the SCSI device LUN") + alua_supported = property(_get_alua_supported, + doc="ALUA cannot be setup with rtslib, so False is returned."); def dump(self): d = super(PSCSIStorageObject, self).dump() @@ -808,10 +824,16 @@ class UserBackedStorageObject(StorageObject): return None return val + def _get_alua_supported(self): + self._check_self() + return False + size = property(_get_size, doc="Get the size in bytes.") config = property(_get_config, doc="Get the TCMU config.") + alua_supported = property(_get_alua_supported, + doc="ALUA cannot be setup with rtslib, so False is returned."); def dump(self): d = super(UserBackedStorageObject, self).dump() |