Paolo Bonzini <pbonzini(a)redhat.com> writes:
Il 27/02/2013 16:42, Anthony Liguori ha scritto:
> There's such thing as list support in QemuOpts. The only way
> QemuOptsVisitor was able to implement it was to expose QemuOpts publicly
> via options_int.h and rely on a implementation detail.
>
> There are fixed types supported by QemuOpts. It just so happens that
> whenever qemu_opt_set() is called, instead of replacing the last
> instance, the value is either prepended or appended in order to
> implement a replace or set-if-unset behavior.
Fair enough. Nobody said the implementation is pretty.
> If we want to have list syntax, we need to introduce first class support
> for it. Here's a simple example of how to do this.
If it is meant as a prototype only, and the final command-line syntax
would be with repeated keys, that's okay. I think that Eduardo/Markus/I
are focusing on the user interface, you're focusing in the
implementation.
No, I'm primarily motivated by the UI and am assuming that ya'll are
arguing based on the implementation today. Repeating keys is quite
mad. Here are some examples:
qemu -numa node=1,node=2,cpus=2,cpus=3
What would a user expect that that would mean. What about:
[numa]
node=1
cpus=2
cpus=3
qemu -readconfig numa.cfg -numa node=1,cpus=1
I'm pretty sure you won't be able to say without looking at the source
code.
Now what about ranges? I'm pretty sure that what a user really wants to
say is:
qemu -numa node=1,cpus=0-3:8-11
This is easy to do with the patch I sent. We can add range support
integer lists by just adding a check for '-' before doing dispatch.
That's a heck of a lot nicer than:
qemu -numa
node=1,cpus=0,cpus=1,cpus=2,cpus=3,cpus=8,cpus=9,cpus=10,cpus=11
With respect to escaping, for string lists (the only place where this
point is even relevant), we can simply support escaping. But I'd like
to hear a use-case for a string list first.
Regards,
Anthony Liguori
In the meanwhile, however, it seems to me that Eduardo can use
QemuOptsVisitor---which can also hide the details and provide type safety.
Paolo