def probe_luns(target, port, iqn): portal = get_portal(target, port, iqn) iscsilib.login(portal, iqn, "", "") try: luns = iscsilib.get_luns(iqn, portal) return [get_probe_possibility(os.path.join("/dev/iscsi/",iqn,portal,"LUN%s" % lun),lun) for lun in luns] finally: iscsilib.logout(portal, iqn)
def probe_luns(target, port, iqn): portal = get_portal(target, port, iqn) iscsilib.login(portal, iqn, "", "") try: luns = iscsilib.get_luns(iqn, portal) return [ get_probe_possibility( os.path.join("/dev/iscsi/", iqn, portal, "LUN%s" % lun), lun) for lun in luns ] finally: iscsilib.logout(portal, iqn)
def attach(target, port, iqn, scsiid): portal = get_portal(target, port, iqn) iscsilib.login(portal, iqn, "", "") try: luns = iscsilib.get_luns(iqn, portal) infos = [get_probe_possibility(os.path.join("/dev/iscsi/",iqn,portal,"LUN%s" % lun),lun) for lun in luns] for info in infos: if info['info']['SCSIid'] == scsiid: return os.path.join("/dev/iscsi",iqn,portal,"LUN%s" % info['info']['LUNid']) raise "Unknown SCSIid" except: iscsilib.logout(portal, iqn) raise
def attach(target, port, iqn, scsiid): portal = get_portal(target, port, iqn) iscsilib.login(portal, iqn, "", "") try: luns = iscsilib.get_luns(iqn, portal) infos = [ get_probe_possibility( os.path.join("/dev/iscsi/", iqn, portal, "LUN%s" % lun), lun) for lun in luns ] for info in infos: if info['info']['SCSIid'] == scsiid: return os.path.join("/dev/iscsi", iqn, portal, "LUN%s" % info['info']['LUNid']) raise "Unknown SCSIid" except: iscsilib.logout(portal, iqn) raise