]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: use file cache for nbdkit caps
authorJonathon Jongsma <jjongsma@redhat.com>
Thu, 21 Jul 2022 22:34:49 +0000 (17:34 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Tue, 19 Sep 2023 19:28:50 +0000 (14:28 -0500)
Add the virFileCache implementation for nbdkit capabilities to the qemu
driver. This allows us to determine whether nbdkit is installed and
which plugins are supported. it also has persistent caching and the
capabilities are re-queried whenever something changes.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c

index 4f610d86a17399964e93c2a2137ae0da5a28bb0b..a44985fb8be3f381db7e91ddbecf2d11363dce08 100644 (file)
@@ -318,6 +318,9 @@ struct _virQEMUDriver {
 
     /* Immutable pointer, self-locking APIs */
     virHashAtomic *migrationErrors;
+
+    /* Immutable pointer, self-locking APIs */
+    virFileCache *nbdkitCapsCache;
 };
 
 virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
index 28ec40e3513eb442a2db8bf1720ec61a16d48fe3..3a487130370c663cf87b0c63fb52e5194bba576b 100644 (file)
@@ -845,6 +845,8 @@ qemuStateInitialize(bool privileged,
                                                            defsecmodel)))
         goto error;
 
+    qemu_driver->nbdkitCapsCache = qemuNbdkitCapsCacheNew(cfg->cacheDir);
+
     /* If hugetlbfs is present, then we need to create a sub-directory within
      * it, since we can't assume the root mount point has permissions that
      * will let our spawned QEMU instances use it. */
@@ -1078,6 +1080,7 @@ qemuStateCleanup(void)
     ebtablesContextFree(qemu_driver->ebtables);
     VIR_FREE(qemu_driver->qemuImgBinary);
     virObjectUnref(qemu_driver->domains);
+    virObjectUnref(qemu_driver->nbdkitCapsCache);
 
     if (qemu_driver->lockFD != -1)
         virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD);