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

Bug 1104085

Summary: add new DataCenter mandatory/optional arguments discrepancy.
Product: Red Hat Enterprise Virtualization Manager Reporter: Martin Mucha <mmucha>
Component: ovirt-engine-restapiAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: acanan, amureini, bazulay, emesika, gklein, iheim, juan.hernandez, oramraz, rbalakri, Rhev-m-bugs, scohen, tnisan, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: ovirt-3.5.0-beta2 Doc Type: Bug Fix
Doc Text:
Cause: The concept of the type of storage of a Data Center has been removed, and replaced by the concept of "local" or "shared" Data Centers. A "local" Data Center may use any kind of locally attached storage. A "shared" Data Center may use any kind of network attached storage (NFS, for example) or storage are network (iSCSI or Fibre Channel, for example). In the RESTAPI this new concept is represented by a new "local" element inside the "data_center" element. Its value should be "true" or "false". This new "local" element isn't correctly documented in the RSDL of the RESTAPI, it should be documented as mandatory for creating a new Data Center but it is documented as optional. Consequence: Calls to the RESTAPI that don't include the new "local" element will unexpectedly fail. Fix: Document the new "local" element as mandatory. Result: The RSDL will explicitly indicate that the new "local" element is mandatory.
Story Points: ---
Clone Of: Environment:
Last Closed: 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:
Bug Depends On:    
Bug Blocks: 1142923, 1156165    

Description Martin Mucha 2014-06-03 09:08:17 UTC
Description of problem:

following operation definition from rsdl_metadata.yaml is not valid.
* datacenter.version.major: 'xs:int' and datacenter.version.minor: 'xs:int' isn't actually mandatory — when called without them, code will neigher complaint nor fail.
*  datacenter.local: xs:boolean  is actually mandatory, since call will fail when not specified. That makes it mandatory argument *and* probably corrupts backward compatibility, since formerly optional argument is now mandatory.


- name: /datacenters|rel=add
  description: add a new data center to the system
  request:
    body:
      parameterType: DataCenter
      signatures:
      - mandatoryArguments: {datacenter.name: 'xs:string', datacenter.version.major: 'xs:int', datacenter.version.minor: 'xs:int'}
        optionalArguments:
          datacenter.storage_type--DEPRECATED: xs:string
          datacenter.local: xs:boolean
          datacenter.description: xs:string
          datacenter.comment: xs:string
          datacenter.storage_format: xs:string
        description: add a new data center to the system
    urlparams: {}
    headers:
      Content-Type: {value: application/xml|json, required: true}
      Expect: {value: 201-created, required: false}
      Correlation-Id: {value: 'any string', required: false}
Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. issue respective posts (which probably should be puts) to .../api/datacenters

Comment 1 Juan Hernández 2014-06-03 18:18:46 UTC
Eli, I think that the version has been made optional in the backend recently. Can you update the RESTAPI metadata as well?

Comment 2 Juan Hernández 2014-06-03 18:20:37 UTC
Tal, I'm not sure about the "local" property, we are explicitly checking it, but only if not present, that is a bit strange. I guess that it is mandatory in the backend. Can you confirm?

Comment 3 Juan Hernández 2014-06-03 18:22:06 UTC
I'm changing the bug to the storage whiteboard because I think that the more relevant issue here is the mandatory/optional status of the "local" property.

Comment 4 Tal Nisan 2014-06-05 08:54:25 UTC
It is mandatory basically since we need to know whether it's a local DC or a shared one, we can have a default behavior and then make it optional

Comment 5 Juan Hernández 2014-06-05 09:02:05 UTC
Then we need to fix the RSDL metadata, something like this:

diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index 40b331f..8091876 100644
--- a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -1937,10 +1937,9 @@ actions:
     body:
       parameterType: DataCenter
       signatures:
-      - mandatoryArguments: {datacenter.name: 'xs:string', datacenter.version.major: 'xs:int', datacenter.version.minor: 'xs:int'}
+      - mandatoryArguments: {datacenter.name: 'xs:string', datacenter.version.major: 'xs:int', datacenter.version.minor: 'xs:int', datacenter.local: 'xs:boolean'}
         optionalArguments:
           datacenter.storage_type--DEPRECATED: xs:string
-          datacenter.local: xs:boolean
           datacenter.description: xs:string
           datacenter.comment: xs:string
           datacenter.storage_format: xs:string

Comment 6 Juan Hernández 2014-07-11 11:11:36 UTC
According to the previous comments the version number is optional and the "local" attribute is mandatory.

Comment 7 Raz Tamir 2014-07-29 08:58:32 UTC
Verified - 
POST body: (No local)

<data_center>
<name>dc1</name>
<storage_format>v3</storage_format>
</data_center>

Response body:

<fault>
<reason>Incomplete parameters</reason>
<detail>DataCenter [local] required for add</detail>
</fault>

Comment 8 Tal Nisan 2014-11-26 11:39:54 UTC
Please supply doc text

Comment 9 Allon Mureinik 2015-02-16 19:13:27 UTC
RHEV-M 3.5.0 has been released, closing this bug.

Comment 10 Allon Mureinik 2015-02-16 19:13:28 UTC
RHEV-M 3.5.0 has been released, closing this bug.