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(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 6 +++++-
tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9726bce74..b1245ad5d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -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;
diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
index a4ab74dca..e8fe01d85 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
@@ -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>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 6efa8a668..6386c4ed0 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -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'/>
--
2.12.2