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

Bug 1688982

Summary: [IPv6] REST API incorrectly reports the address of an NFS storage domain if it contains an IPv6 address
Product: [oVirt] ovirt-engine Reporter: Simone Tiraboschi <stirabos>
Component: RestAPIAssignee: shani <sleviim>
Status: CLOSED CURRENTRELEASE QA Contact: Avihai <aefrat>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.3.0CC: aefrat, bugs, lleistne, tnisan
Target Milestone: ovirt-4.3.5Flags: pm-rhel: ovirt-4.3+
Target Release: 4.3.5.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.3.5.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-30 14:08:22 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 2019-03-14 20:12:41 UTC
Description of problem:
I successfully created an NFS storage domain on
[2607:fc30:100:1000::200]:/storage/nfs/he1

In the web UI I correctly see:
Path:
[2607:fc30:100:1000::200]:/storage/nfs/he1

and we have the right path at DB level:
[root@enginevm tmp]# sudo -u postgres scl enable rh-postgresql10 -- psql -d engine -c "SELECT connection FROM storage_domains, storage_server_connections WHERE storage_domains.storage=storage_server_connections.id AND storage_domains.id='2e69ae05-879b-4f21-ad6b-cf86837396c8'"
                 connection                 
--------------------------------------------
 [2607:fc30:100:1000::200]:/storage/nfs/he1


But if I query it with REST API I get:
[stirabos@t470s ~]$ curl -k --request GET --header 'Version: 4' --header 'Accept: application/xml' --user 'admin@internal:password' https://enginevm.localdomain/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storage_domain href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8" id="2e69ae05-879b-4f21-ad6b-cf86837396c8">
    <actions>
        <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/updateovfstore" rel="updateovfstore"/>
        <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/isattached" rel="isattached"/>
        <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/refreshluns" rel="refreshluns"/>
        <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/reduceluns" rel="reduceluns"/>
    </actions>
    <name>hosted_storage</name>
    <description></description>
    <comment></comment>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/storageconnections" rel="storageconnections"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/permissions" rel="permissions"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/templates" rel="templates"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/vms" rel="vms"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/disksnapshots" rel="disksnapshots"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/disks" rel="disks"/>
    <link href="/ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/diskprofiles" rel="diskprofiles"/>
    <available>102005473280</available>
    <backup>false</backup>
    <block_size>512</block_size>
    <committed>57982058496</committed>
    <critical_space_action_blocker>5</critical_space_action_blocker>
    <discard_after_delete>false</discard_after_delete>
    <external_status>ok</external_status>
    <master>true</master>
    <storage>
        <address>2607:fc30:100:1000::200</address>
        <mount_options></mount_options>
        <nfs_version>v4</nfs_version>
        <path>/storage/nfs/he1</path>
        <type>nfs</type>
    </storage>
    <storage_format>v4</storage_format>
    <supports_discard>false</supports_discard>
    <supports_discard_zeroes_data>false</supports_discard_zeroes_data>
    <type>data</type>
    <used>4294967296</used>
    <warning_low_space_indicator>10</warning_low_space_indicator>
    <wipe_after_delete>false</wipe_after_delete>
    <data_centers>
        <data_center href="/ovirt-engine/api/datacenters/9d5f8b68-4679-11e9-b9e5-00163e1f1bba" id="9d5f8b68-4679-11e9-b9e5-00163e1f1bba"/>
    </data_centers>
</storage_domain>


Please notice <address>2607:fc30:100:1000::200</address> without '[]' as required for an IPv6 address to escape the :.

And if I directly query the storage connection is even worst:
[stirabos@t470s ~]$ curl -k --request GET --header 'Version: 4' --header 'Accept: application/xml' --user 'admin@internal:password' https://enginevm.localdomain//ovirt-engine/api/storagedomains/2e69ae05-879b-4f21-ad6b-cf86837396c8/storageconnections
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storage_connections>
    <storage_connection href="/ovirt-engine/api/storageconnections/7c9af662-466f-4e43-9c1a-9c4bd5c24485" id="7c9af662-466f-4e43-9c1a-9c4bd5c24485">
        <address>[2607</address>
        <mount_options></mount_options>
        <nfs_version>v4</nfs_version>
        <path>fc30</path>
        <type>nfs</type>
    </storage_connection>
</storage_connections>



Version-Release number of selected component (if applicable):
ovirt-engine.noarch                      4.3.2.1-1.el7            @ovirt-4.3-pre

How reproducible:
100%

Steps to Reproduce:
1. create an NFS storage domain with an IPv6 address in the path
2. query it via rest API
3.

Actual results:
<address>2607:fc30:100:1000::200</address> without the required '[]' querying the storage domain;
<address>[2607</address> directly querying the storage connection.

Expected results:
<address>[2607:fc30:100:1000::200]</address>

Additional info:

Comment 1 Tal Nisan 2019-03-18 09:18:18 UTC
Shani you took care of a similar issue in a different path if I remember correctly, please have a look and fix the paths in the bug as well

Comment 2 Avihai 2019-07-07 12:44:10 UTC
Issue still there, reopening bug.(maybe the patch for 4.3 is missing ? I only see a master patch) 
Tried on ovirt-engine 4.3.5.2-0.1.el7.

Created a IPv6 NFS SD and queried API and address is displayed without the expected square brackets.

results:
<address>2620:52:0:2350:21b:21ff:fe75:35fb</address>

expected:
<address>[2620:52:0:2350:21b:21ff:fe75:35fb]</address>


REST request from browser:
https://storage-ge-08.scl.lab.tlv.redhat.com/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35

Response:
<storage_domain href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35" id="89ef6363-cfbb-4617-9380-e64b7beb8e35">
<actions>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/refreshluns" rel="refreshluns"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/isattached" rel="isattached"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/updateovfstore" rel="updateovfstore"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/reduceluns" rel="reduceluns"/>
</actions>
<name>nfs6</name>
<description/>
<comment/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/disks" rel="disks"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/templates" rel="templates"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/vms" rel="vms"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/storageconnections" rel="storageconnections"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/disksnapshots" rel="disksnapshots"/>
<link href="/ovirt-engine/api/storagedomains/89ef6363-cfbb-4617-9380-e64b7beb8e35/diskprofiles" rel="diskprofiles"/>
<available>1540819517440</available>
<backup>false</backup>
<block_size>512</block_size>
<committed>0</committed>
<critical_space_action_blocker>5</critical_space_action_blocker>
<discard_after_delete>false</discard_after_delete>
<external_status>ok</external_status>
<master>false</master>
<storage>
<address>2620:52:0:2350:21b:21ff:fe75:35fb</address>
<nfs_version>auto</nfs_version>
<path>/Storage_NFS/storage_local_ge8_nfs_4</path>
<type>nfs</type>
</storage>
<storage_format>v5</storage_format>
<supports_discard>false</supports_discard>
<supports_discard_zeroes_data>false</supports_discard_zeroes_data>
<type>data</type>
<used>1755567882240</used>
<warning_low_space_indicator>10</warning_low_space_indicator>
<wipe_after_delete>false</wipe_after_delete>
<data_centers>
<data_center href="/ovirt-engine/api/datacenters/aaf3a769-e9de-4d34-b69e-5a67a1d92064" id="aaf3a769-e9de-4d34-b69e-5a67a1d92064"/>
</data_centers>
</storage_domain>

Comment 3 shani 2019-07-07 13:22:40 UTC
(In reply to Avihai from comment #2)
> Issue still there, reopening bug.(maybe the patch for 4.3 is missing ? I
> only see a master patch) 
> Tried on ovirt-engine 4.3.5.2-0.1.el7.
> 
This patch was included only on master

Comment 5 Avihai 2019-07-14 06:11:41 UTC
Verified at ovirt-engine 4.3.5.4-0.1.el7


Details:
Created an IPv6 NFS SD and queried API and address is displayed with the expected square brackets.

https://storage-ge-04.scl.lab.tlv.redhat.com/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f

Relevant response address indeed with square brackets:
<address>[2620:52:0:2350:21b:21ff:fe75:35fb]</address>

Full response:
<storage_domain href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f" id="d97a8c40-cd44-4658-b8d3-fbfb91db0c3f">
<actions>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/reduceluns" rel="reduceluns"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/isattached" rel="isattached"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/updateovfstore" rel="updateovfstore"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/refreshluns" rel="refreshluns"/>
</actions>
<name>nfs_v6</name>
<description/>
<comment/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/disksnapshots" rel="disksnapshots"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/vms" rel="vms"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/storageconnections" rel="storageconnections"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/templates" rel="templates"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/diskprofiles" rel="diskprofiles"/>
<link href="/ovirt-engine/api/storagedomains/d97a8c40-cd44-4658-b8d3-fbfb91db0c3f/disks" rel="disks"/>
<available>1533303324672</available>
<backup>false</backup>
<block_size>512</block_size>
<committed>0</committed>
<critical_space_action_blocker>5</critical_space_action_blocker>
<discard_after_delete>false</discard_after_delete>
<external_status>ok</external_status>
<master>false</master>
<storage>
<address>[2620:52:0:2350:21b:21ff:fe75:35fb]</address>
<nfs_version>auto</nfs_version>
<path>/Storage_NFS/storage_local_ge4_nfs_4</path>
<type>nfs</type>
</storage>
<storage_format>v5</storage_format>
<supports_discard>false</supports_discard>
<supports_discard_zeroes_data>false</supports_discard_zeroes_data>
<type>data</type>
<used>1763084075008</used>
<warning_low_space_indicator>10</warning_low_space_indicator>
<wipe_after_delete>false</wipe_after_delete>
<data_centers>
<data_center href="/ovirt-engine/api/datacenters/469e97a8-d684-4cdd-a8de-9a5801661601" id="469e97a8-d684-4cdd-a8de-9a5801661601"/>
</data_centers>
</storage_domain>

Comment 6 Sandro Bonazzola 2019-07-30 14:08:22 UTC
This bugzilla is included in oVirt 4.3.5 release, published on July 30th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.5 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.