On 15/05/20 07:54, Markus Armbruster wrote: >> I don't see QemuOpts going away anytime soon, but I do see more QMP/QAPI >> and less command line in the future as far as management tools are >> concerned. QemuOpts and HMP will remain for direct usage, for the >> foreseeable future. > > I'd prefer not to have two separate configuration infrastructures.
We already have two, since the introduction of preconfig state. The question is more how to unify the code that implements them, than how to reduce them to one. For example, I can imagine (and have even discussed informally with John Snow) a patch series that starts by adding a new preconfig command: { 'execute': 'set-argv', 'arguments': { 'argv': [ '-m', '2048'] } } and progressively adds more preconfig commands until Libvirt can reasonably configure a VM without set-argv. An example implementation would be to special case chardev-add, object-add etc. to stash their arguments in a QAPI struct in preconfig mode, and the same for -chardev and -object. Then the big ugly setup code in main() would walk these structs instead of QemuOpts. Bingo: you have a QAPI-representable machine config. It may not be the nicest one (see the problems you raised in the past about chardev-add not using the latest and greatest QAPI features) but I would love to see a proof of concept for this. Thanks, Paolo