xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>,
	wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com,
	George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
	cyliu@suse.com
Subject: [PATCH v6 1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly
Date: Thu, 31 Mar 2016 07:49:01 +0200	[thread overview]
Message-ID: <1459403346-28677-2-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1459403346-28677-1-git-send-email-jgross@suse.com>

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(-)

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,
-- 
2.6.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-03-31  5:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  5:49 [PATCH v6 0/6] libxl: add support for qemu base pvusb backend Juergen Gross
2016-03-31  5:49 ` Juergen Gross [this message]
2016-03-31 14:25   ` [PATCH v6 1/6] libxl: handle error from libxl__need_xenpv_qemu() correctly Wei Liu
2016-04-08 13:55     ` Ian Jackson
2016-05-09 17:11       ` Ian Jackson
2016-03-31  5:49 ` [PATCH v6 2/6] libxl: make libxl__need_xenpv_qemu() operate on domain config Juergen Gross
2016-03-31 14:31   ` Wei Liu
2016-03-31  5:49 ` [PATCH v6 3/6] libxl: add query function for backend support by device model Juergen Gross
2016-03-31 14:33   ` Wei Liu
2016-03-31 14:34     ` Wei Liu
2016-04-01 14:23     ` Anthony PERARD
2016-04-01 14:57       ` Wei Liu
2016-03-31  5:49 ` [PATCH v6 4/6] libxl: add new pvusb backend "qusb" provided by qemu Juergen Gross
2016-03-31 14:37   ` Wei Liu
2016-03-31  5:49 ` [PATCH v6 5/6] libxl: add service function to check whether device model is running Juergen Gross
2016-03-31  5:49 ` [PATCH v6 6/6] libxl: check for dynamic device model start required Juergen Gross
2016-03-31 14:37   ` Wei Liu
2016-04-06 13:58 ` [PATCH v6 0/6] libxl: add support for qemu base pvusb backend Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459403346-28677-2-git-send-email-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=cyliu@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).