def addIscsiNode(iface, target, credentials=None): targetName = target.iqn # There are 2 formats for an iSCSI node record. An old style format where # the path is /var/lib/iscsi/nodes/{target}/{portal} and a new style format # where the portal path is a directory containing a record file for each # bounded iface. Explicitly specifying tpgt on iSCSI login imposes creation # of the node record in the new style format which enables to access a # portal through multiple ifaces for multipathing. portalStr = "%s:%d,%d" % (target.portal.hostname, target.portal.port, target.tpgt) with _iscsiadmTransactionLock: iscsiadm.node_new(iface.name, portalStr, targetName) try: if credentials is not None: for key, value in credentials.getIscsiadmOptions(): key = "node.session." + key iscsiadm.node_update(iface.name, portalStr, targetName, key, value, hideValue=True) iscsiadm.node_login(iface.name, portalStr, targetName) iscsiadm.node_update(iface.name, portalStr, targetName, "node.startup", "manual") except: removeIscsiNode(iface, target) raise
def addIscsiNode(iface, target, credentials=None): # There are 2 formats for an iSCSI node record. An old style format where # the path is /var/lib/iscsi/nodes/{target}/{portal} and a new style format # where the portal path is a directory containing a record file for each # bounded iface. Explicitly specifying tpgt on iSCSI login imposes creation # of the node record in the new style format which enables to access a # portal through multiple ifaces for multipathing. portalStr = "%s:%d,%d" % (target.portal.hostname, target.portal.port, target.tpgt) with _iscsiadmTransactionLock: iscsiadm.node_new(iface.name, portalStr, target.iqn) try: if credentials is not None: for key, value in credentials.getIscsiadmOptions(): key = "node.session." + key iscsiadm.node_update(iface.name, portalStr, target.iqn, key, value, hideValue=True) setRpFilterIfNeeded(iface.netIfaceName, target.portal.hostname, True) iscsiadm.node_login(iface.name, portalStr, target.iqn) iscsiadm.node_update(iface.name, portalStr, target.iqn, "node.startup", "manual") except: removeIscsiNode(iface, target) raise
def addIscsiNode(iface, target, credentials=None): targetName = target.iqn portalStr = "%s:%d" % (target.portal.hostname, target.portal.port) with _iscsiadmTransactionLock: iscsiadm.node_new(iface.name, portalStr, targetName) try: iscsiadm.node_update(iface.name, portalStr, targetName, "node.startup", "manual") if credentials is not None: for key, value in credentials.getIscsiadmOptions(): key = "node.session." + key iscsiadm.node_update(iface.name, portalStr, targetName, key, value, hideValue=True) iscsiadm.node_login(iface.name, portalStr, targetName) except: removeIscsiNode(iface, target) raise
def addIscsiNode(iface, target, credentials=None): targetName = target.iqn portalStr = "%s:%d" % (target.portal.hostname, target.portal.port) with _iscsiadmTransactionLock: iscsiadm.node_new(iface.name, portalStr, targetName) try: if credentials is not None: for key, value in credentials.getIscsiadmOptions(): key = "node.session." + key iscsiadm.node_update(iface.name, portalStr, targetName, key, value, hideValue=True) iscsiadm.node_login(iface.name, portalStr, targetName) iscsiadm.node_update(iface.name, portalStr, targetName, "node.startup", "manual") except: removeIscsiNode(iface, target) raise