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

Bug 1488929

Summary: Add LUN storage domain via REST API is failing due to new required fields in the REST API
Product: [oVirt] ovirt-engine Reporter: Raz Tamir <ratamir>
Component: RestAPIAssignee: Tal Nisan <tnisan>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: amureini, bugs, ebenahar, juan.hernandez, lsvaty, mperina, oliel, ratamir, tnisan
Target Milestone: ovirt-4.2.0Keywords: Automation, Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 11:26:21 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:
Attachments:
Description Flags
server.log none

Description Raz Tamir 2017-09-06 13:23:43 UTC
Created attachment 1322666 [details]
server.log

Description of problem:
Extending a storage domain via rest api is failing with:

<html>
    <head>
        <title>Error</title>
    </head>
    <body>Internal Server Error</body>
</html>

in server.log:
2017-09-06 16:15:22,815+03 ERROR [io.undertow.request] (default task-6) UT005023: Exception handling request to /ovirt-engine/api/v4/storagedomains/6f8d8a11-71d3-4b19-b8e0-e33ed0834b95: java.lang.RuntimeException: 
org.jboss.resteasy.spi.UnhandledException: org.ovirt.api.metamodel.server.ValidationException: Parameter 'storage_domain.storage.logical_units.vendor_id' is mandatory but was not provided.

which is a new mandatory parameter as in 4.1 everything is working fine.

The request:
POST to /api/storagedomains/6f8d8a11-71d3-4b19-b8e0-e33ed0834b95

<storage_domain>
    <storage>
        <logical_units>
            <logical_unit id="{LUN_ID}">
                <address>{SERVER_IP}</address>
                <port>3260</port>
                <target>{TARGET_IQN}</target>
            </logical_unit>
        </logical_units>
        <override_luns>true</override_luns>
        <type>iscsi</type>
    </storage>
    <host>
        <name>host_mixed_3</name>
    </host>
</storage_domain>


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


How reproducible:


Steps to Reproduce:
1. Create a storage domain
2. Attach it to a data center (already initialized)
3. Activate it
4. Extend it via rest api - command above

Actual results:



Expected results:


Additional info:

Comment 1 Tal Nisan 2017-09-07 13:06:47 UTC
Juan, I don't see anything that was changed in the code that may have caused it, where is this validation taking place?

Comment 2 Juan Hernández 2017-09-07 13:44:55 UTC
We have recently enabled a mechanism that enforces the constraints that are described in the specification of the API. In this particular case it is enforcing the following constraints:

  https://github.com/oVirt/ovirt-engine-api-model/blob/867812110f93cb168221ce1e747009690a5d5825/src/main/java/services/StorageDomainsService.java#L141-L160

That description was copied from the old "rsdl_metadata.yaml" file, which wasn't really checked or enforced.

To fix this issue we need to fix the constraints in the specification of the API. I, release a new version and then update the engine to use it.

The fix is to replace "mandatory" with "optional" for the attributes that aren't really mandatory.

Comment 3 Yaniv Kaul 2017-09-11 07:38:19 UTC
Raz, I assume that with storage_domain.storage.logical_units.vendor_id set, it works?

Comment 4 Raz Tamir 2017-09-11 09:29:59 UTC
With th vendor_id I now get:

2017-09-11 12:28:05,257+03 ERROR [io.undertow.request] (default task-10) UT005023: Exception handling request to /ovirt-engine/api/v4/storagedomains/68b2d50f-bc9d-4e41-bc41-ab7532449ee9: java.lang.RuntimeException:
 org.jboss.resteasy.spi.UnhandledException: org.ovirt.api.metamodel.server.ValidationException: Parameter 'storage_domain.storage.logical_units.username' is mandatory but was not provided.

Comment 5 Yaniv Kaul 2017-09-11 09:33:53 UTC
(In reply to Raz Tamir from comment #4)
> With th vendor_id I now get:
> 
> 2017-09-11 12:28:05,257+03 ERROR [io.undertow.request] (default task-10)
> UT005023: Exception handling request to
> /ovirt-engine/api/v4/storagedomains/68b2d50f-bc9d-4e41-bc41-ab7532449ee9:
> java.lang.RuntimeException:
>  org.jboss.resteasy.spi.UnhandledException:
> org.ovirt.api.metamodel.server.ValidationException: Parameter
> 'storage_domain.storage.logical_units.username' is mandatory but was not
> provided.

And with storage_domain.storage.logical_units.username, it works?

(Long story short, when all parameters are provided, is the functionality working?)

Comment 6 Raz Tamir 2017-09-11 11:25:31 UTC
Yes, the functionality is working with the listed parameters as mendatory:

vendor_id
username
serial
product_id
portal
password
paths
lun_mapping

Comment 7 Fred Rolland 2017-09-13 07:08:31 UTC
Juan hi,

The fix in the model is merged.
Is the update of the engine pom should be part of this bug ?
Thanks

Comment 8 Martin Perina 2017-09-13 08:26:33 UTC
(In reply to Fred Rolland from comment #7)
> Juan hi,
> 
> The fix in the model is merged.
> Is the update of the engine pom should be part of this bug ?
> Thanks

Not necessary, Ori will release new version of the model and bump engine dependency.

Comment 9 Raz Tamir 2017-09-13 08:44:18 UTC
*** Bug 1491169 has been marked as a duplicate of this bug. ***

Comment 10 Juan Hernández 2017-09-13 16:49:00 UTC
Version 4.2.18 of the model, containing this fix, has been released. The engine does now need to be updated to use that version of the model:

  restapi: Update to version 4.2.18 of the model
  https://gerrit.ovirt.org/81717

That completes the fix for this issue.

Comment 11 Martin Perina 2017-09-13 17:35:29 UTC
(In reply to Juan Hernández from comment #10)
> Version 4.2.18 of the model, containing this fix, has been released. The
> engine does now need to be updated to use that version of the model:
> 
>   restapi: Update to version 4.2.18 of the model
>   https://gerrit.ovirt.org/81717
> 
> That completes the fix for this issue.

Merged

Comment 12 Raz Tamir 2017-09-24 07:28:36 UTC
Verified on ovirt-engine-4.2.0-0.0.master.20170921184504.gitfcfc9a7.el7.centos

Add iSCSI storage domain from Targets -> LUNs works fine

Comment 13 Raz Tamir 2017-09-24 07:43:17 UTC
comment #12 is a mistake

Verified on ovirt-engine-4.2.0-0.0.master.20170921184504.gitfcfc9a7.el7.centos

Extend storage domain works as usual with <target>, <address> and <port> as mandatory

Comment 14 Sandro Bonazzola 2017-12-20 11:26:21 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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