Re: [PATCH] cpu_ppc64: Error out when model tag missing in virsh cpu-compare xml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/18/2017 12:57 PM, Nitesh Konkar wrote:
> libvirtd throws unhandled signal 11 on ppc while running
> virsh cpu-compare with missing model tag in the xml. This
> patch errors out in such situation.


You could provide the example XML snippet ...  and as noted below what
the "expectations" are...

> 
> Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
> ---
>  src/cpu/cpu_ppc64.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

I assume since you didn't provide a stack trace, the caller is either
has "cpu->type == VIR_CPU_TYPE_GUEST && cpu->mode ==
VIR_CPU_MODE_CUSTOM" or "cpu->type != VIR_CPU_TYPE_GUEST", right? It's
not the host_model failure.

If so, then the commit message should indicate that "it's expected" that
for specific comparison types that the model was filled in

In the end - just want to make sure that the symptom being fixed isn't
masking a problem of insufficient checking on XML parse for specific types

> diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
> index b58e80a..c11ac9f 100644
> --- a/src/cpu/cpu_ppc64.c
> +++ b/src/cpu/cpu_ppc64.c
> @@ -247,6 +247,12 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
>  {
>      struct ppc64_model *model;
>  
> +    if (!cpu->model) {
> +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> +                       _("no guest CPU model specified"));

or "CPU model not specified"...

The "concern" being that this code is used for multiple purposes
(host_model, cpu->type == GUEST && cpu->model == CUSTOM, and cpu->type
!= GUEST) - so using "guest" could be a misnomer.

John

> +        return NULL;
> +    }
> +
>      if (!(model = ppc64ModelFind(map, cpu->model))) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("Unknown CPU model %s"), cpu->model);
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux