[PATCH] virStorageBackendLogicalCheckPool: Properly mark empty logical pools as active

Peter Krempa posted 1 patch 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3d0cd13a1d80bb0ec358e8bcc41d8847b1add9d5.1691503216.git.pkrempa@redhat.com
src/storage/storage_backend_logical.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
[PATCH] virStorageBackendLogicalCheckPool: Properly mark empty logical pools as active
Posted by Peter Krempa 9 months ago
The '/dev' filesystem convenience directory for a LVM volume group is
not created when the volume group is empty.

The logic in 'virStorageBackendLogicalCheckPool' which is used to see
whether a pool is active was first checking presence of the directory,
which failed for an empty VG.

Since the second step is virStorageBackendLogicalMatchPoolSource which
is checking mapping between configured PVs and the VG, we can simply
rely on the function to also check presence of the pool.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2228223
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/storage/storage_backend_logical.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 9462ac6790..6acbc37f18 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -624,13 +624,7 @@ static int
 virStorageBackendLogicalCheckPool(virStoragePoolObj *pool,
                                   bool *isActive)
 {
-    virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
-
-    /* If we can find the target.path as well as ensure that the
-     * pool's def source
-     */
-    *isActive = virFileExists(def->target.path) &&
-                virStorageBackendLogicalMatchPoolSource(pool);
+    *isActive = virStorageBackendLogicalMatchPoolSource(pool);
     return 0;
 }

-- 
2.41.0
Re: [PATCH] virStorageBackendLogicalCheckPool: Properly mark empty logical pools as active
Posted by Ján Tomko 9 months ago
On a Tuesday in 2023, Peter Krempa wrote:
>The '/dev' filesystem convenience directory for a LVM volume group is
>not created when the volume group is empty.
>
>The logic in 'virStorageBackendLogicalCheckPool' which is used to see
>whether a pool is active was first checking presence of the directory,
>which failed for an empty VG.
>
>Since the second step is virStorageBackendLogicalMatchPoolSource which
>is checking mapping between configured PVs and the VG, we can simply
>rely on the function to also check presence of the pool.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2228223
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/storage/storage_backend_logical.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>

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

Jano