Change in ovirt-engine-sdk-ruby[sdk_4.1]: Fix writing of lists of structs

Code Review gerrit at ovirt.org
Fri Feb 17 10:10:28 UTC 2017


>From Juan Hernandez <juan.hernandez at redhat.com>:

Juan Hernandez has submitted this change and it was merged.

Change subject: Fix writing of lists of structs
......................................................................


Fix writing of lists of structs

Currently when the type of an attribute is a list of structs, the SDK
generates the XML using the name of the attribute as the tag for the
list, and the same name in singular as the tag for the elements. For
example, for the Bonding.slaves attribute it generates the following:

  <bonding>
    <slaves>
      <slave>
        <name>eth0</name>
      </slave>
      <slave>
        <name>eth1</name>
      </slave>
    </slaves>
  </bonding>

But the server expects the name of the type of the element:

  <bonding>
    <slaves>
      <host_nic>
        <name>eth0</name>
      </host_nic>
      <host_nic>
        <name>eth1</name>
      </host_nic>
    </slaves>
  </bonding>

Note the use of 'host_nic' instead of 'slave'.

The behaviour of the SDK is conceptually more correct than the behaviour
of the server, but as we need to support the existing server, without
changes, we need to fix the SDK instead.

Change-Id: I98722ac732e1fd6a5e2212138890639e6784e5d6
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
(cherry picked from commit 3ba240f0c3f456d4ae81da9939fdbb314fa40eed)
---
M generator/src/main/java/org/ovirt/sdk/ruby/WritersGenerator.java
A sdk/spec/bonding_writer_spec.rb
2 files changed, 55 insertions(+), 7 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/72491
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I98722ac732e1fd6a5e2212138890639e6784e5d6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-ruby
Gerrit-Branch: sdk_4.1
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list