def discoverSendTargets(iface, portal, credentials=None): # Because proper discovery actually has to clear the DB having multiple # discoveries at once will cause unpredictable results discoverType = "sendtargets" portalStr = "%s:%d" % (portal.hostname, portal.port) with _iscsiadmTransactionLock: addIscsiPortal(iface, portal, credentials) try: targets = iscsiadm.discoverydb_discover(discoverType, iface.name, portalStr) finally: deleteIscsiPortal(iface, portal) res = [] for ip, port, tpgt, iqn in targets: # Do not reuse the portal from argument as the portal that # returns here has it's IP resolved! res.append(IscsiTarget(IscsiPortal(ip, port), tpgt, iqn)) return res
def discoverSendTargets(iface, portal, credentials=None): # Because proper discovery actually has to clear the DB having multiple # discoveries at once will cause unpredictable results discoverType = "sendtargets" with _iscsiadmTransactionLock: addIscsiPortal(iface, portal, credentials) try: targets = iscsiadm.discoverydb_discover(discoverType, iface.name, str(portal)) finally: deleteIscsiPortal(iface, portal) res = [] for ip, port, tpgt, iqn in targets: # Do not reuse the portal from argument as the portal that # returns here has it's IP resolved! res.append(IscsiTarget(IscsiPortal(ip, port), tpgt, iqn)) return res