On Mon, Apr 29, 2013 at 09:51:47AM -0600, Eric Blake wrote: > On 04/29/2013 03:27 AM, Paolo Bonzini wrote: > > Il 29/04/2013 09:21, Stefan Hajnoczi ha scritto: > >>> I'd really love to see us change 'BlockJobInfo' to use an enum for > >>> 'type', instead of its open-coded 'str'. Likewise, the block-job > >>> related events in QMP/qmp-events.txt should be updated to refer to the > >>> enum instead of also being open-coded 'str'. > >> > >> Since the block job QMP API has been in released I'm not sure changing > >> this is worthwhile. QEMU and libvirt would have to maintain > >> compatibility so the code will just be duplicated. > > > > I don't think this would change the actual data on the wire. However, > > it would let libvirt know the supported block job types by introspecting > > the enum. > > Until we have introspection, the point is moot. When we have > introspection, libvirt would much rather see an enum than a 'str'. I > see absolutely no back-compat problem in changing the code to be > type-safe prior to the point that introspection is added.
Okay, I haven't looked at how QAPI enums are implemented. If we can move from custom strings to enum without breaking existing libvirt, then great! Stefan