Change in vdsm[ovirt-3.4]: iscsi: Specify tpgt to impose creation of a new style node r...
sgotliv at redhat.com
sgotliv at redhat.com
Thu Apr 10 09:32:38 UTC 2014
Hello Nir Soffer, Federico Simoncelli,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/26658
to review the following change.
Change subject: iscsi: Specify tpgt to impose creation of a new style node record
......................................................................
iscsi: Specify tpgt to impose creation of a new style node record
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. For example:
/var/lib/iscsi/nodes/{target}/{portal}/eth0
/var/lib/iscsi/nodes/{target}/{portal}/eth1
Explicitly specifying tpgt(target portal group tag) on iSCSI login imposes
creation of the new style node record which enables to access a portal
through multiple ifaces for multipathing.
Change-Id: I11a6a556d31524f4fae4786f5735accaf1cefb34
Signed-off-by: Sergey Gotliv <sgotliv at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/25706
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/iscsi.py
2 files changed, 17 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/26658/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index c740ec8..15cfe01 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -226,7 +226,7 @@
portal = iscsi.IscsiPortal(
conDict.get('connection', None),
int(conDict.get('port', None)))
- tpgt = None
+ tpgt = int(conDict.get('tpgt', iscsi.DEFAULT_TPGT))
target = iscsi.IscsiTarget(portal, tpgt, conDict.get('iqn', None))
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index f4fdceb..0f722dc 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -41,6 +41,7 @@
IscsiPortal = namedtuple("IscsiPortal", "hostname, port")
IscsiTarget = namedtuple("IscsiTarget", "portal, tpgt, iqn")
+DEFAULT_TPGT = 1
ISCSI_DEFAULT_PORT = 3260
SCAN_PATTERN = "/sys/class/scsi_host/host*/scan"
@@ -144,7 +145,15 @@
def addIscsiNode(iface, target, credentials=None):
targetName = target.iqn
- portalStr = "%s:%d" % (target.portal.hostname, target.portal.port)
+
+ # 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:
@@ -165,7 +174,12 @@
def removeIscsiNode(iface, target):
targetName = target.iqn
- portalStr = "%s:%d" % (target.portal.hostname, target.portal.port)
+
+ # Basically this command deleting a node record (see addIscsiNode).
+ # Once we create a record in the new style format by specifying a tpgt,
+ # we delete it in the same way.
+ portalStr = "%s:%d,%d" % (target.portal.hostname, target.portal.port,
+ target.tpgt)
with _iscsiadmTransactionLock:
try:
iscsiadm.node_disconnect(iface.name, portalStr, targetName)
--
To view, visit http://gerrit.ovirt.org/26658
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I11a6a556d31524f4fae4786f5735accaf1cefb34
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
More information about the vdsm-patches
mailing list