Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
libvirt.20357
3d76f4fc-xen-dm-cmdline-config-converter.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3d76f4fc-xen-dm-cmdline-config-converter.patch of Package libvirt.20357
commit 3d76f4fceb35a679c8d770f0a2a29149b6e4ba40 Author: Jim Fehlig <jfehlig@suse.com> Date: Fri Jul 31 09:39:25 2020 -0600 Xen: Add support for qemu commandline passthrough to config converter 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> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Index: libvirt-6.0.0/src/libxl/xen_xl.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/xen_xl.c +++ libvirt-6.0.0/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,42 @@ xenParseXLChannel(virConfPtr conf, virDo 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); + list = list->next; + } + } + + if (!args) + return 0; + + nargs = g_strv_length(args); + if (nargs > 0) { + nsdata = g_new0(libxlDomainXmlNsDef, 1); + + nsdata->args = g_steal_pointer(&args); + nsdata->num_args = nargs; + def->namespaceData = nsdata; + } + + return 0; +} + virDomainDefPtr xenParseXL(virConfPtr conf, virCapsPtr caps, @@ -1170,6 +1207,7 @@ xenParseXL(virConfPtr conf, def->virtType = VIR_DOMAIN_VIRT_XEN; def->id = -1; + def->ns = *(virDomainXMLOptionGetNamespace(xmlopt)); if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XL, xmlopt) < 0) @@ -1207,6 +1245,9 @@ xenParseXL(virConfPtr conf, if (xenParseXLChannel(conf, def) < 0) goto cleanup; + if (xenParseXLNamespaceData(conf, def) < 0) + goto cleanup; + if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, xmlopt, NULL) < 0) goto cleanup; @@ -2178,6 +2219,53 @@ xenFormatXLDomainChannels(virConfPtr con return -1; } +static int +xenFormatXLDomainNamespaceData(virConfPtr conf, virDomainDefPtr def) +{ + libxlDomainXmlNsDefPtr nsdata = def->namespaceData; + virConfValuePtr args = NULL; + size_t i; + + if (!nsdata) + return 0; + + if (nsdata->num_args == 0) + return 0; + + if (VIR_ALLOC(args) < 0) + return -1; + + args->type = VIR_CONF_LIST; + args->list = NULL; + + for (i = 0; i < nsdata->num_args; i++) { + virConfValuePtr val, tmp; + + if (VIR_ALLOC(val) < 0) + goto error; + + val->type = VIR_CONF_STRING; + val->str = g_strdup(nsdata->args[i]); + tmp = args->list; + while (tmp && tmp->next) + tmp = tmp->next; + if (tmp) + tmp->next = val; + else + args->list = val; + } + + if (args->list != NULL) + if (virConfSetValue(conf, "device_model_args", args) < 0) + goto error; + + return 0; + + error: + virConfFreeValue(args); + return -1; +} + virConfPtr xenFormatXL(virDomainDefPtr def, virConnectPtr conn) { @@ -2221,5 +2309,8 @@ xenFormatXL(virDomainDefPtr def, virConn if (xenFormatXLDomainChannels(conf, def) < 0) return NULL; + if (xenFormatXLDomainNamespaceData(conf, def) < 0) + return NULL; + return g_steal_pointer(&conf); } Index: libvirt-6.0.0/tests/xlconfigdata/test-qemu-passthrough.cfg =================================================================== --- /dev/null +++ libvirt-6.0.0/tests/xlconfigdata/test-qemu-passthrough.cfg @@ -0,0 +1,26 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem = 579 +memory = 394 +vcpus = 1 +pae = 1 +acpi = 1 +apic = 1 +viridian = 0 +rtc_timeoffset = 0 +localtime = 0 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +device_model = "/usr/lib/xen/bin/qemu-system-i386" +sdl = 0 +vnc = 1 +vncunused = 1 +vnclisten = "127.0.0.1" +vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ] +parallel = "none" +serial = "none" +builder = "hvm" +boot = "d" +disk = [ "format=raw,vdev=hda,access=rw,backendtype=qdisk,target=/var/lib/libvirt/images/XenGuest2" ] +device_model_args = [ "-debugcon", "file:/tmp/debug.log", "-global", "isa-debugcon.iobase=0x402" ] Index: libvirt-6.0.0/tests/xlconfigdata/test-qemu-passthrough.xml =================================================================== --- /dev/null +++ libvirt-6.0.0/tests/xlconfigdata/test-qemu-passthrough.xml @@ -0,0 +1,53 @@ +<domain type='xen' xmlns:xen='http://libvirt.org/schemas/domain/xen/1.0'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>592896</memory> + <currentMemory unit='KiB'>403456</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='xenfv'>hvm</type> + <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader> + <boot dev='cdrom'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <clock offset='variable' adjustment='0' basis='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/images/XenGuest2'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='xenbus' index='0'/> + <controller type='ide' index='0'/> + <interface type='bridge'> + <mac address='00:16:3e:66:92:9c'/> + <source bridge='xenbr1'/> + <script path='vif-bridge'/> + <model type='e1000'/> + </interface> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1'/> + </graphics> + <video> + <model type='cirrus' vram='8192' heads='1' primary='yes'/> + </video> + <memballoon model='xen'/> + </devices> + <xen:commandline> + <xen:arg value='-debugcon'/> + <xen:arg value='file:/tmp/debug.log'/> + <xen:arg value='-global'/> + <xen:arg value='isa-debugcon.iobase=0x402'/> + </xen:commandline> +</domain> Index: libvirt-6.0.0/tests/xlconfigtest.c =================================================================== --- libvirt-6.0.0.orig/tests/xlconfigtest.c +++ libvirt-6.0.0/tests/xlconfigtest.c @@ -304,6 +304,7 @@ mymain(void) #ifdef LIBXL_HAVE_CREATEINFO_PASSTHROUGH DO_TEST("fullvirt-hypervisor-features"); #endif + DO_TEST("qemu-passthrough"); testXLFreeDriver(driver);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor