[PATCH] do not report generic OPERATION_FAILED error when calling virConnectOpenAuth()

Ani Sinha posted 1 patch 2 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220106170706.185692-1-ani@anisinha.ca
src/libxl/libxl_migration.c | 3 ---
src/qemu/qemu_migration.c   | 3 ---
2 files changed, 6 deletions(-)
[PATCH] do not report generic OPERATION_FAILED error when calling virConnectOpenAuth()
Posted by Ani Sinha 2 years, 3 months ago
virConnectOpenAuth() calls virConnectOpenInternal(). This later function
generates fine grained errors arising from various failure conditions that are
more accurate than a "catch all" broader VIR_ERR_OPERATION_FAILED error that
the callers of this function generates. Remove the broader error so that more
specific errors can be caught and processed.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 src/libxl/libxl_migration.c | 3 ---
 src/qemu/qemu_migration.c   | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 6d0ab4ee28..bc2b5401da 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -1134,9 +1134,6 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivate *driver,
     virObjectLock(vm);
 
     if (dconn == NULL) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Failed to connect to remote libvirt URI %s: %s"),
-                       dconnuri, virGetLastErrorMessage());
         return ret;
     }
 
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b9d7d582f5..2635ef1162 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5145,9 +5145,6 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriver *driver,
         goto cleanup;
 
     if (dconn == NULL) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Failed to connect to remote libvirt URI %s: %s"),
-                       dconnuri, virGetLastErrorMessage());
         return -1;
     }
 
-- 
2.25.1

Re: [PATCH] do not report generic OPERATION_FAILED error when calling virConnectOpenAuth()
Posted by Ani Sinha 2 years, 3 months ago
Ping ...

On Thu, 6 Jan 2022, Ani Sinha wrote:

> virConnectOpenAuth() calls virConnectOpenInternal(). This later function
> generates fine grained errors arising from various failure conditions that are
> more accurate than a "catch all" broader VIR_ERR_OPERATION_FAILED error that
> the callers of this function generates. Remove the broader error so that more
> specific errors can be caught and processed.
>
> Signed-off-by: Ani Sinha <ani@anisinha.ca>
> ---
>  src/libxl/libxl_migration.c | 3 ---
>  src/qemu/qemu_migration.c   | 3 ---
>  2 files changed, 6 deletions(-)
>
> diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
> index 6d0ab4ee28..bc2b5401da 100644
> --- a/src/libxl/libxl_migration.c
> +++ b/src/libxl/libxl_migration.c
> @@ -1134,9 +1134,6 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivate *driver,
>      virObjectLock(vm);
>
>      if (dconn == NULL) {
> -        virReportError(VIR_ERR_OPERATION_FAILED,
> -                       _("Failed to connect to remote libvirt URI %s: %s"),
> -                       dconnuri, virGetLastErrorMessage());
>          return ret;
>      }
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index b9d7d582f5..2635ef1162 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -5145,9 +5145,6 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriver *driver,
>          goto cleanup;
>
>      if (dconn == NULL) {
> -        virReportError(VIR_ERR_OPERATION_FAILED,
> -                       _("Failed to connect to remote libvirt URI %s: %s"),
> -                       dconnuri, virGetLastErrorMessage());
>          return -1;
>      }
>
> --
> 2.25.1
>
>

Re: [PATCH] do not report generic OPERATION_FAILED error when calling virConnectOpenAuth()
Posted by Michal Prívozník 2 years, 3 months ago
On 1/6/22 18:07, Ani Sinha wrote:
> virConnectOpenAuth() calls virConnectOpenInternal(). This later function
> generates fine grained errors arising from various failure conditions that are
> more accurate than a "catch all" broader VIR_ERR_OPERATION_FAILED error that
> the callers of this function generates. Remove the broader error so that more
> specific errors can be caught and processed.
> 
> Signed-off-by: Ani Sinha <ani@anisinha.ca>
> ---
>  src/libxl/libxl_migration.c | 3 ---
>  src/qemu/qemu_migration.c   | 3 ---
>  2 files changed, 6 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

and pushed.

Michal