Bug 1039921 - [REST API] Network object has no attribute ID [NEEDINFO]
Summary: [REST API] Network object has no attribute ID
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 3.3.0
Assignee: Ori Liel
QA Contact: Ilanit Stein
URL:
Whiteboard: virt
Depends On: 1040513
Blocks: 3.3rc1
TreeView+ depends on / blocked
 
Reported: 2013-12-10 10:19 UTC by Ilanit Stein
Modified: 2015-09-09 09:18 UTC (History)
17 users (show)

Fixed In Version: is27
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-21 22:18:13 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:
michal.skrivanek: needinfo?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 22298 0 None None None Never
oVirt gerrit 22302 0 None None None Never

Description Ilanit Stein 2013-12-10 10:19:50 UTC
Description of problem:
During regression VM test, run on SDK engine, "Add nic to VM" action succeed, but fail on sdk verification:

2013-12-09 16:56:44,490 - MainThread - nics - ERROR - Element '<ovirtsdk.infrastructure.brokers.VMNic object at 0x81f7ad0>' has no attribute 'boot_protocol'
2013-12-09 16:56:44,491 - MainThread - nics - ERROR - Element '<ovirtsdk.infrastructure.brokers.VMNic object at 0x81f7ad0>' has no attribute 'on_boot'

Test link:
http://jenkins.qa.lab.tlv.redhat.com:8080/view/Compute/view/3.3-git/view/Virt/job/3.3-git-compute-virt-reg_vms-sdk-nfs/18/testReport/junit/Vms/169-Add%20NIC%20to%20VNC%20VM%20to%20allow%20boot/Add_NIC_to_VNC_VM_to_allow_boot/


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

Additional info:
Same test, running on rest engine PASS on is26.

Comment 1 Omer Frenkel 2013-12-10 10:38:03 UTC
from the reporter i understand this doesnt happen when just using the rest-api, only when using the sdk:

"
Additional info:
Same test, running on rest engine PASS on is26.
"

it seems this only affect sdk somehow, can you please re-check?

Comment 2 Michael Pasternak 2013-12-10 10:47:59 UTC
(In reply to Omer Frenkel from comment #1)
> from the reporter i understand this doesnt happen when just using the
> rest-api, only when using the sdk:
> 
> "
> Additional info:
> Same test, running on rest engine PASS on is26.
> "
> 
> it seems this only affect sdk somehow, can you please re-check?

it cannot be the case as sdk does not mandate any parameters, so either
reported use-case is incorrect or sdk does not have mentioned attributes yet
(which i believe the case), but then how can it fail regression tests ...

Comment 3 Ilanit Stein 2013-12-11 10:12:20 UTC
masayag\imeerovi info:
>
> It seems that the latest patch to api.xsd of cloud-init introduced
> 'CloudInit' element which contains an internal "network" element.
>
> The ART generateDS.py generates a data-structure which contains the
> entities map. Since the 'network' map is defined twice in the api.xsd
> (as a main entity and as the cloud-init entity), the entity is
> overridden in that map, cause the network to be mapped to the cloud-init
> network type.
>
> There are 2 possible solutions:
> 1. Modify the generateDS to create a type as the
> outerElementName-innerElementName (ART responsibility)

here is problematic stuff:

  <xs:complexType name="CloudInit">
    <xs:sequence>
      <xs:element ref="host" minOccurs="0"/>
      <xs:element name="network" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element ref="nics" minOccurs="0"/>
            <xs:element ref="dns" minOccurs="0"/>
          xs:sequence>
        xs:complexType>
      xs:element>
      <xs:element ref="authorized_keys" minOccurs="0"/>
      <xs:element name="regenerate_ssh_keys" type="xs:boolean" minOccurs="0"/>
      <xs:element name="timezone" type="xs:string" minOccurs="0"/>
      <xs:element ref="users" minOccurs="0"/>
      <xs:element ref="files" minOccurs="0" maxOccurs="1"/>
    xs:sequence>
  xs:complexType>

It doesn't sounds good to define elements with the same name twice
so it looks that cloud init feature owner should fix it ....

> 2. Extract the inner type into a complex type which will require an
> explicit unique name. (cloud init feature owner responsibility)
>
> Or any other alternative that might fix this, as I'm not familiar
> on any restriction of element declaration within the api.xsd.
>
> Regards,
> Moti

Comment 4 Ilanit Stein 2013-12-11 10:18:48 UTC
More info:

Details for tha patch mentioned in comment #3:"
"restapi: cloud-init - rest api for start vm" http://gerrit.ovirt.org/#/c/15537/

This change fail REST tests, as well as SDK tests:
=================================================

REST fail on: 
------------
Network object has no attribute ID

SDK fail on:
-----------
Same here only on SDK (REST is OK)
2013-12-10 08:24:09,870 - MainThread - nics - ERROR - Element
'<ovirtsdk.infrastructure.brokers.VMNic object at 0x7dd8c50>' has no
attribute 'comment'
2013-12-10 08:24:09,871 - MainThread - nics - INFO - Property
'nic->name' has correct value: nic3
2013-12-10 08:24:09,871 - MainThread - nics - ERROR - Element
'<ovirtsdk.infrastructure.brokers.VMNic object at 0x7dd8c50>' has no
attribute 'boot_protocol'
2013-12-10 08:24:09,871 - MainThread - nics - ERROR - Element
'<ovirtsdk.infrastructure.brokers.VMNic object at 0x7dd8c50>' has no
attribute 'on_boot'
2013-12-10 08:24:09,871 - MainThread - nics - ERROR - Element
'<ovirtsdk.infrastructure.brokers.VMNic object at 0x7dd8c50>' has no
attribute 'vnic_profile'
2013-12-10 08:24:09,872 - MainThread - nics - ERROR - Element
'<ovirtsdk.xml.params.Network object at 0x7dd8e90>' has no attribute
'comment'
2013-12-10 08:24:09,872 - MainThread - nics - ERROR - Element
'<ovirtsdk.xml.params.Network object at 0x7dd8e90>' has no attribute
'profile_required'

Comment 5 Ilia Meerovich 2013-12-11 10:28:09 UTC
This issue could be reproduced by any engine in ART since we are failing on validation. It occurs because tests are using (hard-coded) Network object from data_structures.py (generated from api.xsd by generateDS.py).

However ART validation of structure of api responce is done vs networkType object (cloudInit one). It happens because ART is using ClassesMapping in order to know which which object should be chosen.

So in this case, because of double declaration of Network entity, ClassesMapping becomes corrupted (generateDS overrides network mapping)

ART validation revealed that api has double declaration of Network object (one inside cloudInit and one in outer level).

Comment 6 Michal Skrivanek 2013-12-11 13:12:57 UTC
(In reply to Ilanit Stein from comment #3)
we like the first option. The parser should handle same named entities if they are at different hierarchy level. There's nothing wrong with the XSD

For now either a quick hack to ART or disabling the test, I guess

Comment 8 Michael Pasternak 2013-12-11 14:14:47 UTC
(In reply to Michal Skrivanek from comment #6)
> (In reply to Ilanit Stein from comment #3)
> we like the first option. The parser should handle same named entities if
> they are at different hierarchy level. There's nothing wrong with the XSD
> 
> For now either a quick hack to ART or disabling the test, I guess

Michal,

xsd is wrong indeed, i've put Ori to help you out with this.

Comment 9 Michael Pasternak 2013-12-11 14:15:49 UTC
please also include this [1] fix, it's addresses issue in RSDL metadata.

[1] http://gerrit.ovirt.org/#/c/22249/

Comment 10 Michal Skrivanek 2013-12-11 16:44:54 UTC
ok, bug is merged even though I think we didn't do the right, the only thing comforting me is we're going to deprecate it in next release:-)

Comment 11 Ilanit Stein 2013-12-15 09:08:23 UTC
Verified on is27. Both rest &sdk problems resolved.

Comment 12 Itamar Heim 2014-01-21 22:18:13 UTC
Closing - RHEV 3.3 Released

Comment 13 Itamar Heim 2014-01-21 22:24:37 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.