Dominik Holler has uploaded a new change for review.
Change subject: storage: Extend the API for IPv6 iSCSI targets ......................................................................
storage: Extend the API for IPv6 iSCSI targets
A new parameter is introduced in the API, to explicitly indicate the capability of the client to handle IPv6 iSCSI targets. This parameter is used to present IPv6 iSCSI targets only to clients, which has this capability.
Change-Id: Iecb45e326d9c551fb636f309f9e945023143dd9c Bug-Url: https://bugzilla.redhat.com/1308306 Signed-off-by: Dominik Holler dholler@redhat.com --- M lib/api/vdsm-api.yml M lib/vdsm/rpc/bindingxmlrpc.py M vdsm/API.py M vdsm/storage/hsm.py 4 files changed, 18 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/65794/1
diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml index f311b17..d0e5a20 100644 --- a/lib/api/vdsm-api.yml +++ b/lib/api/vdsm-api.yml @@ -7713,6 +7713,11 @@ description: The password associated with the given username name: password type: string + + - defaultvalue: false + description: If true, the returned list includes porals on IPv6 + name: ipv6Targets + type: boolean return: description: 'A list of discovered targets in the form: ''<host>:<port>,<tpgt><iqn>''' diff --git a/lib/vdsm/rpc/bindingxmlrpc.py b/lib/vdsm/rpc/bindingxmlrpc.py index b8bb3f6..f747304 100644 --- a/lib/vdsm/rpc/bindingxmlrpc.py +++ b/lib/vdsm/rpc/bindingxmlrpc.py @@ -984,8 +984,10 @@
def iscsiDiscoverSendTargets(self, con, options=None): con = protect_passwords(con) + ipv6Targets = con['ipv6Targets'] if 'ipv6Targets' in con else False iscsiConn = API.ISCSIConnection(con['connection'], con['port'], - con['user'], con['password']) + con['user'], con['password'], + ipv6Targets) return iscsiConn.discoverSendTargets()
def vgCreate(self, name, devlist, force=False): diff --git a/vdsm/API.py b/vdsm/API.py index f000297..da80afe 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1012,18 +1012,20 @@
class ISCSIConnection(APIBase): - ctorArgs = ['host', 'port', 'user', 'password'] + ctorArgs = ['host', 'port', 'user', 'password', 'ipv6Targets']
- def __init__(self, host, port, user="", password=""): + def __init__(self, host, port, user="", password="", ipv6Targets=False): APIBase.__init__(self) self._host = host self._port = port self._user = user self._pass = password + self._ipv6Targets = ipv6Targets
def discoverSendTargets(self): params = {'connection': self._host, 'port': self._port, - 'user': self._user, 'password': self._pass} + 'user': self._user, 'password': self._pass, + 'ipv6Targets': self._ipv6Targets} return self._irs.discoverSendTargets(params)
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index e472b1c..9d5f97d 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -2915,6 +2915,7 @@ """ ip = con['connection'] port = int(con['port']) + ipv6Targets = con['ipv6Targets'] username = con['user'] password = con['password'] if username == "": @@ -2937,9 +2938,10 @@ fullTargets = [] partialTargets = [] for target in targets: - fullTargets.append(iscsi.getTargetString(target.portal, - target.tpgt, target.iqn)) - partialTargets.append(target.iqn) + if ipv6Targets or not target.portal.startswith("["): + fullTargets.append(iscsi.getTargetString(target.portal, + target.tpgt, target.iqn)) + partialTargets.append(target.iqn)
return dict(targets=partialTargets, fullTargets=fullTargets)