[libvirt] [PATCH v2 05/11] qemu: command: Support new cpu feature argument syntax

Jiri Denemark jdenemar at redhat.com
Thu Dec 15 16:00:16 UTC 2016


On Fri, Dec 09, 2016 at 14:38:34 -0500, Jason J. Herne wrote:
> From: "Collin L. Walling" <walling at linux.vnet.ibm.com>
> 
> Qemu has abandoned the +/-feature syntax in favor of key=value. Some
> architectures (s390) do not support +/-feature. So we update libvirt to handle
> both formats.
> 
> If we detect a sufficiently new Qemu (indicated by support for qmp
> query-cpu-model-expansion) we use key=value else we fall back to +/-feature.
> 
> Signed-off-by: Collin L. Walling <walling at linux.vnet.ibm.com>
> Signed-off-by: Jason J. Herne <jjherne at linux.vnet.ibm.com>
> ---
>  src/qemu/qemu_command.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index f8e48d2..12e8aba 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6672,12 +6672,18 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
>          switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
>          case VIR_CPU_FEATURE_FORCE:
>          case VIR_CPU_FEATURE_REQUIRE:
> -            virBufferAsprintf(buf, ",+%s", cpu->features[i].name);
> +            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
> +                virBufferAsprintf(buf, ",%s=on", cpu->features[i].name);
> +            else
> +                virBufferAsprintf(buf, ",+%s", cpu->features[i].name);
>              break;
>  
>          case VIR_CPU_FEATURE_DISABLE:
>          case VIR_CPU_FEATURE_FORBID:
> -            virBufferAsprintf(buf, ",-%s", cpu->features[i].name);
> +            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
> +                virBufferAsprintf(buf, ",%s=off", cpu->features[i].name);
> +            else
> +                virBufferAsprintf(buf, ",-%s", cpu->features[i].name);
>              break;
>  
>          case VIR_CPU_FEATURE_OPTIONAL:

The "[08/11] tests: qemuxml2argv cpu feature syntax" patch should be
squashed into this one. See my reply to 8/11 for more comments.

Jirka




More information about the libvir-list mailing list