[libvirt] [PATCH] storage: util: Properly ignore errors when backing volume is inaccessible

Peter Krempa posted 1 patch 6 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/b2c5f28a72465bf047311828c8c66112c8ca84e5.1517309431.git.pkrempa@redhat.com
src/storage/storage_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] storage: util: Properly ignore errors when backing volume is inaccessible
Posted by Peter Krempa 6 years, 2 months ago
Commit 000e9504559 tried to fix improper bracketing when refreshing disk
volume stats for a backing volume. Unfortunately the condition is still
wrong as in cases as the backing store being inaccessible
storageBackendUpdateVolTargetInfo returns -2 if instructed to ignore
errors. The condition does not take this into account.

Dumping XML of a volume which has inacessible backing store would then
result into:

 # virsh vol-dumpxml http.img --pool default
 error: An error occurred, but the cause is unknown

Properly ignore -2 for backing volumes.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1540022
---
 src/storage/storage_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 9e1b63a436..61a87b37b6 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1918,7 +1918,7 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
                                                  withBlockVolFormat,
                                                  VIR_STORAGE_VOL_OPEN_DEFAULT |
                                                  VIR_STORAGE_VOL_OPEN_NOERROR,
-                                                 readflags)) < 0)
+                                                 readflags)) == -1)
         return ret;

     return 0;
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] storage: util: Properly ignore errors when backing volume is inaccessible
Posted by Jiri Denemark 6 years, 2 months ago
On Tue, Jan 30, 2018 at 11:50:31 +0100, Peter Krempa wrote:
> Commit 000e9504559 tried to fix improper bracketing when refreshing disk
> volume stats for a backing volume. Unfortunately the condition is still
> wrong as in cases as the backing store being inaccessible
> storageBackendUpdateVolTargetInfo returns -2 if instructed to ignore
> errors. The condition does not take this into account.
> 
> Dumping XML of a volume which has inacessible backing store would then
> result into:
> 
>  # virsh vol-dumpxml http.img --pool default
>  error: An error occurred, but the cause is unknown
> 
> Properly ignore -2 for backing volumes.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1540022
> ---
>  src/storage/storage_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
> index 9e1b63a436..61a87b37b6 100644
> --- a/src/storage/storage_util.c
> +++ b/src/storage/storage_util.c
> @@ -1918,7 +1918,7 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
>                                                   withBlockVolFormat,
>                                                   VIR_STORAGE_VOL_OPEN_DEFAULT |
>                                                   VIR_STORAGE_VOL_OPEN_NOERROR,
> -                                                 readflags)) < 0)
> +                                                 readflags)) == -1)
>          return ret;
> 
>      return 0;

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

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