Michael Pasternak has posted comments on this change.

Change subject: codegen: Only top level elements in root class map
......................................................................


Patch Set 1:

> I don't see where in the CLI we use the findRootClass method, so a 
> modification
> there won't affect the CLI.

it has types caching based on this map, storing only root types in this map 
will make
both cli and user unable to determinate the type of internal elements of sdk 
objects

> Letting the users use that findRootClass method ins't good idea either,

users have to have ability to map elemnts to types and exactly for that
reason this map exist Map<elemntName, elementType> and it autogenerated
along with sdk cause we have this info at codegen

> as it won't work correctly if the same element name is used for more than one 
> type,
> as it is the case with the recent changes in the XML schema.

of course, this is why you have to prevent the ambiguity at naming different 
elements which are point to different types the same

>
>The use of this map should be limited to what its name indicates: locating the 
>*root* class name.

i think i failed explaining this constraint, lets start from the beginning:

(i'm using same example from the sdk-wiki)

lets say you want to create a vm, vms.add() help has this argument:

[@param vm.cpu.topology.cores: int]

1. so first you create a vm, vm=params.VM(), note VM is initiated but all it's 
internal attributes are None at this stage

2. then you want to create a topology class to assign to vm,
but how do you know what the type of this 'topology' attribute?

you cannot know what type to create unless you use findRootClass():

topology = params.findRootClass("topology") 

** in this case will be returned CpuTopology type.

3. assign topology to vm

vm.set_topology(topology)

i'm admin the name a bit missleading, but i think you understand the
concept by now, i.e not storing internal types in RootClass map is not
fixing your bug, but hiding it and causing regression in another area,
while real problem in duplicate element name in the api.xsd of REST-API

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifcdefe71f3d15ab0da841f35b4b94916d19d950d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mishka8...@yahoo.com>
Gerrit-Reviewer: Ravi Nori <rn...@redhat.com>
Gerrit-HasComments: No
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to