]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: gluster: Implement 'checkPool' method so that state is restored
authorPeter Krempa <pkrempa@redhat.com>
Thu, 30 Mar 2017 11:18:43 +0000 (13:18 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Apr 2017 10:21:17 +0000 (12:21 +0200)
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

index 30a41369a3cc3e86c2147a7ab1f69cc6c9421a82..93dce4042f80b9690b118eac1fe8391335bad920 100644 (file)
@@ -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,