def _get_storage_object(self): self._check_self() alias_path = None for path in os.listdir(self.path): if os.path.islink("%s/%s" % (self.path, path)): alias_path = os.path.realpath("%s/%s" % (self.path, path)) break if alias_path is None: raise RTSLibBrokenLink("Broken LUN in configFS, no " + "storage object attached.") from root import RTSRoot rtsroot = RTSRoot() for storage_object in rtsroot.storage_objects: if storage_object.path == alias_path: return storage_object raise RTSLibBrokenLink("Broken storage object link in LUN.")
def _get_tpg_lun(self): self._check_self() path = os.path.realpath("%s/%s" % (self.path, self._get_alias())) for lun in self.parent_nodeacl.parent_tpg.luns: if lun.path == path: return lun raise RTSLibBrokenLink("Broken MappedLUN, no TPG LUN found !")
def _get_storage_object(self): self._check_self() alias_path = None for path in os.listdir(self.path): if os.path.islink("%s/%s" % (self.path, path)): alias_path = os.path.realpath("%s/%s" % (self.path, path)) break if alias_path is None: raise RTSLibBrokenLink("Broken LUN in configFS, no " + "storage object attached.") return tcm.StorageObject.so_from_path(alias_path)
def _get_alias(self): self._check_self() alias = None for path in os.listdir(self.path): if os.path.islink("%s/%s" % (self.path, path)): alias = os.path.basename(path) break if alias is None: raise RTSLibBrokenLink("Broken LUN in configFS, no " \ + "storage object attached.") else: return alias