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

[Xen-changelog] [xen staging] libxl: fix libxl_domain_need_memory after 899433f149d



commit 278c64519c661c851d37e2a929f006fb8a1dcd01
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Fri May 17 18:05:55 2019 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon May 20 15:14:14 2019 +0100

    libxl: fix libxl_domain_need_memory after 899433f149d
    
    After 899433f149d libxl needs to know the content of d_config to
    determine which QEMU is used. The code is changed such that
    libxl__domain_set_device_model needs to be called before
    libxl__domain_build_info_setdefault.
    
    This is fine for libxl code, but it is problematic for
    libxl_domain_need_memory, which is the only public API that takes a
    build_info. To avoid breaking its users, provide a compatibility
    setting inside that function.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_mem.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index 448a2af8fd..4446754186 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -457,6 +457,24 @@ int libxl_domain_need_memory(libxl_ctx *ctx,
     libxl_domain_build_info_init(b_info);
     libxl_domain_build_info_copy(ctx, b_info, b_info_in);
 
+    /*
+     * It has become a requirement that to figure out which QEMU to
+     * use, libxl will need to peek d_config's content. The code has
+     * been changed such that one will need to call
+     * libxl__domain_set_device_model before calling
+     * libxl__domain_build_info_setdefault inside libxl.
+     *
+     * This (problematic) public API is the only one which takes a
+     * b_info. Imposing the same requirement on the users of this
+     * public API will break them.
+     *
+     * Provide a compatibility setting for this function. The
+     * calculation doesn't really care which QEMU is set here, so we
+     * go with the upstream default.
+     */
+    if (!b_info->device_model_version)
+        b_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
+
     rc = libxl__domain_build_info_setdefault(gc, b_info);
     if (rc) goto out;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.