[libvirt] [PATCH 6/6] qemu: command: Support new cpu feature argument syntax

Jiri Denemark jdenemar at redhat.com
Tue Nov 29 10:50:55 UTC 2016


On Mon, Nov 21, 2016 at 14:11:56 -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 4a5fce3..1f2da19 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6580,12 +6580,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;

It would be nice to add some tests to qemuxml2argvtest and let them use
QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION capability.

>  
>          case VIR_CPU_FEATURE_OPTIONAL:

Jirka




More information about the libvir-list mailing list