[Engine-devel] [ovirt-engine-sdk] some questions about the params.py code generated by generateSD
Michael Pasternak
mpastern at redhat.com
Sun Jun 10 06:49:52 UTC 2012
Hi,
On 06/07/2012 06:14 PM, ShaoHe Feng wrote:
> Hi all,
>
> as we all know the current params.py was not completely by the generateSD.py, there are parts that have to be updated manually.
>
> now I have post a primarypatch to improve it. http://gerrit.ovirt.org/#/c/4880/
>
(in review)
> it can generate some codes, but still two parts codes can not be generated.
>
> they aretwo dictionaries: _rootClassMap and _elementToClassMap.
>
> However, for I do get any clue to know these two dictionaries from the params.py.
>
> there are some questions:
> 1.
> And the __all__ list which include all the classes of _rootClassMap and _elementToClassMap.
> And there some classes both in _rootClassMap and _elementToClassMap.
>
> 2.
> And some of class in _rootClassMap inherit GeneratedsSuper class, some inherit BaseResource class, and two classes inherit Link class.
> And it is the same with _elementToClassMap.
>
> so what is the difference between _rootClassMap and _elementToClassMap.
> What rule to generate these two dictionaries.
_elementToClassMap no longer relevant, you can place everything in _rootClassMap
>
> 3.
> And also, how to generate the keys in _rootClassMap and _elementToClassMap.Any rule to generate them?
you can traverse all elements in the schema creating data structure where key is the type of the
schema element and value is the element name, for instance:
<xs:element name="special_objects" type="SpecialObjects"/>
_element_type_to_name_map {SpecialObjects, special_objects},
this way later when you go over items in __all__ [1] list, you can use each item as key
at _element_type_to_name_map to retrieve element name="special_objects".
[1] __all__ = [..., "SpecialObjects", ...]
>
> there are some items in these two dictionaries
>
> "access_control_list" : AccessControlList, # "_" among the word in key
> "api" : API,
> "body" : Body,
> "iscsi" : IscsiDetails, # key "iscsi" is one part of value "IscsiDetails"
> "storage_domain" : StorageDomain,
> "topology" : CpuTopology,
> "creation_status" : Status, # key has a more word "creation" than the value.
> "parent" : TagParent
>
>
>
>
>
>
>
>
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Engine-devel
mailing list