qemu: Check non-migratable host CPU features

CPU features which change their value from disabled to enabled between
two calls to query-cpu-model-expansion (the first with no extra
properties set and the second with 'migratable' property set to false)
can be marked as enabled and non-migratable in qemuMonitorCPUModelInfo.

Since the code consuming qemuMonitorCPUModelInfo currently ignores the
migratable flag, this change is effectively changing the CPU model
advertised in domain capabilities to contain all features (even those
which block migration). And this matches what we do for QEMU older than
2.9.0, when we detect all CPUID bits ourselves without asking QEMU.

As a result of this change

    <cpu mode='host-model'>
      <feature name='invtsc' policy='require'/>
    </cpu>

will work with all QEMU versions. Such CPU definition would be forbidden
with QEMU >= 2.9.0 without this patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2017-03-29 11:00:32 +02:00
parent 91927c62d8
commit 385c1cc96c
3 changed files with 7 additions and 2 deletions

View File

@ -2864,8 +2864,12 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
prop->type != nmProp->type)
continue;
if (prop->value.boolean)
if (prop->value.boolean) {
prop->migratable = VIR_TRISTATE_BOOL_YES;
} else if (nmProp->value.boolean) {
prop->value.boolean = true;
prop->migratable = VIR_TRISTATE_BOOL_NO;
}
}
(*modelInfo)->migratability = true;

View File

@ -30,6 +30,7 @@
<feature policy='require' name='clflushopt'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>

View File

@ -314,7 +314,7 @@
<property name='svm' type='boolean' value='false'/>
<property name='full-cpuid-auto-level' type='boolean' value='true' migratable='yes'/>
<property name='hv-reset' type='boolean' value='false'/>
<property name='invtsc' type='boolean' value='false'/>
<property name='invtsc' type='boolean' value='true' migratable='no'/>
<property name='sse3' type='boolean' value='true' migratable='yes'/>
<property name='sse2' type='boolean' value='true' migratable='yes'/>
<property name='est' type='boolean' value='false'/>