[libvirt] [PATCH] util: Propagate numad failures correctly

Andrea Bolognani posted 1 patch 3 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190603171437.23878-1-abologna@redhat.com
src/util/virnuma.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

[libvirt] [PATCH] util: Propagate numad failures correctly

Posted by Andrea Bolognani 3 weeks ago
Right now, if numad fails, we raise an error but return an
empty string to the caller instead of a NULL pointer, which
means processing will continue and the user will see

  # virsh start guest
  error: Failed to start domain guest
  error: invalid argument: Failed to parse bitmap ''

instead of a more reasonable

  # virsh start guest
  error: Failed to start domain guest
  error: operation failed: Failed to query numad for the advisory nodeset

Make sure the user gets a better error message.

https://bugzilla.redhat.com/show_bug.cgi?id=1716387

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/util/virnuma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index dd3fb7519e..fee0dfcd5a 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -66,10 +66,12 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus,
 
     virCommandSetOutputBuffer(cmd, &output);
 
-    if (virCommandRun(cmd, NULL) < 0)
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+    if (virCommandRun(cmd, NULL) < 0) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Failed to query numad for the "
                          "advisory nodeset"));
+        VIR_FREE(output);
+    }
 
     return output;
 }
-- 
2.21.0

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

Re: [libvirt] [PATCH] util: Propagate numad failures correctly

Posted by Ján Tomko 3 weeks ago
On Mon, Jun 03, 2019 at 07:14:37PM +0200, Andrea Bolognani wrote:
>Right now, if numad fails, we raise an error but return an
>empty string to the caller instead of a NULL pointer, which
>means processing will continue and the user will see
>
>  # virsh start guest
>  error: Failed to start domain guest
>  error: invalid argument: Failed to parse bitmap ''
>
>instead of a more reasonable
>
>  # virsh start guest
>  error: Failed to start domain guest
>  error: operation failed: Failed to query numad for the advisory nodeset
>
>Make sure the user gets a better error message.
>
>https://bugzilla.redhat.com/show_bug.cgi?id=1716387
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> src/util/virnuma.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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

Re: [libvirt] [PATCH] util: Propagate numad failures correctly

Posted by Daniel Henrique Barboza 3 weeks ago

On 6/3/19 2:14 PM, Andrea Bolognani wrote:
> Right now, if numad fails, we raise an error but return an
> empty string to the caller instead of a NULL pointer, which
> means processing will continue and the user will see
>
>    # virsh start guest
>    error: Failed to start domain guest
>    error: invalid argument: Failed to parse bitmap ''
>
> instead of a more reasonable
>
>    # virsh start guest
>    error: Failed to start domain guest
>    error: operation failed: Failed to query numad for the advisory nodeset
>
> Make sure the user gets a better error message.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1716387
>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   src/util/virnuma.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/util/virnuma.c b/src/util/virnuma.c
> index dd3fb7519e..fee0dfcd5a 100644
> --- a/src/util/virnuma.c
> +++ b/src/util/virnuma.c
> @@ -66,10 +66,12 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus,
>   
>       virCommandSetOutputBuffer(cmd, &output);
>   
> -    if (virCommandRun(cmd, NULL) < 0)
> -        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +    if (virCommandRun(cmd, NULL) < 0) {
> +        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
>                          _("Failed to query numad for the "
>                            "advisory nodeset"));
> +        VIR_FREE(output);
> +    }
>   
>       return output;
>   }

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