[libvirt] [PATCH 03/11] qemu: Move GIC checks to qemuDomainDefValidateFeatures()

John Ferlan jferlan at redhat.com
Mon Feb 12 19:59:07 UTC 2018



On 02/06/2018 11:42 AM, Andrea Bolognani wrote:
> Keep them along with other arch/machine type checks for
> features instead of waiting until command line generation
> time.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  src/qemu/qemu_command.c  |  7 -------
>  src/qemu/qemu_domain.c   | 11 ++++++++++-
>  tests/qemuxml2argvtest.c | 12 ++++++------
>  3 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 24b434a45..529079be0 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7192,13 +7192,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
>  
>          if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
>              if (def->gic_version != VIR_GIC_VERSION_NONE) {
> -                if (!qemuDomainIsVirt(def)) {
> -                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                                   _("gic-version option is available "
> -                                     "only for ARM virt machine"));
> -                    goto cleanup;
> -                }
> -
>                  /* The default GIC version (GICv2) should not be specified on
>                   * the QEMU commandline for backwards compatibility reasons */
>                  if (def->gic_version != VIR_GIC_VERSION_2) {
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index dd36b42eb..98cba8789 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -3252,6 +3252,16 @@ qemuDomainDefValidateFeatures(const virDomainDef *def)
>              }
>              break;
>  
> +        case VIR_DOMAIN_FEATURE_GIC:
> +            if (def->features[i] == VIR_TRISTATE_SWITCH_ON &&
> +                !qemuDomainIsVirt(def)) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                               _("The '%s' feature is only supported for %s guests"),

s/for %s guests/for '%s' guests/ ??

> +                               featureName, "mach-virt");

Not that I think it matters greatly, the error message changes from ARM
specifically to mach-virt... I guess I'm just used to seeing 'ARM' or
'aarch64' and not 'mach-virt' (although the XML would be AIUI "<type
arch='aarch64' machine='virt'>"). Suffice to say it caused me to wonder
and I have to imagine it would do the same for anyone getting that message.

I don't have a strong opinion one way or other and it's not really
easily "decode-able" based on someone just reading the "<os... <type ...
machine=''..." in the docs.

Still - the change otherwise seems fine. I trust you'll come up with the
right magical phrase ;-)

Reviewed-by: John Ferlan <jferlan at redhat.com>

John




More information about the libvir-list mailing list