δΊ 2014/1/29 0:02, Luiz Capitulino ει: > On Wed, 22 Jan 2014 11:07:24 -0500 > Luiz Capitulino <lcapitul...@redhat.com> wrote: > >> On Fri, 20 Dec 2013 13:23:06 +0800 >> Wenchao Xia <xiaw...@linux.vnet.ibm.com> wrote: >> >>> This series address two issues: >>> >>> 1. support using enum as discriminator in union. >>> For example, if we have following define in qapi schema: >>> { 'enum': 'EnumOne', >>> 'data': [ 'value1', 'value2', 'value3' ] } >>> >>> { 'type': 'UserDefBase0', >>> 'data': { 'base-string0': 'str', 'base-enum0': 'EnumOne' } } >>> >>> Before this series, discriminator in union must be a string, and a >>> hidden enum type as discriminator is generated. After this series, >>> qapi schema can directly use predefined enum type: >>> { 'union': 'UserDefEnumDiscriminatorUnion', >>> 'base': 'UserDefBase0', >>> 'discriminator' : 'base-enum0', >>> 'data': { 'value1' : 'UserDefA', >>> 'value2' : 'UserDefInherit', >>> 'value3' : 'UserDefB' } } >>> >>> The benefit is that every thing is defined explicitly in schema file, >>> the discriminator enum type can be used in other API define in schema, >>> and a compile time check will be put to verify the correctness according >>> to enum define. Currently BlockdevOptions used discriminator which can >>> be converted, in the future other union can also use enum discriminator. >> >> Applied to the qmp branch, thanks. > > Unfortunately this doesn't build anymore due to some block changes that > were merged. Can you please rebase it? > Sure. I just come back from vacation, will respin it.