Switch to using the virFileCache implementation for nbdkit capabilities
so that we have persistent caching and re-load capabilities whenever
something changes.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/qemu/qemu_conf.h | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_nbdkit.c | 24 ------------------------
src/qemu/qemu_nbdkit.h | 2 --
4 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index d05c715400..414bcfb8a2 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -308,7 +308,7 @@ struct _virQEMUDriver {
/* Immutable pointer, self-locking APIs */
virHashAtomic *migrationErrors;
- qemuNbdkitCaps *nbdkitCaps;
+ virFileCache *nbdkitCapsCache;
};
virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 943fa8621d..dce3ba1a32 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -833,7 +833,7 @@ qemuStateInitialize(bool privileged,
goto error;
/* find whether nbdkit is available and query its capabilities */
- qemu_driver->nbdkitCaps = qemuQueryNbdkitCaps();
+ 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
diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
index ac498b948c..fc83f80f1f 100644
--- a/src/qemu/qemu_nbdkit.c
+++ b/src/qemu/qemu_nbdkit.c
@@ -225,30 +225,6 @@ qemuNbdkitCapsQuery(qemuNbdkitCaps *caps)
}
-qemuNbdkitCaps *
-qemuQueryNbdkitCaps(void)
-{
- qemuNbdkitCaps *caps = NULL;
- g_autofree char *path = virFindFileInPath("nbdkit");
-
- if (!path)
- return NULL;
-
- if (!virFileIsExecutable(path)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, _("nbdkit '%s' is not
executable"),
- path);
- return NULL;
- }
-
- VIR_DEBUG("found nbdkit executable '%s'", path);
-
- caps = qemuNbdkitCapsNew(path);
- qemuNbdkitCapsQuery(caps);
-
- return caps;
-}
-
-
bool
qemuNbdkitCapsGet(qemuNbdkitCaps *nbdkitCaps,
qemuNbdkitCapsFlags flag)
diff --git a/src/qemu/qemu_nbdkit.h b/src/qemu/qemu_nbdkit.h
index b65e76895b..3e34403d90 100644
--- a/src/qemu/qemu_nbdkit.h
+++ b/src/qemu/qemu_nbdkit.h
@@ -40,8 +40,6 @@ typedef enum {
VIR_ENUM_DECL(qemuNbdkitCaps);
-qemuNbdkitCaps* qemuQueryNbdkitCaps(void);
-
qemuNbdkitCaps* qemuNbdkitCapsNew(const char *path);
virFileCache* qemuNbdkitCapsCacheNew(const char *cachedir);
--
2.37.1