xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 2/2] libxl: allow to create a domain without disks
Date: Thu, 26 Jul 2012 20:12:55 +0100	[thread overview]
Message-ID: <1343329975-33432-3-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1343329975-33432-1-git-send-email-roger.pau@citrix.com>

Without this patch, the process gets stuck waiting for someone to call
the callback, since no disk devices are added.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@eu.citrix.com>
---
 tools/libxl/libxl_create.c |   12 ++++++++----
 tools/libxl/libxl_dm.c     |   13 +++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 5859c09..3f129bf 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -907,11 +907,15 @@ static void domcreate_rebuild_done(libxl__egc *egc,
 
     store_libxl_entry(gc, domid, &d_config->b_info);
 
-    dcs->aodevs.size = d_config->num_disks;
-    dcs->aodevs.callback = domcreate_launch_dm;
-    libxl__prepare_ao_devices(ao, &dcs->aodevs);
-    libxl__add_disks(egc, ao, domid, 0, d_config, &dcs->aodevs);
+    if (d_config->num_disks > 0) {
+        dcs->aodevs.size = d_config->num_disks;
+        dcs->aodevs.callback = domcreate_launch_dm;
+        libxl__prepare_ao_devices(ao, &dcs->aodevs);
+        libxl__add_disks(egc, ao, domid, 0, d_config, &dcs->aodevs);
+        return;
+    }
 
+    domcreate_launch_dm(egc, &dcs->aodevs, 0);
     return;
 
  error_out:
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index f2e9572..667aec7 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -856,11 +856,16 @@ retry_transaction:
         if (errno == EAGAIN)
             goto retry_transaction;
 
-    sdss->aodevs.size = dm_config->num_disks;
-    sdss->aodevs.callback = spawn_stub_launch_dm;
-    libxl__prepare_ao_devices(ao, &sdss->aodevs);
-    libxl__add_disks(egc, ao, dm_domid, 0, dm_config, &sdss->aodevs);
+    if (dm_config->num_disks > 0) {
+        sdss->aodevs.size = dm_config->num_disks;
+        sdss->aodevs.callback = spawn_stub_launch_dm;
+        libxl__prepare_ao_devices(ao, &sdss->aodevs);
+        libxl__add_disks(egc, ao, dm_domid, 0, dm_config, &sdss->aodevs);
+        free(args);
+        return;
+    }
 
+    spawn_stub_launch_dm(egc, &sdss->aodevs, 0);
     free(args);
     return;
 
-- 
1.7.7.5 (Apple Git-26)

  parent reply	other threads:[~2012-07-26 19:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 19:12 [PATCH 0/2] libxl: fixes for device addition/removal Roger Pau Monne
2012-07-26 19:12 ` [PATCH 1/2] libxl: fix race in libxl__devices_destroy Roger Pau Monne
2012-07-27  8:15   ` Ian Campbell
2012-07-27 11:06     ` Ian Jackson
2012-07-27 13:44   ` Ian Jackson
2012-07-27 18:26     ` Ian Jackson
2012-07-31 13:26       ` Ian Campbell
2012-07-31 14:44         ` Ian Jackson
2012-07-31 14:48           ` Ian Campbell
2012-07-26 19:12 ` Roger Pau Monne [this message]
2012-07-27  8:22   ` [PATCH 2/2] libxl: allow to create a domain without disks Ian Campbell
2012-07-26 19:22 ` [PATCH 0/2] libxl: fixes for device addition/removal Roger Pau Monne

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=1343329975-33432-3-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=ian.campbell@eu.citrix.com \
    --cc=ian.jackson@eu.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).