Introduce support for parsing/formatting Xen xl config format
PATCH v4 1/3 Introduce support for parsing/formatting Xen xl config format
In reply to a message not in the archiveIntroduce a parser/formatter for the xl config format. Since the deprecation of xm/xend, the VM config file format has diverged as new features are added to libxl. This patch adds support for parsing and formating the xl config format. It supports the existing xm config format, plus adds support for spice graphics and xl disk config syntax.
Disk config is specified a bit differently in xl as compared to xm. In xl, disk config consists of comma-separated positional parameters and keyword/value pairs separated by commas. Positional parameters are specified as follows
target, format, vdev, access
Supported keys for key=value options are
devtype, backendtype
The positional paramters can also be specified in key/value form. For example the following xl disk config are equivalent
/dev/vg/guest-volume,,hda /dev/vg/guest-volume,raw,hda,rw
format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
See $xen_sources/docs/misc/xl-disk-configuration.txt for more details.
xl disk config is parsed with the help of xlu_disk_parse() from libxlutil, libxl's utility library. Although the library exists in all Xen versions supported by the libxl virt driver, only recently has the corresponding header file been included. A check for the header is done in configure.ac. If not found, xlu_disk_parse() is declared externally.
---
V4:
Use Xen's libxlutil to parse disk strings instead of copying the flex-based parser.
Only build support for parsing xen-xl when libxl is available.
Address several comments from previous review.
configure.ac | 3 + po/POTFILES.in | 1 + src/Makefile.am | 11 + src/libvirt_xenxlconfig.syms | 12 + src/xenconfig/xen_common.c | 3 +- src/xenconfig/xen_xl.c | 515 +++++++++++++++++++++++++++++++++++++++++++ src/xenconfig/xen_xl.h | 35 +++ 7 files changed, 579 insertions(+), 1 deletion(-)
configure.ac +3 -0
@@ -891,6 +891,9 @@ if test $fail = 1; then fi if test "$with_libxl" = "yes"; then + dnl If building with libxl, use the libxl utility header and lib too + AC_CHECK_HEADERS([libxlutil.h]) + LIBXL_LIBS="$LIBXL_LIBS -lxlutil" AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled]) fi AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"])
po/POTFILES.in +1 -0
@@ -247,6 +247,7 @@ src/xenapi/xenapi_driver.c src/xenapi/xenapi_utils.c src/xenconfig/xen_common.c src/xenconfig/xen_sxpr.c +src/xenconfig/xen_xl.c src/xenconfig/xen_xm.c tests/virpolkittest.c tools/libvirt-guests.sh.in
src/Makefile.am +11 -0
@@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \ xenconfig/xen_common.c xenconfig/xen_common.h \ xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h +if WITH_LIBXL +XENCONFIG_SOURCES += \ + xenconfig/xen_xl.c xenconfig/xen_xl.h +endif WITH_LIBXL pkgdata_DATA = cpu/cpu_map.xml
@@ -1061,6 +1065,7 @@ endif WITH_VMX if WITH_XENCONFIG noinst_LTLIBRARIES += libvirt_xenconfig.la libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la +libvirt_la_LIBADD += $(LIBXL_LIBS) libvirt_xenconfig_la_CFLAGS = \ -I$(srcdir)/conf $(AM_CFLAGS) libvirt_xenconfig_la_SOURCES = $(XENCONFIG_SOURCES)
@@ -1979,6 +1984,12 @@ else ! WITH_XENCONFIG SYM_FILES += $(srcdir)/libvirt_xenconfig.syms endif ! WITH_XENCONFIG +if WITH_LIBXL +USED_SYM_FILES += $(srcdir)/libvirt_xenxlconfig.syms +else ! WITH_LIBXL +SYM_FILES += $(srcdir)/libvirt_xenxlconfig.syms +endif ! WITH_LIBXL + if WITH_SASL USED_SYM_FILES += $(srcdir)/libvirt_sasl.syms else ! WITH_SASL
src/libvirt_xenxlconfig.syms new file +12 -0
@@ -0,0 +1,12 @@ +# +# These symbols are dependent upon --with-libxl via WITH_LIBXL. +# + +#xenconfig/xen_xl.h +xenFormatXL; +xenParseXL; + +# Let emacs know we want case-insensitive sorting +# Local Variables: +# sort-fold-case: t +# End:
src/xenconfig/xen_common.c +2 -1
@@ -1812,7 +1812,8 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion) {int hvm =STREQ (def->os.type,"hvm" ) ?1 :0 ; -if (def->ngraphics ==1 ) { +if (def->ngraphics ==1 && + def->graphics[0 ]->type !=VIR_DOMAIN_GRAPHICS_TYPE_SPICE ) {if (hvm || (xendConfigVersion <XEND_CONFIG_MIN_VERS_PVFB_NEWCONF )) {if (def->graphics[0 ]->type ==VIR_DOMAIN_GRAPHICS_TYPE_SDL ) {if (xenConfigSetInt (conf,"sdl" ,1 ) <0 )
src/xenconfig/xen_xl.c new file +515 -0
515 lines not on this page · raw message
src/xenconfig/xen_xl.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* xen_xl.h: Xen XL parsing functions +* +* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see +* <http://www.gnu.org/licenses/>. +* +* Author: Kiarie Kahurani<[email protected]> +*/ + +#ifndef __VIR_XEN_XL_H__ +# define __VIR_XEN_XL_H__ + +# include "virconf.h" +# include "domain_conf.h" +# include "xen_common.h" + +virDomainDefPtr xenParseXL (virConfPtr conn,virCapsPtr caps, +int xendConfigVersion); +virConfPtr xenFormatXL (virDomainDefPtr def, +virConnectPtr ,int xendConfigVersion); + +#endif /* __VIR_XEN_XL_H__ */
Signature · 1 line
1.8.4.5
PATCH v4 2/3 tests: Tests for the xen-xl parser
In reply to a message not in the archiveFrom: Kiarie Kahurani <[email protected]>
add tests for the xen_xl config parser
---
V4:
Only build xlconfigtest when libxl is available.
tests/Makefile.am | 11 ++ tests/testutilsxen.c | 50 ++++++++ tests/testutilsxen.h | 9 +- tests/xlconfigdata/test-new-disk.cfg | 26 ++++ tests/xlconfigdata/test-new-disk.xml | 51 ++++++++ tests/xlconfigdata/test-spice.cfg | 32 +++++ tests/xlconfigdata/test-spice.xml | 45 +++++++ tests/xlconfigtest.c | 225 +++++++++++++++++++++++++++++++++++ 8 files changed, 448 insertions(+), 1 deletion(-)
tests/Makefile.am +11 -0
@@ -138,6 +138,7 @@ EXTRA_DIST = \ vmx2xmldata \ xencapsdata \ xmconfigdata \ + xlconfigdata \ xml2sexprdata \ xml2vmxdata \ vmwareverdata \
@@ -227,6 +228,11 @@ if WITH_XEN test_programs += xml2sexprtest sexpr2xmltest \ xmconfigtest xencapstest statstest reconnect endif WITH_XEN + +if WITH_LIBXL +test_programs += xlconfigtest +endif WITH_LIBXL + if WITH_QEMU test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \ qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
@@ -477,6 +483,11 @@ sexpr2xmltest_SOURCES = \ testutils.c testutils.h sexpr2xmltest_LDADD = $(xen_LDADDS) +xlconfigtest_SOURCES = \ + xlconfigtest.c testutilsxen.c testutilsxen.h \ + testutils.c testutils.h +xlconfigtest_LDADD =$(xen_LDADDS) + xmconfigtest_SOURCES = \ xmconfigtest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h
tests/testutilsxen.c +50 -0
53 lines not on this page · raw message
tests/testutilsxen.h +8 -1
@@ -1,3 +1,10 @@ -#include "capabilities.h" +#ifndef _TESTUTILSXEN_H_ +# define _TESTUTILSXEN_H_ + +# include "capabilities.h" virCapsPtr testXenCapsInit (void ); + +virCapsPtr testXLInitCaps (void ); + +#endif /* _TESTUTILSXEN_H_ */
tests/xlconfigdata/test-new-disk.cfg new file +26 -0
@@ -0,0 +1,26 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem = 579 +memory = 394 +vcpus = 1 +builder = "hvm" +kernel = "/usr/lib/xen/boot/hvmloader" +boot = "d" +pae = 1 +acpi = 1 +apic = 1 +hap = 0 +viridian = 0 +localtime = 0 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +device_model = "/usr/lib/xen/bin/qemu-dm" +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,type=ioemu" ] +parallel = "none" +serial = "none" +disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy", "/var/lib/libvirt/images/XenGuest2-home,qcow2,hdb,w,backendtype=qdisk", "/root/boot.iso,raw,hdc,r,backendtype=qdisk,devtype=cdrom" ]
tests/xlconfigdata/test-new-disk.xml new file +51 -0
51 lines not on this page · raw message
tests/xlconfigdata/test-spice.cfg new file +32 -0
@@ -0,0 +1,32 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem = 579 +memory = 394 +vcpus = 1 +builder = "hvm" +kernel = "/usr/lib/xen/boot/hvmloader" +boot = "d" +pae = 1 +acpi = 1 +apic = 1 +hap = 0 +viridian = 0 +rtc_timeoffset = 0 +localtime = 1 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +device_model = "/usr/lib/xen/bin/qemu-dm" +vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ] +parallel = "none" +serial = "none" +disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,", "/root/boot.iso,raw,hdc,w," ] +sdl = 0 +vnc = 0 +spice = 1 +spicehost = "127.0.0.1" +spiceport = 590 +spicetls_port = 500 +spicedisable_ticketing = 1 +spicepasswd = "thebeast" +spiceagent_mouse = 0
tests/xlconfigdata/test-spice.xml new file +45 -0
45 lines not on this page · raw message
tests/xlconfigtest.c new file +225 -0
225 lines not on this page · raw message
Signature · 1 line
1.8.4.5
PATCH v4 3/3 libxl: Add support for parsing/formating Xen XL config
In reply to a message not in the archiveFrom: Kiarie Kahurani <[email protected]>
Now that xenconfig supports parsing and formatting Xen's XL config format, integrate it into the libxl driver's connectDomainXML{From,To}Native functions.
---
V4:
Note support for new 'xen-xl' format in virsh man page.
src/libxl/libxl_driver.c | 32 ++++++++++++++++++++++++-------- tools/virsh.pod | 8 ++++---- 2 files changed, 28 insertions(+), 12 deletions(-)
src/libxl/libxl_driver.c +24 -8
@@ -48,6 +48,7 @@#include "libxl_migration.h" #include "xen_xm.h" #include "xen_sxpr.h" +#include "xen_xl.h" #include "virtypedparam.h" #include "viruri.h" #include "virstring.h"
@@ -67,6 +68,7 @@ VIR_LOG_INIT("libxl.libxl_driver");#define LIBXL_DOM_REQ_CRASH 3#define LIBXL_DOM_REQ_HALT 4 +#define LIBXL_CONFIG_FORMAT_XL "xen-xl"#define LIBXL_CONFIG_FORMAT_XM "xen-xm"#define LIBXL_CONFIG_FORMAT_SEXPR "xen-sxpr"
@@ -2214,7 +2216,17 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,if (virConnectDomainXMLFromNativeEnsureACL (conn) <0 ) goto cleanup; -if (STREQ (nativeFormat,LIBXL_CONFIG_FORMAT_XM )) { +if (STREQ (nativeFormat,LIBXL_CONFIG_FORMAT_XL )) { +if (!(conf =virConfReadMem (nativeConfig,strlen (nativeConfig),0 ))) + goto cleanup; +if (!(def =xenParseXL (conf, + cfg->caps, + cfg->verInfo->xen_version_major))) { +virReportError (VIR_ERR_INTERNAL_ERROR ,"%s" , +_ ("parsing xl config failed" )); + goto cleanup; + } + }else if (STREQ (nativeFormat,LIBXL_CONFIG_FORMAT_XM )) {if (!(conf =virConfReadMem (nativeConfig,strlen (nativeConfig),0 ))) goto cleanup;
@@ -2269,20 +2281,24 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,if (virConnectDomainXMLToNativeEnsureACL (conn) <0 ) goto cleanup; -if (STRNEQ (nativeFormat,LIBXL_CONFIG_FORMAT_XM )) { -virReportError (VIR_ERR_INVALID_ARG , -_ ("unsupported config type %s" ), nativeFormat); - goto cleanup; - } -if (!(def =virDomainDefParseString (domainXml, cfg->caps, driver->xmlopt,1 <<VIR_DOMAIN_VIRT_XEN ,VIR_DOMAIN_XML_INACTIVE ))) goto cleanup; -if (!(conf =xenFormatXM (conn, def, cfg->verInfo->xen_version_major))) +if (STREQ (nativeFormat,LIBXL_CONFIG_FORMAT_XL )) { +if (!(conf =xenFormatXL (def, conn, cfg->verInfo->xen_version_major))) + goto cleanup; + }else if (STREQ (nativeFormat,LIBXL_CONFIG_FORMAT_XM )) { +if (!(conf =xenFormatXM (conn, def, cfg->verInfo->xen_version_major))) + goto cleanup; + }else { + +virReportError (VIR_ERR_INVALID_ARG , +_ ("unsupported config type %s" ), nativeFormat); goto cleanup; + }if (VIR_ALLOC_N (ret, len) <0 ) goto cleanup;
tools/virsh.pod +4 -4
@@ -1272,16 +1272,16 @@ in order to get or set the guest time. Convert the file I<config> in the native guest configuration format named by I<format> to a domain XML format. For QEMU/KVM hypervisor, the I<format> argument must be B<qemu-argv>. For Xen hypervisor, the -I<format> argument may be B<xen-xm> or B<xen-sxpr>. For LXC hypervisor, -the I<format> argument must be B<lxc-tools>. +I<format> argument may be B<xen-xm>, B<xen-xl>, or B<xen-sxpr>. For +LXC hypervisor, the I<format> argument must be B<lxc-tools>. =item B<domxml-to-native> I<format> I<xml> Convert the file I<xml> in domain XML format to the native guest configuration format named by I<format>. For QEMU/KVM hypervisor, the I<format> argument must be B<qemu-argv>. For Xen hypervisor, the -I<format> argument may be B<xen-xm> or B<xen-sxpr>. For LXC hypervisor, -the I<format> argument must be B<lxc-tools>. +I<format> argument may be B<xen-xm>, B<xen-xl>, or B<xen-sxpr>. For +LXC hypervisor, the I<format> argument must be B<lxc-tools>. =item B<dump> I<domain> I<corefilepath> [I<--bypass-cache>] { [I<--live>] | [I<--crash>] | [I<--reset>] } [I<--verbose>] [I<--memory-only>]
Signature · 1 line
1.8.4.5
Re: [libvirt] [PATCH V4 0/3] Parser for xen-xl config format
In reply to a message not in the archiveQuoted 9 lines · Jim Fehlig
It's been a long, twisting road to V4 of the Xen xl parser. V3 [1] was based on a flex-based parser that was copied from the Xen project and proved to be a bit challenging to integrate properly with autotools. But as it turns out, Xen provides an interface to the parser via libxlutil. I hadn't realized this interface was available for external consumption since the corresponding header file was never installed. Patch sent to xen-devel [2] to install the header, but in the meantime need to declare gthe imported libxlutil functions as extern (see patch 1).
Quoted 6 lines
V4 uses libxlutil, which has simplified the series quite a bit and eliminates the potential of the copied flex parser diverging from the canonical source in xen.git.
[1] https://www.redhat.com/archives/libvir-list/2014-December/msg00765.html
[2] http://lists.xen.org/archives/html/xen-devel/2015-01/msg00690.html
Yay - this series compiled on RHEL 5, with no extra efforts on my part.
I'll review the individual patches as well, but we're already looking
better.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines · Jim Fehlig
Introduce a parser/formatter for the xl config format. Since the deprecation of xm/xend, the VM config file format has diverged as new features are added to libxl. This patch adds support for parsing and formating the xl config format. It supports the existing xm config format, plus adds support for spice graphics and xl disk config syntax.
xl disk config is parsed with the help of
xlu_disk_parse()from libxlutil, libxl's utility library. Although the library exists in all Xen versions supported by the libxl virt driver, only recently has the corresponding header file been included. A check for the header is done in configure.ac. If not found,xlu_disk_parse()is declared externally.Signed-off-by Kiarie Kahurani <[email protected]>Signed-off-by Jim Fehlig <[email protected]>---
+++ b/src/Makefile.am
src/Makefile.am XENCONFIG_SOURCES = \ · line 1011
Quoted 7 lines
src/Makefile.am +4
-0@@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \ xenconfig/xen_common.c xenconfig/xen_common.h \ xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h +if WITH_LIBXL +XENCONFIG_SOURCES += \ + xenconfig/xen_xl.c xenconfig/xen_xl.h +endif WITH_LIBXL
Missing an EXTRA_DIST listing to ensure these two files are part of a tarball even when configure does not build libxl sources (that is, make sure 'make distcheck' will not fail if configured on a machine without libxl support).
src/xenconfig/xen_xl.c line 188
Quoted 6 lines
src/xenconfig/xen_xl.c new file +5
-0+xenParseXLDisk(virConfPtr conf, virDomainDefPtr def) + while (list) { +const char *disk_spec = list->str; + +if ((list->type !=VIR_CONF_STRING ) || (list->str ==NULL ))
Over-parenthesized.
Quoted 7 lines
src/xenconfig/xen_xl.c new file +7
-0+ goto skipdisk; + +libxl_device_disk_init (libxldisk); + +if (xlu_disk_parse (xluconf,1 , &disk_spec, libxldisk)) + goto fail; +
src/xenconfig/xen_xl.c line 205
Quoted 10 lines
src/xenconfig/xen_xl.c new file +10
-0+if (!(disk =virDomainDiskDefNew ())) + goto fail; + +if (VIR_STRDUP (disk->dst, libxldisk->vdev) <0 ) + goto fail; + +if (virDomainDiskSetSource (disk, libxldisk->pdev_path) <0 ) + goto fail; + + disk->src->readonly = libxldisk->readwrite ?0 :1 ;
Isn't disk->src->readonly a bool? In which case, this should be:
disk->src->readonly = !libxldisk->readwrite;
for correct typing.
I'd wait for John to confirm that Coverity is happy, but ACK if you fix the spots I pointed out.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [libvirt] [PATCH V4 2/3] tests: Tests for the xen-xl parser
In reply to Jim FehligQuoted 13 lines · Jim Fehlig
From: Kiarie Kahurani <[email protected]>
add tests for the
xen_xlconfig parserSigned-off-by Kiarie Kahurani <[email protected]>Signed-off-by Jim Fehlig <[email protected]>---
V4:
Only build xlconfigtest when libxl is available.
tests/Makefile.am if WITH_XEN · line 234
Quoted 7 lines
tests/Makefile.am +4
-0@@ -227,6 +228,11 @@ if WITH_XEN test_programs += xml2sexprtest sexpr2xmltest \ xmconfigtest xencapstest statstest reconnect endif WITH_XEN + +if WITH_LIBXL +test_programs += xlconfigtest +endif WITH_LIBXL
Nice.
tests/xlconfigtest.c line 218
Quoted 4 lines
tests/xlconfigtest.c new file +4
-0+ +DO_TEST ("new-disk" ,3 ); +// DO_TEST("spice", 3); +
Do we still need this comment?
ACK with that resolved.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [libvirt] [PATCH V4 3/3] libxl: Add support for parsing/formating Xen XL config
In reply to a message not in the archiveQuoted 8 lines · Jim Fehlig
From: Kiarie Kahurani <[email protected]>
Now that xenconfig supports parsing and formatting Xen's XL config format, integrate it into the libxl driver's connectDomainXML{From,To}Native functions.
Signed-off-by Kiarie Kahurani <[email protected]>Signed-off-by Jim Fehlig <[email protected]>
Quoted 9 lines
---
V4:
Note support for new 'xen-xl' format in virsh man page.src/libxl/libxl_driver.c | 32 ++++++++++++++++++++++++-------- tools/virsh.pod | 8 ++++---- 2 files changed, 28 insertions(+), 12 deletions(-)
Thanks for the man page docs.
[Someday, I'd like to add an API or modify an existing capability API that returns XML to make it possible to query at runtime what formats are supported by the format-{to,from}-native calls - but that doesn't have to hold up this series]
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [libvirt] [PATCH V4 0/3] Parser for xen-xl config format
In reply to a message not in the archiveQuoted 41 lines · Jim Fehlig
It's been a long, twisting road to V4 of the Xen xl parser. V3 [1] was based on a flex-based parser that was copied from the Xen project and proved to be a bit challenging to integrate properly with autotools. But as it turns out, Xen provides an interface to the parser via libxlutil. I hadn't realized this interface was available for external consumption since the corresponding header file was never installed. Patch sent to xen-devel [2] to install the header, but in the meantime need to declare gthe imported libxlutil functions as extern (see patch 1).
V4 uses libxlutil, which has simplified the series quite a bit and eliminates the potential of the copied flex parser diverging from the canonical source in xen.git.
[1] https://www.redhat.com/archives/libvir-list/2014-December/msg00765.html
[2] http://lists.xen.org/archives/html/xen-devel/2015-01/msg00690.htmlJim Fehlig (1):
Introduce support for parsing/formatting Xen xl config formatKiarie Kahurani (2):
tests: Tests for the xen-xl parser
libxl: Add support for parsing/formating Xen XL configconfigure.ac | 3 + po/POTFILES.in | 1 + src/Makefile.am | 11 + src/libvirt_xenxlconfig.syms | 12 + src/libxl/libxl_driver.c | 32 ++- src/xenconfig/xen_common.c | 3 +- src/xenconfig/xen_xl.c | 515 +++++++++++++++++++++++++++++++++++ src/xenconfig/xen_xl.h | 35 +++ tests/Makefile.am | 11 + tests/testutilsxen.c | 50 ++++ tests/testutilsxen.h | 9 +- tests/xlconfigdata/test-new-disk.cfg | 26 ++ tests/xlconfigdata/test-new-disk.xml | 51 ++++ tests/xlconfigdata/test-spice.cfg | 32 +++ tests/xlconfigdata/test-spice.xml | 45 +++ tests/xlconfigtest.c | 225 +++++++++++++++ tools/virsh.pod | 8 +- 17 files changed, 1055 insertions(+), 14 deletions(-)
Quoted 9 lines
create mode 100644 src/libvirt_xenxlconfig.syms create mode 100644 src/xenconfig/xen_xl.c create mode 100644 src/xenconfig/xen_xl.h create mode 100644 tests/xlconfigdata/test-new-disk.cfg create mode 100644 tests/xlconfigdata/test-new-disk.xml create mode 100644 tests/xlconfigdata/test-spice.cfg create mode 100644 tests/xlconfigdata/test-spice.xml create mode 100644 tests/xlconfigtest.c
My Coverity run was happy with the changes.
John
Quoted 28 lines · Eric Blake
Quoted 26 lines · Jim Fehlig
Introduce a parser/formatter for the xl config format. Since the deprecation of xm/xend, the VM config file format has diverged as new features are added to libxl. This patch adds support for parsing and formating the xl config format. It supports the existing xm config format, plus adds support for spice graphics and xl disk config syntax.
xl disk config is parsed with the help of
xlu_disk_parse()from libxlutil, libxl's utility library. Although the library exists in all Xen versions supported by the libxl virt driver, only recently has the corresponding header file been included. A check for the header is done in configure.ac. If not found,xlu_disk_parse()is declared externally.Signed-off-by Kiarie Kahurani <[email protected]>Signed-off-by Jim Fehlig <[email protected]>---
+++ b/src/Makefile.amsrc/Makefile.am +2
-0@@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \ xenconfig/xen_common.c xenconfig/xen_common.h \ xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h +if WITH_LIBXL +XENCONFIG_SOURCES += \
Quoted 9 lines
src/Makefile.am XENCONFIG_SOURCES = \ · line 1012
Quoted 3 lines
src/Makefile.am +2
-0+ xenconfig/xen_xl.c xenconfig/xen_xl.h +endif WITH_LIBXLMissing an
EXTRA_DISTlisting to ensure these two files are part of a tarball even when configure does not build libxl sources (that is, make sure 'make distcheck' will not fail if configured on a machine without libxl support).
Several of the tests fail on the old distro I'm testing on, which causes 'make distcheck' to fail. But I assumed I could simulate it on a newer distro with 'configure --without-libxl', yet 'make distcheck' succeeds and the files are included in the tarball. Are you seeing a failure on RHEL5?
Regards,
Jim
Re: [libvirt] [PATCH V4 2/3] tests: Tests for the xen-xl parser
In reply to a message not in the archiveQuoted 29 lines · Eric Blake
Quoted 15 lines · Jim Fehlig
From: Kiarie Kahurani <[email protected]>
add tests for the
xen_xlconfig parserSigned-off-by Kiarie Kahurani <[email protected]>Signed-off-by Jim Fehlig <[email protected]>---
V4:
Only build xlconfigtest when libxl is available.tests/Makefile.am if WITH_XEN · line 235
Quoted 8 lines
tests/Makefile.am +4
-0@@ -227,6 +228,11 @@ if WITH_XEN test_programs += xml2sexprtest sexpr2xmltest \ xmconfigtest xencapstest statstest reconnect endif WITH_XEN + +if WITH_LIBXL +test_programs += xlconfigtest +endif WITH_LIBXLNice.
Quoted 8 lines
tests/xlconfigtest.c line 218
Quoted 5 lines
tests/xlconfigtest.c new file +4
-0+ +DO_TEST ("new-disk" ,3 ); +// DO_TEST("spice", 3); +Do we still need this comment?
Wow, I can't believe I missed that. Thanks for catching it. This series is quite old and I forgot about this todo item. Enabling the spice test not only exposed problems with the xlconfigdata test files, but caught a bug in the xen-xl parser too! I'll fix those in V5 after seeing your answer to my question in 1/3.
Regards,
Jim
Quoted 17 lines · Jim Fehlig
Quoted 7 lines
Quoted 7 lines
+++ b/src/Makefile.am
src/Makefile.am +2
-0@@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \ xenconfig/xen_common.c xenconfig/xen_common.h \ xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h +if WITH_LIBXL +XENCONFIG_SOURCES += \Quoted 9 lines
src/Makefile.am XENCONFIG_SOURCES = \ · line 1012
Quoted 3 lines
src/Makefile.am +2
-0+ xenconfig/xen_xl.c xenconfig/xen_xl.h +endif WITH_LIBXLMissing an
EXTRA_DISTlisting to ensure these two files are part of a tarball even when configure does not build libxl sources (that is, make sure 'make distcheck' will not fail if configured on a machine without libxl support).
Quoted 5 lines
Several of the tests fail on the old distro I'm testing on, which causes 'make distcheck' to fail. But I assumed I could simulate it on a newer distro with 'configure --without-libxl', yet 'make distcheck' succeeds and the files are included in the tarball. Are you seeing a failure on RHEL5?
I haven't yet tested a 'make distcheck' on that particular VM of mine; I'll fire one off and see what happens. It might be simpler to just to check that if 'make dist' is run when configured --without-libxl, then it still includes both files in the tarball.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 27 lines · Eric Blake
Quoted 17 lines · Jim Fehlig
Quoted 7 lines
Quoted 7 lines
+++ b/src/Makefile.am
src/Makefile.am +2
-0@@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \ xenconfig/xen_common.c xenconfig/xen_common.h \ xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h +if WITH_LIBXL +XENCONFIG_SOURCES += \Quoted 10 lines
src/Makefile.am XENCONFIG_SOURCES = \ · line 1014
Quoted 4 lines
src/Makefile.am +2
-0+ xenconfig/xen_xl.c xenconfig/xen_xl.h +endif WITH_LIBXLMissing an
EXTRA_DISTlisting to ensure these two files are part of a tarball even when configure does not build libxl sources (that is, make sure 'make distcheck' will not fail if configured on a machine without libxl support).Quoted 6 lines
Several of the tests fail on the old distro I'm testing on, which causes 'make distcheck' to fail. But I assumed I could simulate it on a newer distro with 'configure --without-libxl', yet 'make distcheck' succeeds and the files are included in the tarball. Are you seeing a failure on RHEL5?
Quoted 5 lines
I haven't yet tested a 'make distcheck' on that particular VM of mine; I'll fire one off and see what happens. It might be simpler to just to check that if 'make dist' is run when configured --without-libxl, then it still includes both files in the tarball.
I've verified src/xenconfig/xen_xl.[ch] are included in the tarball when configured --without-libxl. I've sent a V5 which addresses all of your V4 comments
https://www.redhat.com/archives/libvir-list/2015-January/msg00494.html
Regards,
Jim