From: Wei Liu <liuwe@xxxxxxxxxxxxx> Co-authored-by: Wei Liu <liuwe@xxxxxxxxxxxxx> Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx> --- src/ch/ch_conf.h | 4 ++++ src/ch/ch_driver.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ch/ch_conf.h b/src/ch/ch_conf.h index a77cad7a2a..11061bc1b5 100644 --- a/src/ch/ch_conf.h +++ b/src/ch/ch_conf.h @@ -21,6 +21,7 @@ #pragma once #include "virdomainobjlist.h" +#include "virhostdev.h" #include "virthread.h" #include "ch_capabilities.h" #include "virebtables.h" @@ -80,6 +81,9 @@ struct _virCHDriver /* Immutable pointer, lockless APIs. Pointless abstraction */ ebtablesContext *ebtables; + + /* Immutable pointer to host device manager */ + virHostdevManager *hostdevMgr; }; #define CH_SAVE_MAGIC "libvirt-xml\n \0 \r" diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index dab025edc1..17ae488a02 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1365,6 +1365,7 @@ static int chStateCleanup(void) virObjectUnref(ch_driver->xmlopt); virObjectUnref(ch_driver->caps); virObjectUnref(ch_driver->domains); + virObjectUnref(ch_driver->hostdevMgr); virMutexDestroy(&ch_driver->lock); g_clear_pointer(&ch_driver, g_free); @@ -1414,6 +1415,9 @@ chStateInitialize(bool privileged, if (!(ch_driver->config = virCHDriverConfigNew(privileged))) goto cleanup; + if (!(ch_driver->hostdevMgr = virHostdevManagerGetDefault())) + goto cleanup; + if ((rv = chExtractVersion(ch_driver)) < 0) { if (rv == -2) ret = VIR_DRV_STATE_INIT_SKIPPED; -- 2.44.0