[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 3/4] Xen: Add support for qemu commandline passthrough to config converter



On a Friday in 2020, Jim Fehlig wrote:
Support qemu commandline passthrough in the domXML to native config
converter. Add tests to check the conversion.

Signed-off-by: Jim Fehlig <jfehlig suse com>
---

I had to add a small hack to xlconfigtest.c to set def->ns after
parsing the xl.cfg file to virDomainDef object. The hack could also
be added to xenParseXL in src/libxl/xen_xl.c, where the virDomainDef
object is created. Opinions much welcomed :-).


Yes, it should be filled by whatever is creating the config, not just
before formatting.

src/libxl/xen_xl.c                           | 88 ++++++++++++++++++++

tests/xlconfigdata/test-qemu-passthrough.cfg | 26 ++++++
tests/xlconfigdata/test-qemu-passthrough.xml | 53 ++++++++++++

Why do all the test files in this directory have a 'test-' prefix?

tests/xlconfigtest.c                         |  4 +
4 files changed, 171 insertions(+)

diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index f9dc18ab18..a5d70d4039 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -32,6 +32,7 @@
#include "virstoragefile.h"
#include "xen_xl.h"
#include "libxl_capabilities.h"
+#include "libxl_conf.h"
#include "cpu/cpu.h"

#define VIR_FROM_THIS VIR_FROM_XENXL
@@ -1158,6 +1159,40 @@ xenParseXLChannel(virConfPtr conf, virDomainDefPtr def)
    return -1;
}

+static int
+xenParseXLNamespaceData(virConfPtr conf, virDomainDefPtr def)
+{
+    virConfValuePtr list = virConfGetValue(conf, "device_model_args");
+    VIR_AUTOSTRINGLIST args = NULL;
+    size_t nargs;
+    libxlDomainXmlNsDefPtr nsdata = NULL;
+
+    if (list && list->type == VIR_CONF_LIST) {
+        list = list->list;
+        while (list) {
+            if ((list->type != VIR_CONF_STRING) || (list->str == NULL)) {
+                list = list->next;
+                continue;
+            }
+
+            virStringListAdd(&args, list->str);

I'm not aware of a GLib equivalent for virStringListAdd

+            list = list->next;
+        }
+    }
+
+    nargs = virStringListLength((const char **)args);

g_strv_length

+    if (nargs > 0) {
+        if (VIR_ALLOC(nsdata) < 0)
+            return -1;

g_new0

+
+        nsdata->args = g_steal_pointer(&args);
+        nsdata->num_args = nargs;
+        def->namespaceData = nsdata;
+    }
+
+    return 0;
+}
+
virDomainDefPtr
xenParseXL(virConfPtr conf,
           virCapsPtr caps,

Jano

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]