[libvirt] [PATCH] storage: gluster: Implement 'checkPool' method so that state is restored

Peter Krempa posted 1 patch 140 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d191f637ee363cee1d25707162a5ac08b039dca1.1490875593.git.pkrempa@redhat.com
src/storage/storage_backend_gluster.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

[libvirt] [PATCH] storage: gluster: Implement 'checkPool' method so that state is restored

Posted by Peter Krempa 140 weeks ago
After restart of libvirtd the 'checkPool' method is supposed to validate
that the pool is online. Since libvirt then refreshes the pool contents
anyways just return whether the pool was supposed to be online so that
the code can be reached. This is necessary since if a pool does not
implement the method it's automatically considered as inactive.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436065
---
 src/storage/storage_backend_gluster.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 52c9ee372..83da47347 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -537,9 +537,22 @@ virStorageBackendGlusterFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
 }


+static int
+virStorageBackendGlusterCheckPool(virStoragePoolObjPtr pool,
+                                  bool *active)
+{
+    /* Return previous state remembered by the status XML. If the pool is not
+     * available we will fail to refresh it and end up in the same situation.
+     * This will save one attempt to open the connection to the remote server */
+    *active = pool->active;
+    return 0;
+}
+
+
 virStorageBackend virStorageBackendGluster = {
     .type = VIR_STORAGE_POOL_GLUSTER,

+    .checkPool = virStorageBackendGlusterCheckPool,
     .refreshPool = virStorageBackendGlusterRefreshPool,
     .findPoolSources = virStorageBackendGlusterFindPoolSources,

-- 
2.12.1

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

Re: [libvirt] [PATCH] storage: gluster: Implement 'checkPool' method so that state is restored

Posted by Ján Tomko 139 weeks ago
On Thu, Mar 30, 2017 at 02:06:33PM +0200, Peter Krempa wrote:
>After restart of libvirtd the 'checkPool' method is supposed to validate
>that the pool is online. Since libvirt then refreshes the pool contents
>anyways just return whether the pool was supposed to be online so that
>the code can be reached. This is necessary since if a pool does not
>implement the method it's automatically considered as inactive.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436065
>---
> src/storage/storage_backend_gluster.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)

ACK

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