xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
To: Xen Devel <xen-devel@lists.xensource.com>
Cc: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Subject: [PATCH 2/3] let the user of libxenlight choose explicitely if it want to start a stubdom or not.
Date: Wed, 7 Jul 2010 14:00:55 +0100	[thread overview]
Message-ID: <1278507656-7745-3-git-send-email-vincent.hanquez@eu.citrix.com> (raw)
In-Reply-To: <1278507656-7745-1-git-send-email-vincent.hanquez@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]


the same mechanism of choosing stubdomain or not, depending on the qemu-dm
filename that was embedded in the libxenlight is moved to xl so that nothing
change. also expose more functions that the caller is expected to used now.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
---
 tools/libxl/libxl.c      |   30 +++++++++++-------------------
 tools/libxl/libxl.h      |   15 ++++++++++++++-
 tools/libxl/xl_cmdimpl.c |   12 ++++++++++--
 3 files changed, 35 insertions(+), 22 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-let-the-user-of-libxenlight-choose-explicitely-if-it.patch --]
[-- Type: text/x-patch; name="0002-let-the-user-of-libxenlight-choose-explicitely-if-it.patch", Size: 5252 bytes --]

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index bf2c7e8..811678f 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -949,10 +949,10 @@ void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
     xs_daemon_close(xsh);
 }
 
-static int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
-                                                    libxl_device_model_info *info,
-                                                    libxl_device_vfb *vfb,
-                                                    libxl_device_vkb *vkb)
+int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
+                                             libxl_device_model_info *info,
+                                             libxl_device_vfb *vfb,
+                                             libxl_device_vkb *vkb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
@@ -1055,13 +1055,13 @@ int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
     return 0;
 }
 
-static int libxl_create_stubdom(struct libxl_ctx *ctx,
-                                libxl_device_model_info *info,
-                                libxl_device_disk *disks, int num_disks,
-                                libxl_device_nic *vifs, int num_vifs,
-                                libxl_device_vfb *vfb,
-                                libxl_device_vkb *vkb,
-                                libxl_device_model_starting **starting_r)
+int libxl_stubdom_create(struct libxl_ctx *ctx,
+                         libxl_device_model_info *info,
+                         libxl_device_disk *disks, int num_disks,
+                         libxl_device_nic *vifs, int num_vifs,
+                         libxl_device_vfb *vfb,
+                         libxl_device_vkb *vkb,
+                         libxl_device_model_starting **starting_r)
 {
     int i, num_console = 1, ret;
     libxl_device_console *console;
@@ -1178,14 +1178,6 @@ int libxl_create_device_model(struct libxl_ctx *ctx,
     char *vm_path;
     char **pass_stuff;
 
-    if (strstr(info->device_model, "stubdom-dm")) {
-        libxl_device_vfb vfb;
-        libxl_device_vkb vkb;
-
-        libxl_vfb_and_vkb_from_device_model_info(ctx, info, &vfb, &vkb);
-        return libxl_create_stubdom(ctx, info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, starting_r);
-    }
-
     args = libxl_build_device_model_args(ctx, info, vifs, num_vifs);
     if (!args)
         return ERROR_FAIL;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index a0a3a1a..76f9b5c 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -336,6 +336,7 @@ typedef struct {
     char *token;
 } libxl_waiter;
 
+typedef struct libxl_device_model_starting libxl_device_model_starting;
 
 int libxl_get_wait_fd(struct libxl_ctx *ctx, int *fd);
 /* waiter is allocated by the caller */
@@ -374,7 +375,19 @@ struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm);
 int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
                        libxl_domain_build_state *state, uint32_t *domid);
 
-typedef struct libxl_device_model_starting libxl_device_model_starting;
+int libxl_stubdom_create(struct libxl_ctx *ctx,
+                         libxl_device_model_info *info,
+                         libxl_device_disk *disks, int num_disks,
+                         libxl_device_nic *vifs, int num_vifs,
+                         libxl_device_vfb *vfb,
+                         libxl_device_vkb *vkb,
+                         libxl_device_model_starting **starting_r);
+
+int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
+                                             libxl_device_model_info *info,
+                                             libxl_device_vfb *vfb,
+                                             libxl_device_vkb *vkb);
+
 int libxl_create_device_model(struct libxl_ctx *ctx,
                               libxl_device_model_info *info,
                               libxl_device_disk *disk, int num_disks,
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 208ecd6..a20e77a 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1151,8 +1151,16 @@ start:
     }
     if (info1.hvm) {
         dm_info.domid = domid;
-        MUST( libxl_create_device_model(&ctx, &dm_info, disks, num_disks,
-                                        vifs, num_vifs, &dm_starting) );
+        if (strstr(dm_info.device_model, "stubdom-dm")) {
+            libxl_device_vfb vfb;
+            libxl_device_vkb vkb;
+
+            libxl_vfb_and_vkb_from_device_model_info(&ctx, &dm_info, &vfb, &vkb);
+            MUST( libxl_stubdom_create(&ctx, &dm_info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, &dm_starting) );
+        } else {
+            MUST( libxl_create_device_model(&ctx, &dm_info, disks, num_disks,
+                                            vifs, num_vifs, &dm_starting) );
+        }
     } else {
         for (i = 0; i < num_vfbs; i++) {
             vfbs[i].domid = domid;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  parent reply	other threads:[~2010-07-07 13:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 13:00 [PATCH 0/3] libxl stubdom API cleanup Vincent Hanquez
2010-07-07 13:00 ` [PATCH 1/3] move stubdom make into a proper function Vincent Hanquez
2010-07-07 13:00 ` Vincent Hanquez [this message]
2010-07-07 13:00 ` [PATCH 3/3] stubdom_create returns stubdomain domid so that unpause is done by the user of libxenlight Vincent Hanquez
2010-07-07 16:53 ` [PATCH 0/3] libxl stubdom API cleanup Stefano Stabellini
2010-07-08 11:17   ` Vincent Hanquez
2010-07-08 14:03     ` Stefano Stabellini
2010-07-08 14:18       ` Ian Campbell
2010-07-08 16:27         ` Ian Jackson
2010-07-08 17:18         ` Vincent Hanquez
2010-07-09  7:52           ` Ian Campbell
2010-07-09  8:17         ` Tim Deegan
2010-07-09 10:44           ` Vincent Hanquez
2010-07-09 10:51             ` Tim Deegan
2010-07-09 10:59               ` Stefano Stabellini
2010-07-09 14:44                 ` Tim Deegan
2010-07-09 11:05               ` Vincent Hanquez
2010-07-09 17:04                 ` Ian Jackson
2010-07-09 17:58                   ` Stefano Stabellini
2010-07-12 16:46                     ` Ian Jackson
2010-07-11 22:14                   ` Vincent Hanquez

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=1278507656-7745-3-git-send-email-vincent.hanquez@eu.citrix.com \
    --to=vincent.hanquez@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).