diff mbox

[v6,1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly

Message ID 1459403346-28677-2-git-send-email-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß March 31, 2016, 5:49 a.m. UTC
In case libxl__need_xenpv_qemu() returns an error let domain creation
fail.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V6: Add comment regarding return values of libxl__need_xenpv_qemu()
    as requested by Wei Liu
---
 tools/libxl/libxl_create.c | 7 ++++---
 tools/libxl/libxl_dm.c     | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Wei Liu March 31, 2016, 2:25 p.m. UTC | #1
On Thu, Mar 31, 2016 at 07:49:01AM +0200, Juergen Gross wrote:
> In case libxl__need_xenpv_qemu() returns an error let domain creation
> fail.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

Ian, this is a  backport candidate.

Wei.
Ian Jackson April 8, 2016, 1:55 p.m. UTC | #2
Wei Liu writes ("Re: [PATCH v6 1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly"):
> On Thu, Mar 31, 2016 at 07:49:01AM +0200, Juergen Gross wrote:
> > In case libxl__need_xenpv_qemu() returns an error let domain creation
> > fail.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> Ian, this is a  backport candidate.

Queued for backport.

Ian.
Ian Jackson May 9, 2016, 5:11 p.m. UTC | #3
Ian Jackson writes ("Re: [PATCH v6 1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly"):
> Wei Liu writes ("Re: [PATCH v6 1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly"):
> > On Thu, Mar 31, 2016 at 07:49:01AM +0200, Juergen Gross wrote:
> > > In case libxl__need_xenpv_qemu() returns an error let domain creation
> > > fail.
> 
> Queued for backport.

Pushed to 4.5 and 4.6.

Ian.
diff mbox

Patch

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 61b5c01..763996c 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1304,7 +1304,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;
 
@@ -1315,16 +1314,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 cfda24c..eb8961d 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2113,6 +2113,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,