Commit
v0.8.4-66-g95ff6b18ec (9 years ago) changed the default value for
the cpu/@match attribute to 'exact' in a rather complicated way. It did
so only if <model> subelement was present and set -1 otherwise (which is
not expected to ever happen). Thus the following two equivalent XML
elements:
<cpu mode='host-model'/>
and
<cpu mode='host-model'>
<model/>
</cpu>
would be parsed differently. The former would end up with match == -1
while the latter would have match == 1 ('exact'). This is not a big deal
since the match attribute is ignored for host-model CPUs, but we can
simplify the code and make it a little bit saner anyway.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
VIR_ENUM_IMPL(virCPUMatch,
VIR_CPU_MATCH_LAST,
- "minimum",
"exact",
+ "minimum",
"strict",
);
char *match = virXMLPropString(ctxt->node, "match");
char *check;
- if (!match) {
- if (virXPathBoolean("boolean(./model)", ctxt))
- def->match = VIR_CPU_MATCH_EXACT;
- else
- def->match = -1;
- } else {
+ if (match) {
def->match = virCPUMatchTypeFromString(match);
VIR_FREE(match);
VIR_ENUM_DECL(virCPUMode);
typedef enum {
- VIR_CPU_MATCH_MINIMUM,
VIR_CPU_MATCH_EXACT,
+ VIR_CPU_MATCH_MINIMUM,
VIR_CPU_MATCH_STRICT,
VIR_CPU_MATCH_LAST