Juan Hernandez has posted comments on this change.

Change subject: API: Vm Init - new Feature
......................................................................


Patch Set 17:

(2 comments)

http://gerrit.ovirt.org/#/c/23021/17/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
File 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd:

Line 2485:   <xs:complexType name="Initialization">
Line 2486:       <xs:sequence>
Line 2487:         <xs:element name="configuration" type="Configuration" 
minOccurs="0" maxOccurs="1"/>
Line 2488:         <xs:element name="cloud_init" type="CloudInit" minOccurs="0" 
maxOccurs="1"/>
Line 2489:         <xs:element name="hostname" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
> Done
Patch set 18 doesn't contain these naming changes.
Line 2490:         <xs:element name="domain" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
Line 2491:         <xs:element name="timezone" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
Line 2492:         <xs:element name="authorized_keys" type="xs:string" 
minOccurs="0" maxOccurs="1"/>
Line 2493:         <xs:element name="regenerate_keys" type="xs:boolean" 
minOccurs="0" maxOccurs="1"/>


Line 2492:         <xs:element name="authorized_keys" type="xs:string" 
minOccurs="0" maxOccurs="1"/>
Line 2493:         <xs:element name="regenerate_keys" type="xs:boolean" 
minOccurs="0" maxOccurs="1"/>
Line 2494:         <xs:element name="dns_servers" type="xs:string" 
minOccurs="0" maxOccurs="1"/>
Line 2495:         <xs:element name="dns_search" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
Line 2496:         <xs:element ref="host_nics" minOccurs="0" maxOccurs="1"/>
> There is a nics/nic type that represent the guest nic!!!
Having three types to represent NICs (for different purposes) isn't a problem 
in my opinion. But this shouldn't result in also having three different tags. 
We should use the "nic" and "nics" tags for the initialization, not "guest_nic" 
and "guest_nics".

How would you extend the existing "NICs" type? I guess you will need to add the 
IP configuration, but that will also be confusing because NIC already has a 
reference to "network", which contains the IP configuration as well.

All in all, I think it is better to create new types for this. I suggest 
"GuestNic", or maybe "GuestNicConfiguration" (I admit that this is pretty 
similar to the VmInitNetwork type that you proposed initially). The name of 
this type is important, as it will be the name of the corresponding classes in 
the Python and Java SDK.

I suggest the following:

  <xs:complexType name="GuestNicConfiguration">
    <xs:sequence>
      <!-- The elements you need for this purpose. -->
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="GuestNicsConfiguration">
    <xs:sequence>
      <xs:element name="nic" type="GuestNicConfiguration" minOccurs="1" 
maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>

Then, in use this as follows inside the Initialization type:

  <xs:element name="nics" type="GuestNicsConfiguration" minOccurs="0" 
maxOccurs="1"/>

What is most important here is what is the final representation, which should 
be like this:

 <initialization>
    <nics>
      <nic>..</nic>
    </nics>
  </initialization>

Note that there is currently a constraint imposed by the generator of the 
Python SDK: each complex type has to be accompanied by a top level element 
definition, and the XML schema requires unique names for these attributes. So 
you need also the following top level declarations, even if you aren't going to 
use them:

  <xs:element name="guest_nic_configuration" type="GuestNicConfiguration"/>
  <xs:element name="guest_nics_configuation" type="GuestNicsConfiguration"/>
Line 2497:         <xs:element name="winkey" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
Line 2498:         <xs:element name="root_password" type="xs:string" 
minOccurs="0" maxOccurs="1"/>
Line 2499:         <xs:element name="custom_script" type="xs:string" 
minOccurs="0" maxOccurs="1"/>
Line 2500:       </xs:sequence>


-- 
To view, visit http://gerrit.ovirt.org/23021
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I817de4fd7c7efcc3740583ede7a96bd522015660
Gerrit-PatchSet: 17
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Ori Liel <ol...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to