]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: add host device manager to driver
authorWei Liu <liuwe@microsoft.com>
Fri, 11 Oct 2024 18:13:05 +0000 (13:13 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 15 Nov 2024 12:15:24 +0000 (13:15 +0100)
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>
src/ch/ch_conf.h
src/ch/ch_driver.c

index a77cad7a2af1f1c58a54f40f3a634d90df209ee2..11061bc1b509a66e4136c9c568b88f2e60530bc5 100644 (file)
@@ -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"
index dab025edc13e4101cfb05cfd83256e95d5ac1c49..17ae488a02954e7d7ae607941b6366e12e5f4971 100644 (file)
@@ -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;