Bug 1802844

Summary: rest api setupnetworks: assignment_method should be inside ip_address_assignment
Product: Red Hat Enterprise Virtualization Manager Reporter: Germano Veit Michel <gveitmic>
Component: ovirt-engineAssignee: Ori Liel <oliel>
Status: CLOSED ERRATA QA Contact: Raul Aghayev <raghayev>
Severity: low Docs Contact:
Priority: medium    
Version: 4.3.7CC: dfodor, dholler, lleistne, mperina, mtessun
Target Milestone: ovirt-4.4.5Keywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.4.5.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-14 11:39:53 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:

Description Germano Veit Michel 2020-02-14 03:19:58 UTC
Description of problem:

From what I can tell the engine will only accept assignment_method if its inside 
ip_address_assignment, not in ip_address_assignments.

And it makes more sense, as one can have different assignment_method if configuring IPv4 and IPV6 at the same time, for example.

Version-Release number of selected component (if applicable):
rhvm-4.3.6.7-0.1.el7.noarch
ovirt-engine-api-explorer-0.0.4-1.el7ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. Navigate to /ovirt-engine/apidoc/#/services/host/methods/setup_networks

Actual results:

      <ip_address_assignments>
        <assignment_method>static</assignment_method>
        <ip_address_assignment>
          <ip>
            <address>192.168.122.10</address>
            <netmask>255.255.255.0</netmask>
          </ip>
        </ip_address_assignment>
      </ip_address_assignments>

Expected results:

      <ip_address_assignments>
        <ip_address_assignment>
          <assignment_method>static</assignment_method>
          <ip>
            <address>192.168.122.10</address>
            <netmask>255.255.255.0</netmask>
          </ip>
        </ip_address_assignment>
      </ip_address_assignments>

Additional info:

# /usr/bin/curl -k --header 'Accept: application/json' -u admin@internal:redhat --request 'POST' --header 'Content-Type: application/xml' --data "
> <action>
>   <modified_network_attachments> 
>     <network_attachment>
>       <network>
>           <name>san-1</name>
>       </network>
>       <host_nic>
>           <name>eth1</name>
>       </host_nic>
>       <ip_address_assignments>
>           <assignment_method>static</assignment_method>
>         <ip_address_assignment>
>           <ip>
>             <address>2::1</address>
>             <netmask>64</netmask>
>             <version>v6</version>
>           </ip>                
>         </ip_address_assignment>
>       </ip_address_assignments>
>     </network_attachment>
>   </modified_network_attachments>
> </action>                        
> " https://engine.kvm/ovirt-engine/api/hosts/a381fd69-cc2a-42c4-9040-f51a10c8945c/setupnetworks
{
  "detail" : "For correct usage, see: https://engine.kvm/ovirt-engine/apidoc#services/host/methods/setup_networks",
  "reason" : "Request syntactically incorrect."


# /usr/bin/curl -k --header 'Accept: application/json' -u admin@internal:redhat --request 'POST' --header 'Content-Type: application/xml' --data "
> <action>
>   <modified_network_attachments> 
>     <network_attachment>
>       <network>
>           <name>san-1</name>
>       </network>
>       <host_nic>
>           <name>eth1</name>
>       </host_nic>
>       <ip_address_assignments>
>         <ip_address_assignment>
>           <assignment_method>static</assignment_method>
>           <ip>
>             <address>2::1</address>
>             <netmask>64</netmask>
>             <version>v6</version>
>           </ip>                
>         </ip_address_assignment>
>       </ip_address_assignments>
>     </network_attachment>
>   </modified_network_attachments>
> </action>                        
> " https://engine.kvm/ovirt-engine/api/hosts/a381fd69-cc2a-42c4-9040-f51a10c8945c/setupnetworks
{
  "job" : {
    "href" : "/ovirt-engine/api/jobs/c268c8bd-5f78-4d00-b39a-9acac62ddc01",
    "id" : "c268c8bd-5f78-4d00-b39a-9acac62ddc01"
  },
  "modified_network_attachments" : {
    "network_attachment" : [ {
      "ip_address_assignments" : {
        "ip_address_assignment" : [ {
          "assignment_method" : "static",
          "ip" : {
            "address" : "2::1",
            "netmask" : "64",
            "version" : "v6"
          }
        } ]
      },
      "host_nic" : {
        "name" : "eth1"
      },
      "network" : {
        "name" : "san-1"
      }
    } ]
  },
  "status" : "complete"
}

Comment 3 Raul Aghayev 2021-03-17 13:22:52 UTC
Verified on ovirt-engine-4.4.5.9-0.1.el8ev.noarch

Comment 8 errata-xmlrpc 2021-04-14 11:39:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: RHV Manager (ovirt-engine) 4.4.z [ovirt-4.4.5] security, bug fix, enhancement), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHSA-2021:1169