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

[Xen-changelog] [xen stable-4.5] libxl: handle error from libxl__need_xenpv_qemu() correctly



commit 350eb394166d18a754b4954723c8373dfe652520
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Mar 30 17:33:29 2016 +0200
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon May 9 18:08:14 2016 +0100

    libxl: handle error from libxl__need_xenpv_qemu() correctly
    
    In case libxl__need_xenpv_qemu() returns an error let domain creation
    fail.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    (cherry picked from commit 1a7ac00fa69de7431349d9583a2b8ed724711360)
    (cherry picked from commit e7e194074adf896c226caaa778f6f4c8abfb1023)
---
 tools/libxl/libxl_create.c | 7 ++++---
 tools/libxl/libxl_dm.c     | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index b6fa4b0..152fdbc 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1264,7 +1264,6 @@ static void domcreate_launch_dm(libxl__egc *egc, 
libxl__multidev *multidev,
     }
     case LIBXL_DOMAIN_TYPE_PV:
     {
-        int need_qemu = 0;
         libxl__device_console console;
         libxl__device device;
 
@@ -1275,16 +1274,18 @@ static void domcreate_launch_dm(libxl__egc *egc, 
libxl__multidev *multidev,
 
         init_console_info(gc, &console, 0);
 
-        need_qemu = libxl__need_xenpv_qemu(gc, 1, &console,
+        ret = libxl__need_xenpv_qemu(gc, 1, &console,
                 d_config->num_vfbs, d_config->vfbs,
                 d_config->num_disks, &d_config->disks[0],
                 d_config->num_channels, &d_config->channels[0]);
+        if (ret < 0)
+            goto error_out;
 
         console.backend_domid = state->console_domid;
         libxl__device_console_add(gc, domid, &console, state, &device);
         libxl__device_console_dispose(&console);
 
-        if (need_qemu) {
+        if (ret) {
             dcs->dmss.dm.guest_domid = domid;
             libxl__spawn_local_dm(egc, &dcs->dmss.dm);
             return;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index d74fb14..8cec460 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1648,6 +1648,7 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t 
domid)
                 GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
 }
 
+/* Return 0 if no dm needed, 1 if needed and <0 if error. */
 int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl__device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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