
On Thu, Feb 23, 2017 at 03:15:17PM +0100, Jiri Denemark wrote:
The static CPU model expansion is designed to return only canonical names of all CPU properties. To maintain backwards compatibility libvirt is stuck with different spelling of some of the features, but we need to use the full expansion to get the additional spellings. In addition to returning all spelling variants for all properties the full expansion will contain properties which are not guaranteed to be migration compatible. Thus, we need to combine both expansions. First we need to call the static expansion to limit the result to migratable properties. Then we can use the result of the static expansion as an input to the full expansion to get both canonical names and their aliases.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> ---
Notes: Version 3: - reworded the commit message a bit - moved retry label just above switch (type) to simplify the code - added a comment to explain why we are jumping back
Version 2: - no change
src/qemu/qemu_capabilities.c | 10 +- src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 +- .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 2 - tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 3 +- .../qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 476 +++++++++++++++++++++ tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 178 ++++++-- 7 files changed, 654 insertions(+), 38 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 3f0a0ef07..ce191ee99 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2845,6 +2845,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, { qemuMonitorCPUModelInfoPtr *modelInfo; const char *model; + qemuMonitorCPUModelExpansionType type;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) return 0; @@ -2857,9 +2858,12 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, model = "host"; }
- return qemuMonitorGetCPUModelExpansion(mon, - QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC, - model, modelInfo); + if (ARCH_IS_X86(qemuCaps->arch)) + type = QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL; + else + type = QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC;
It might be useful to explain here in the code why STATIC_FULL is used only for x86 arch so nobody tries to add here different architecture when it gets support in QEMU to list use FULL expansion. ACK Pavel