ch: add host device manager to driver

Co-authored-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Wei Liu 2024-10-11 13:13:05 -05:00 committed by Michal Privoznik
parent 89ef0c0f2b
commit 5d4f9e1bdd
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include "virdomainobjlist.h" #include "virdomainobjlist.h"
#include "virhostdev.h"
#include "virthread.h" #include "virthread.h"
#include "ch_capabilities.h" #include "ch_capabilities.h"
#include "virebtables.h" #include "virebtables.h"
@ -80,6 +81,9 @@ struct _virCHDriver
/* Immutable pointer, lockless APIs. Pointless abstraction */ /* Immutable pointer, lockless APIs. Pointless abstraction */
ebtablesContext *ebtables; ebtablesContext *ebtables;
/* Immutable pointer to host device manager */
virHostdevManager *hostdevMgr;
}; };
#define CH_SAVE_MAGIC "libvirt-xml\n \0 \r" #define CH_SAVE_MAGIC "libvirt-xml\n \0 \r"

View File

@ -1365,6 +1365,7 @@ static int chStateCleanup(void)
virObjectUnref(ch_driver->xmlopt); virObjectUnref(ch_driver->xmlopt);
virObjectUnref(ch_driver->caps); virObjectUnref(ch_driver->caps);
virObjectUnref(ch_driver->domains); virObjectUnref(ch_driver->domains);
virObjectUnref(ch_driver->hostdevMgr);
virMutexDestroy(&ch_driver->lock); virMutexDestroy(&ch_driver->lock);
g_clear_pointer(&ch_driver, g_free); g_clear_pointer(&ch_driver, g_free);
@ -1414,6 +1415,9 @@ chStateInitialize(bool privileged,
if (!(ch_driver->config = virCHDriverConfigNew(privileged))) if (!(ch_driver->config = virCHDriverConfigNew(privileged)))
goto cleanup; goto cleanup;
if (!(ch_driver->hostdevMgr = virHostdevManagerGetDefault()))
goto cleanup;
if ((rv = chExtractVersion(ch_driver)) < 0) { if ((rv = chExtractVersion(ch_driver)) < 0) {
if (rv == -2) if (rv == -2)
ret = VIR_DRV_STATE_INIT_SKIPPED; ret = VIR_DRV_STATE_INIT_SKIPPED;