Skip to contentSkip to conversation

libxl: include a XLU_Config in _libxlDriverConfig

PATCH Jim Fehlig 1 participant 1 message May 8, 2015 1 message not in the archive

lore
Share & tools
lore

Jim Fehlig

author
#1 lore raw
In reply to a message not in the archive
Quoted 3 lines · Olaf Hering

Upcoming changes for vscsi will use libxlutil.so to prepare the configuration for libxl. The helpers needs a xlu struct for logging.

s/needs a/need an/

Quoted 44 lines

Provide one and reuse the existing output as log target.

---

v2:
- call xlu_cfg_destroy, unconditionally
- fix cpp indention in libxl_conf.h

 src/libxl/libxl_conf.c | 7 +++++++
 src/libxl/libxl_conf.h | 7 +++++++
 2 files changed, 14 insertions(+)
src/libxl/libxl_conf.c +7 -0
index fccada5..e1bc0f6 100644
@@ -92,6 +92,7 @@ libxlDriverConfigDispose(void *obj)
     virObjectUnref(cfg->caps);
     libxl_ctx_free(cfg->ctx);
     xtl_logger_destroy(cfg->logger);
+    xlu_cfg_destroy(cfg->xlu);
     if (cfg->logger_file)
         VIR_FORCE_FCLOSE(cfg->logger_file);
 
@@ -1468,6 +1469,12 @@ libxlDriverConfigNew(void)
         goto error;
     }
 
+    cfg->xlu = xlu_cfg_init(cfg->logger_file, "libvirt");
+    if (!cfg->xlu) {
+        VIR_ERROR(_("cannot create xlu for libxenlight, disabling driver"));
+        goto error;
+    }
+
     if (libxl_ctx_alloc(&cfg->ctx, LIBXL_VERSION, 0, cfg->logger)) {
         VIR_ERROR(_("cannot initialize libxenlight context, probably not "
                     "running in a Xen Dom0, disabling driver"));
src/libxl/libxl_conf.h +0 -0
index 0a1c0db..24fa960 100644

src/libxl/libxl_conf.h line 35

Quoted 9 lines
src/libxl/libxl_conf.h +5 -0
@@ -27,6 +27,12 @@
 # define LIBXL_CONF_H
 
 # include <libxl.h>
+# ifdef HAVE_LIBXLUTIL_H
+#  include <libxlutil.h>
+# else
+typedef struct XLU_Config XLU_Config;
+XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename);
 

You forgot to add xlu_cfg_destroy here. Also, libvirt style seems to prefer the explicit 'extern', e.g.

extern XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename);

Regards,
Jim

Quoted 15 lines
src/libxl/libxl_conf.h +1 -0
+# endif
 
 # include "internal.h"
 # include "libvirt_internal.h"
src/libxl/libxl_conf.h +1 -0
@@ -92,6 +98,7 @@ struct _libxlDriverConfig {
     /* log stream for driver-wide libxl ctx */
     FILE *logger_file;
     xentoollog_logger *logger;
+    XLU_Config *xlu;
     /* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
     libxl_ctx *ctx;