Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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
Пример #4
0
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