Bug 1926819

Summary: python-sdk iscsidiscover return iscsi_targets instead of iscsi_details
Product: [oVirt] ovirt-engine-sdk-python Reporter: Martin Necas <mnecas>
Component: CoreAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Guilherme Santos <gdeolive>
Severity: high Docs Contact:
Priority: high    
Version: 4.4.9CC: bugs, gdeolive, juan.hernandez, mperina, oliel
Target Milestone: ovirt-4.4.6Keywords: ZStream
Target Release: 4.4.11Flags: pm-rhel: ovirt-4.4+
gdeolive: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-ovirt-engine-sdk4-4.4.11 ovirt-engine-4.4.6.5 Doc Type: Release Note
Doc Text:
Host 'iscsi_discover' action has been deprecated. Host 'discover_iscsi' action has been added to replace it. The actions do the same thing but have different return values. 'discover_iscsi' returns the information in a 'iscsi_details' element. 'iscsi_discover' returns the information in a 'iscsi_targets' element. In summary, the action which should be used from now on is 'discover_iscsi'.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-05 05:36:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1922748    

Description Martin Necas 2021-02-09 14:11:32 UTC
Description of problem:
According to the documentation [1] the iscsi discovery should return iscsi_details, but for python sdk it only returns iscsi_targets.

[1] https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/HostService.java#L675-L698


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


How reproducible:


Steps to Reproduce:
1. Use iscsi discovery with python sdk 
Example from ansible module (https://github.com/oVirt/ovirt-ansible-collection/blob/master/plugins/modules/ovirt_host.py#L615-L623)
2. Check out the response
3.

Actual results:
Returns list of strings with iscsi targets

Expected results:
Return IscsiDetails

Additional info:

Comment 1 Ori Liel 2021-02-15 09:44:50 UTC
The reason for this bug is an architectural constraint in the SDKs, which denies the possibility to deprecate an output parameter of an action.

Due to this constraint, this patch:

  https://gerrit.ovirt.org/c/ovirt-engine-api-model/+/84198/

did not work as designed, resulting in this bugzilla.

Changing the SDK architecture to support deprecating output parameters of an action does not justify the ROI, as the present bug is only such case
in recent memory. Should additional cases present themselves, this decision will be reevaluated. 

  model patch:  https://gerrit.ovirt.org/c/ovirt-engine-api-model/+/113492
  engine patch: https://gerrit.ovirt.org/c/ovirt-engine/+/113493

Comment 2 Sandro Bonazzola 2021-04-15 07:09:19 UTC
All referenced patches are merged, can you please update on this bug status?

Comment 3 Guilherme Santos 2021-05-04 19:20:33 UTC
Verified on:
ovirt-engine-4.4.6.6-0.10.el8ev.noarch
ovirt-engine-sdk-python==4.4.12

Steps:
1. # cat test_iscsi.py
import ovirtsdk4 as sdk
import ovirtsdk4.types as otypes

connection = sdk.Connection(
    url='https://<engine-fqdn>/ovirt-engine/api',
    username='admin@internal',
    password=<password>,
    insecure=True,
    debug=True,
)

hosts_service = connection.system_service().hosts_service()
host_id = "b952649e-5c15-4f14-af8e-56e45fd01aab"
iscsi_targets = hosts_service.service(host_id).iscsi_discover(
    iscsi=otypes.IscsiDetails(
        port=3260,
        address=<iscsi-addr>,
    ),
)
print(iscsi_targets)
connection.close()
2. # python3 test_iscsi.py
['iqn.200...., 'iqn.200...., 'iqn.200..., 'iqn.200...]


Results:
iscsi targets discovered, via sdk, as expected

Comment 4 Sandro Bonazzola 2021-05-05 05:36:10 UTC
This bugzilla is included in oVirt 4.4.6 release, published on May 4th 2021.

Since the problem described in this bug report should be resolved in oVirt 4.4.6 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.