Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1510860

Summary: Reports fullTargets on /hosts/123/iscsidiscover (iSCSI multipath)
Product: [oVirt] ovirt-engine Reporter: Simone Tiraboschi <stirabos>
Component: RestAPIAssignee: Ala Hino <ahino>
Status: CLOSED CURRENTRELEASE QA Contact: Natalie Gavrielov <ngavrilo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: 1142874971, ahino, amureini, bugs, juan.hernandez, khakimi, ngavrilo, ratamir, stirabos
Target Milestone: ovirt-4.2.0Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Cause: On a multipath iSCSI env, the same target that is exposed by multiple portals in the same target portal group Consequence: Only targets are listed w/o full details Fix: Add a new discoveredTargets that contains all details Result: <discovered_targets> <iscsi_details> <address>10.35.146.129</address> <port>3260</port> <portal>10.35.146.129:3260,1</portal> <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c00</target> </iscsi_details> <iscsi_details> <address>10.35.146.161</address> <port>3260</port> <portal>10.35.146.161:3260,1</portal> <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c01</target> </iscsi_details> <iscsi_details> <address>10.35.146.193</address> <port>3260</port> <portal>10.35.146.193:3260,1</portal> <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c04</target> </iscsi_details> <iscsi_details> <address>10.35.146.225</address> <port>3260</port> <portal>10.35.146.225:3260,1</portal> <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c05</target> </iscsi_details> </discovered_targets>
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-12 12:56:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Simone Tiraboschi 2017-11-08 10:32:53 UTC
Description of problem:
On a multipath iSCSI env, the same target could be exposed by multiple portals in the same target portal group.

In my example iqn.2017-10.com.redhat.stirabos:he is exposed over 192.168.1.125, 192.168.2.125 and 192.168.3.125 all three portals are part of the same target portal group (tpgt=1).

VDSM handles it as:
2017-11-08 09:55:52,008+0100 INFO  (jsonrpc/6) [vdsm.api] FINISH discoverSendTargets return={'fullTargets': ['192.168.1.125:3260,1 iqn.2017-10.com.redhat.stirabos:data', '192.168.2.125:3260,1 iqn.2017-10.com.redhat.stirabos:data', '192.168.3.125:3260,1 iqn.2017-10.com.redhat.stirabos:data', '192.168.1.125:3260,1 iqn.2017-10.com.redhat.stirabos:he', '192.168.2.125:3260,1 iqn.2017-10.com.redhat.stirabos:he', '192.168.3.125:3260,1 iqn.2017-10.com.redhat.stirabos:he'], 'targets': ['iqn.2017-10.com.redhat.stirabos:data', 'iqn.2017-10.com.redhat.stirabos:data', 'iqn.2017-10.com.redhat.stirabos:data', 'iqn.2017-10.com.redhat.stirabos:he', 'iqn.2017-10.com.redhat.stirabos:he', 'iqn.2017-10.com.redhat.stirabos:he']} from=::ffff:192.168.122.119,51488, flow_id=3de8a7ca-f4ba-4e99-9b02-e1bfe6b60a87, task_id=a0d8ac91-9ec1-4222-ae86-c5aeb4785a23 (api:52)

Where fullTargets contains also portal IP and tpgt info while targets lists contains just target iqn lists.

/hosts/123/iscsidiscover endpoint reports just targets list while fullTargets is needed on a multipath env.

Example (via ansible playbook):
TASK [debug] ******************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "iscsi_targets": {
        "changed": false, 
        "failed": false, 
        "id": "23d8555d-4d16-407e-ab6b-6f777ff20576", 
        "iscsi_targets": [
            "iqn.2017-10.com.redhat.stirabos:data", 
            "iqn.2017-10.com.redhat.stirabos:data", 
            "iqn.2017-10.com.redhat.stirabos:data", 
            "iqn.2017-10.com.redhat.stirabos:he", 
            "iqn.2017-10.com.redhat.stirabos:he", 
            "iqn.2017-10.com.redhat.stirabos:he"
        ]
    }
}



Version-Release number of selected component (if applicable):
4.2

How reproducible:
100%

Steps to Reproduce:
1. launch iSCSI discover from REST API (/hosts/123/iscsidiscover) on multipath env
2.
3.

Actual results:
Only targets list with duplicates is in the result

Expected results:
fullTargets with portal and tpgt info is there.

Additional info:
it's needed to enable iSCSI multipath

Comment 1 Juan Hernández 2017-11-08 10:41:02 UTC
I suggest that we deprecate the current `iscsi_targets` output parameter of the `iscsidiscover` operation, and replace it with a new one, maybe `discovered_targets`, that contains all the required details. We can use for that the existing `IscsiDetails` type:

  @Out IscsiDetails[] discoveredTargets();

Comment 2 Allon Mureinik 2017-11-08 14:30:00 UTC
Juan - can you explain why we should deprecate the current output parameter? Why not enhance it with the missing details?

Comment 3 Juan Hernández 2017-11-08 14:37:44 UTC
The current parameter is an array of strings:

  @Out String[] iscsiTargets();

We can't enhance it, it isn't possible to enhance strings, and we can't change the type because it breaks backwards compatibility.

Comment 4 Allon Mureinik 2017-11-08 14:42:44 UTC
(In reply to Juan Hernández from comment #3)
> The current parameter is an array of strings:
> 
>   @Out String[] iscsiTargets();
> 
> We can't enhance it, it isn't possible to enhance strings, and we can't
> change the type because it breaks backwards compatibility.
The was stupid of me...
Thanks!

Comment 5 Allon Mureinik 2017-11-08 14:43:01 UTC
Simone - my gut instinct is to defer this to 4.3. Is there a pressing need for it in 4.2 (e.g., as part of the HE work?)

Comment 6 Simone Tiraboschi 2017-11-08 16:50:51 UTC
(In reply to Allon Mureinik from comment #5)
> Simone - my gut instinct is to defer this to 4.3. Is there a pressing need
> for it in 4.2 (e.g., as part of the HE work?)

In the current hosted-engine-setup we are gathering fullTargets directly from vdsm and we are consuming also tpgt to enable multi-path connecting different targets over the different portals of a portal group.

We are working on a brand new hosted-engine-setup flow where we are using a locally running engine to bootstrap the system avoid directly interacting with vdsm (we could skip importing hosted engine stuff from the engine since everything is already there, we could have just one storage domain and so on...).
We want to replicate in the new flow whatever is in the current setup (possibly including iSCSI multi-path support).

Comment 7 Allon Mureinik 2017-11-09 12:13:03 UTC
Let's see if we it will make it for 4.2 then.

Ala - can you shortloop this please?

Comment 8 Ala Hino 2017-11-09 12:15:43 UTC
(In reply to Allon Mureinik from comment #7)
> Let's see if we it will make it for 4.2 then.
> 
> Ala - can you shortloop this please?

Ack - on it

Comment 9 Simone Tiraboschi 2017-11-09 12:37:19 UTC
Thanks Allon,
another thing before making you working for nothing.

In order to close the loop we have also to create the iSCSI storage domain, and we are trying to do it via ansible module, passing the different portal addresses plus the target portal group tag to the engine.

According to latest documentation ( http://docs.ansible.com/ansible/latest/ovirt_storage_domains_module.html ), ovirt_storage_domains ansible module for sure lacks this capability.
Maybe is worth also to double check that everything is there at API level.

Comment 10 Ala Hino 2017-11-15 15:24:15 UTC
@Simone,

Would the following info be enough?

<action>
    <discovered_targets>
        <iscsi_details>
            <address>10.35.1.72</address>
            <port>3260</port>
            <target>iqn.2015-08.com.ahino:444</target>
        </iscsi_details>
    </discovered_targets>
    <iscsi>
        <address>bs-scsi.usersys.redhat.com</address>
    </iscsi>
    <iscsi_targets>
        <iscsi_target>iqn.2015-08.com.ahino:444</iscsi_target>
    </iscsi_targets>
    <status>complete</status>
</action>

Comment 11 Ala Hino 2017-11-15 20:35:21 UTC
(In reply to Ala Hino from comment #10)
> @Simone,
> 
> Would the following info be enough?
> 
> <action>
>     <discovered_targets>
>         <iscsi_details>
>             <address>10.35.1.72</address>
>             <port>3260</port>
>             <target>iqn.2015-08.com.ahino:444</target>
>         </iscsi_details>
>     </discovered_targets>
>     <iscsi>
>         <address>bs-scsi.usersys.redhat.com</address>
>     </iscsi>
>     <iscsi_targets>
>         <iscsi_target>iqn.2015-08.com.ahino:444</iscsi_target>
>     </iscsi_targets>
>     <status>complete</status>
> </action>

Specifically, should 'portal', 'serial', 'productId', and 'vendorId' attributes be added?

Comment 12 Simone Tiraboschi 2017-11-15 21:04:15 UTC
(In reply to Ala Hino from comment #10)
> @Simone,
> 
> Would the following info be enough?

I think it still misses the tpgt (target portal group tag) field to match the portals of the same portal group.

> Specifically, should 'portal', 'serial', 'productId', and 'vendorId' attributes be added?

Maybe you are calling here 'portal' the 'tgpt' field, others are not relevant for hosted-engine-setup.

Comment 13 Ala Hino 2017-11-15 21:53:24 UTC
Will return the following:

        <iscsi_details>
            <address>10.35.1.72</address>
            <port>3260</port>
            <portal>10.35.1.72:3260,1</portal>
            <target>iqn.2015-08.com.ahino:444</target>
        </iscsi_details>

Please confirm that this is what you expect to get.

Comment 14 Simone Tiraboschi 2017-11-16 08:20:36 UTC
(In reply to Ala Hino from comment #13)
> Please confirm that this is what you expect to get.

Yes, it is. Thanks.

Comment 15 Natalie Gavrielov 2018-01-01 15:21:26 UTC
Verified using builds:
rhvm-4.2.0.2-0.1.el7.noarch
vdsm-4.20.9.3-1.el7ev.x86_64

Example output for iscsidiscover:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <discovered_targets>
        <iscsi_details>
            <address>1.2.3.4</address>
            <port>1234</port>
            <portal>1.2.3.4:1234,1</portal>
            <target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c00</target>
        </iscsi_details>
        <iscsi_details>
            <address>10.35.146.161</address>
            <port>1234</port>
            <portal>10.35.146.161:1234,1</portal>
            <target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c01</target>
        </iscsi_details>
        <iscsi_details>
            <address>10.35.146.193</address>
            <port>1234</port>
            <portal>10.35.146.193:1234,1</portal>
            <target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c04</target>
        </iscsi_details>
        <iscsi_details>
            <address>10.35.146.225</address>
            <port>1234</port>
            <portal>10.35.146.225:1234,1</portal>
            <target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c05</target>
        </iscsi_details>
    </discovered_targets>
    <iscsi>
        <address>1.2.3.4</address>
    </iscsi>
    <iscsi_targets>
        <iscsi_target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c00</iscsi_target>
        <iscsi_target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c01</iscsi_target>
        <iscsi_target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c04</iscsi_target>
        <iscsi_target>iqn.1234-01.com.xtremio:xio00123456789-514f0c50023f6c05</iscsi_target>
    </iscsi_targets>
    <status>complete</status>
</action>

Comment 16 Idan Shaby 2018-05-31 05:10:31 UTC
*** Bug 1264777 has been marked as a duplicate of this bug. ***

Comment 17 qiyue 2019-01-11 12:31:07 UTC
hosted-engine-setup
          Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs)[nfs]: iscsi
          Please specify the iSCSI portal IP address: 192.168.2.3
          Please specify the iSCSI portal port [3260]: 
          Please specify the iSCSI discover user: 
          Please specify the iSCSI discover password: 
          Please specify the iSCSI portal login user: 
          Please specify the iSCSI portal login password: 
[ INFO  ] Discovering iSCSI targets
[ INFO  ] TASK [Gathering Facts]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [include_tasks]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Obtain SSO token using username/password credentials]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Prepare iSCSI parameters]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Fetch host facts]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [iSCSI discover with REST API]
[ INFO  ] ok: [localhost]
          The following targets have been found:
          	[1]	iqn.2017-11.com.lenovo:target1
          		TPGT: 1, portals:
          			192.168.2.3:3260

but!!!!

Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs)[nfs]: iscsi
Please specify the iSCSI portal IP address: 192.168.2.3,192.168.2.4
Please specify the iSCSI portal port [3260]: 
...
[ INFO  ] Discovering iSCSI targets
[ INFO  ] TASK [Gathering Facts]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [include_tasks]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Obtain SSO token using username/password credentials]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Prepare iSCSI parameters]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [Fetch host facts]
[ INFO  ] ok: [localhost]
[ INFO  ] TASK [iSCSI discover with REST API]
[ ERROR ] fatal: [localhost]: FAILED! => {"changed": false, "connection": "close", "content": "{\n  \"detail\" : \"For correct usage, see: https://engine.tchyp.com/ovirt-engine/apidoc#services/host/methods/iscsi-discover\",\n  \"reason\" : \"Request syntactically incorrect.\"\n}", "content_encoding": "identity", "content_type": "application/json", "correlation_id": "ede67e4b-1e53-4b03-b00d-6fd48f711310", "date": "Fri, 11 Jan 2019 09:35:08 GMT", "json": {"detail": "For correct usage, see: https://engine.tchyp.com/ovirt-engine/apidoc#services/host/methods/iscsi-discover", "reason": "Request syntactically incorrect."}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips", "status": 400, "transfer_encoding": "chunked", "url": "https://engine.tchyp.com/tedge-engine/api/hosts/04b908b8-8b6e-4e6f-b9f1-5590fe7eb1ed/iscsidiscover"}
[ ERROR ] Unable to get target list
          Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs)[nfs]: 
......

why??
please tell me.thanks!