Ejemplo n.º 1
0
def addIscsiPortal(iface, portal, credentials=None):
    discoverType = "sendtargets"
    portalStr = "%s:%d" % (portal.hostname, portal.port)

    with _iscsiadmTransactionLock:
        iscsiadm.discoverydb_new(discoverType, iface.name, portalStr)

        # NOTE: We are not taking for granted that iscsiadm is not going to
        #       write the database when the discovery fails, therefore we try
        #       to set the node startup to manual anyway.
        try:
            iscsiadm.discoverydb_update(discoverType, iface.name, portalStr,
                                        "node.startup", "manual")
        except:
            # this is just to be polite we don't really care
            pass

        try:
            # Push credentials
            if credentials is not None:
                for key, value in credentials.getIscsiadmOptions():
                    key = "discovery.sendtargets." + key
                    iscsiadm.discoverydb_update(discoverType, iface.name,
                                                portalStr, key, value,
                                                hideValue=True)

        except:
            deleteIscsiPortal(iface, portal)
            raise
Ejemplo n.º 2
0
def addIscsiPortal(iface, portal, credentials=None):
    discoverType = "sendtargets"
    portalStr = "%s:%d" % (portal.hostname, portal.port)

    with _iscsiadmTransactionLock:
        iscsiadm.discoverydb_new(discoverType, iface.name, portalStr)

        try:
            # Push credentials
            if credentials is not None:
                for key, value in credentials.getIscsiadmOptions():
                    key = "discovery.sendtargets." + key
                    iscsiadm.discoverydb_update(discoverType, iface.name,
                                                portalStr, key, value,
                                                hideValue=True)

        except:
            deleteIscsiPortal(iface, portal)
            raise
Ejemplo n.º 3
0
def addIscsiPortal(iface, portal, credentials=None):
    discoverType = "sendtargets"
    portalStr = "%s:%d" % (portal.hostname, portal.port)

    with _iscsiadmTransactionLock:
        iscsiadm.discoverydb_new(discoverType, iface.name, portalStr)

        try:
            # Push credentials
            if credentials is not None:
                for key, value in credentials.getIscsiadmOptions():
                    key = "discovery.sendtargets." + key
                    iscsiadm.discoverydb_update(discoverType, iface.name,
                                                portalStr, key, value,
                                                hideValue=True)

        except:
            deleteIscsiPortal(iface, portal)
            raise