]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: add default firmwares to driver config object
authorJim Fehlig <jfehlig@suse.com>
Wed, 18 May 2016 14:24:37 +0000 (08:24 -0600)
committerJim Fehlig <jfehlig@suse.com>
Mon, 13 Jun 2016 20:13:16 +0000 (14:13 -0600)
Prefer firmwares specified via --with-loader-nvram configure
option. If none are specified, use the Xen-provided default
firmwares found in LIBXL_FIRMWARE_DIR.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_conf.c
src/libxl/libxl_conf.h

index a64b4c17d804d498210c4ea9d879bdfd5643f602..c6a23c20f2918612370627497fca91581e82f7f3 100644 (file)
@@ -104,6 +104,7 @@ libxlDriverConfigDispose(void *obj)
     VIR_FREE(cfg->saveDir);
     VIR_FREE(cfg->autoDumpDir);
     VIR_FREE(cfg->lockManagerName);
+    virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
 }
 
 
@@ -1777,6 +1778,33 @@ libxlDriverConfigNew(void)
         goto error;
     }
 
+#ifdef DEFAULT_LOADER_NVRAM
+    if (virFirmwareParseList(DEFAULT_LOADER_NVRAM,
+                             &cfg->firmwares,
+                             &cfg->nfirmwares) < 0)
+        goto error;
+
+#else
+    if (VIR_ALLOC_N(cfg->firmwares, 1) < 0)
+        goto error;
+    cfg->nfirmwares = 1;
+    if (VIR_ALLOC(cfg->firmwares[0]) < 0)
+        goto error;
+    if (VIR_STRDUP(cfg->firmwares[0]->name,
+                   LIBXL_FIRMWARE_DIR "/ovmf.bin") < 0)
+        goto error;
+#endif
+
+    /* Always add hvmloader to firmwares */
+    if (VIR_REALLOC_N(cfg->firmwares, cfg->nfirmwares + 1) < 0)
+        goto error;
+    cfg->nfirmwares++;
+    if (VIR_ALLOC(cfg->firmwares[cfg->nfirmwares - 1]) < 0)
+        goto error;
+    if (VIR_STRDUP(cfg->firmwares[cfg->nfirmwares - 1]->name,
+                   LIBXL_FIRMWARE_DIR "/hvmloader") < 0)
+        goto error;
+
     return cfg;
 
  error:
index c5b94295ddb21f1c745b6aaaf0099e787fa42f2b..e55717ae26cb8d117a10e515ab7a83aa752ae5d5 100644 (file)
@@ -39,6 +39,7 @@
 # include "virchrdev.h"
 # include "virhostdev.h"
 # include "locking/lock_manager.h"
+# include "virfirmware.h"
 
 # define LIBXL_DRIVER_NAME "xenlight"
 # define LIBXL_VNC_PORT_MIN  5900
@@ -107,6 +108,9 @@ struct _libxlDriverConfig {
     char *libDir;
     char *saveDir;
     char *autoDumpDir;
+
+    virFirmwarePtr *firmwares;
+    size_t nfirmwares;
 };