On 02/26/2014 11:25 AM, Paolo Bonzini wrote:
Hi all,
this is a proposal for a small extension to the cartesian config format.
The inspiration for this proposal came from the periodic need to add
"only" or "no" directives to custom cartesian configs, when new variants
are added to the base shared configuration files like guest-hw.cfg. The
aim of this proposal is to let virt-test developers add as many such
variants to guest-hw.cfg as they want, without disrupting carefully
custom cartesian configs.
That is a great goal to accomplish.
The trick is to redefine the meaning of "@" from just "hide the item
when printing the cartesian tuple" to "only use this item unless
otherwise instructed". There are two parts in realizing this.
First, two new keywords are introduced, "requires" and "conflicts". In
this first step, these keywords are the same as "only" and "no"
respectively. Later, "only" and "no" will get extra behavior that make
them more appropriate for user-provided (or testrunner-provided)
cartesian configuration. So, as part of this step, all generic
virt-test configuration files (tests and files in shared/cfg) will be
changed to use "requires" and "conflicts". For example:
variants:
- @i440fx:
only i386, x86_64
machine_type = pc
- q35:
only i386, x86_64
no ide
machine_type = q35
- @pseries:
only ppc64
machine_type = pseries
should be rewritten as follows:
variants:
- @i440fx:
requires i386, x86_64
machine_type = pc
- q35:
requires i386, x86_64
conflicts ide
machine_type = q35
- @pseries:
requires ppc64
machine_type = pseries
The change can be done at once on the entire repository.
Second, "only" and "no" get a new meaning:
* if a variant has at least one "@"-marked item, and none of its items
is ever specified in an "only" or "no" directive, only the "@"-marked
item(s) will be included in the generated dictionaries.
* if a variant has no "@"-marked items, or if at least one of its items
is specified in an "only" or "no" directive, then dictionaries will be
generated as before. However, any "@" marks are ignored and the variant
will always be included when printing a tuple.
So for example when we add this to guest-hw.cfg:
variants monitor:
- @hmp:
monitors = hmp1
monitor_type_hmp1 = human
monitor_type = human
- qmp:
monitors = qmp1
monitor_type_qmp1 = qmp
monitor_type = qmp
users of "./run -c" will not need to add "only qmp" to their
configuration files; their tests will still run using HMP as before.
However, users _can_ add "only qmp" or "only hmp" and as a consequence
the user's requested mode will be used. Also, the default can be
changed easily from HMP to QMP later.
Opinions?
Looks good to me. I really like the idea of using @ as a filter of sorts.
_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel