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

2017-10-12 Thread Jiri Denemark
On Mon, Sep 18, 2017 at 22:27:52 +0530, 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.
> 
> Signed-off-by: Nitesh Konkar 
> ---
>  src/cpu/cpu_ppc64.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> 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"));
> +return NULL;
> +}
> +
>  if (!(model = ppc64ModelFind(map, cpu->model))) {
>  virReportError(VIR_ERR_INTERNAL_ERROR,
> _("Unknown CPU model %s"), cpu->model);

ACK and pushed with the removal of "guest" in the error message as
suggested by John.

Thanks,

Jirka

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


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

2017-09-26 Thread John Ferlan


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 
> ---
>  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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-09-21 Thread Nitesh Konkar
Gentle ping.

On Mon, Sep 18, 2017 at 10:27 PM, Nitesh Konkar <
niteshkonkar.libv...@gmail.com> 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.
>
> Signed-off-by: Nitesh Konkar 
> ---
>  src/cpu/cpu_ppc64.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> 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"));
> +return NULL;
> +}
> +
>  if (!(model = ppc64ModelFind(map, cpu->model))) {
>  virReportError(VIR_ERR_INTERNAL_ERROR,
> _("Unknown CPU model %s"), cpu->model);
> --
> 2.9.5
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list