Long ago danpb posted some patches to test libvirt domXML to libxl_domain_config conversion https://www.redhat.com/archives/libvir-list/2014-May/msg01102.html Some of the prerequisite patches were pushed, but we've never managed to push patches actually providing the conversion tests. I sent several follow-ups to Dan's work but never converged on a satisfactory solution for all the Xen versions supported by libvirt. The last attempt was in Sept 2014 https://www.redhat.com/archives/libvir-list/2014-September/msg00698.html I tried to revive the work in Jan 2015, but that also stalled https://www.redhat.com/archives/libvir-list/2015-January/msg00924.html Fast-forward over 2.5 years from the first attempt and libvirt no longer supports older Xen versions 4.2 and 4.3 that were proving to be problematic. Starting with Xen 4.5 libxl added support for libxl_domain_config_from_json, which provides a way to implement the conversion tests that work with all Xen versions >= 4.5 (including latest xen.git master). The previous approaches compared a static json doc with the results of domXML->libxl_domain_config conversion done in the libxl driver. As discussed in those approaches, the json doc returned from libxl_domain_config_to_json can change over Xen releases as the libxl_domain_config object gains new fields, making it difficult to compare the conversion with a static doc. I had some time last week to pick at this thorn and reworked the test to make use of libxl_domain_config_from_json introduced in Xen 4.5. Instead of comparing the conversion results directly to a static json doc, the static doc is first round-tripped through _from_json -> _to_json. Any new fields added to libxl_domain_config object are then included in both docs, allowing comparison across multiple Xen releases. Patch3 provides the conversion tests using this new approach. The tests are not run on Xen 4.4 (oldest version currently supported by libvirt) since it does not provide libxl_domain_config_from_json. Patches 1 and 2 fix some issues found while working on the tests. See their commit messages for details. Jim Fehlig (3): libxl: determine device model version from emulator name libxl: relax checks on <emulator> libxl: Add a test suite for libxl_domain_config generator m4/virt-driver-libxl.m4 | 6 +- src/libxl/libxl_capabilities.c | 37 ++--- src/libxl/libxl_conf.c | 14 -- tests/Makefile.am | 18 ++- tests/libxlxml2domconfigdata/basic-hvm.json | 89 +++++++++++ tests/libxlxml2domconfigdata/basic-hvm.xml | 36 +++++ tests/libxlxml2domconfigdata/basic-pv.json | 65 ++++++++ tests/libxlxml2domconfigdata/basic-pv.xml | 28 ++++ tests/libxlxml2domconfigdata/moredevs-hvm.json | 111 +++++++++++++ tests/libxlxml2domconfigdata/moredevs-hvm.xml | 63 ++++++++ tests/libxlxml2domconfigtest.c | 208 +++++++++++++++++++++++++ tests/virmocklibxl.c | 87 +++++++++++ 12 files changed, 723 insertions(+), 39 deletions(-) create mode 100644 tests/libxlxml2domconfigdata/basic-hvm.json create mode 100644 tests/libxlxml2domconfigdata/basic-hvm.xml create mode 100644 tests/libxlxml2domconfigdata/basic-pv.json create mode 100644 tests/libxlxml2domconfigdata/basic-pv.xml create mode 100644 tests/libxlxml2domconfigdata/moredevs-hvm.json create mode 100644 tests/libxlxml2domconfigdata/moredevs-hvm.xml create mode 100644 tests/libxlxml2domconfigtest.c create mode 100644 tests/virmocklibxl.c -- 2.11.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list