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 1/3] move stubdom make into a proper function
Date: Wed, 7 Jul 2010 14:00:54 +0100 [thread overview]
Message-ID: <1278507656-7745-2-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: 243 bytes --]
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
---
tools/libxl/libxl.c | 72 ++++++++++++++++++++++++++++++++------------------
tools/libxl/libxl.h | 10 +++++++
2 files changed, 56 insertions(+), 26 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-move-stubdom-make-into-a-proper-function.patch --]
[-- Type: text/x-patch; name="0001-move-stubdom-make-into-a-proper-function.patch", Size: 5500 bytes --]
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 293aaa7..bf2c7e8 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -80,7 +80,7 @@ int libxl_ctx_free(struct libxl_ctx *ctx)
/******************************************************************************/
int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info,
- uint32_t *domid)
+ uint32_t *domid)
{
int flags, ret, i, rc;
char *uuid_string;
@@ -1020,6 +1020,41 @@ retry_transaction:
return 0;
}
+int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
+ libxl_domain_build_state *state, uint32_t *domid)
+{
+ int ret, i;
+ libxl_domain_create_info c_info;
+ libxl_domain_build_info b_info;
+
+ memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
+ c_info.hvm = 0;
+ c_info.name = libxl_sprintf(ctx, "%s-dm", libxl_domid_to_name(ctx, info->target_domid));
+ for (i = 0; i < 16; i++)
+ c_info.uuid[i] = info->uuid[i];
+
+ memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
+ b_info.max_vcpus = 1;
+ b_info.max_memkb = info->max_memkb;
+ b_info.target_memkb = b_info.max_memkb;
+ b_info.kernel = libxl_abs_path(ctx, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
+ b_info.u.pv.cmdline = libxl_sprintf(ctx, " -d %d", info->target_domid);
+ b_info.u.pv.ramdisk = "";
+ b_info.u.pv.features = "";
+ b_info.hvm = 0;
+
+ ret = libxl_domain_make(ctx, &c_info, domid);
+ if (ret)
+ return ret;
+ ret = libxl_domain_build(ctx, &b_info, *domid, state);
+ if (ret)
+ return ret;
+
+ xc_domain_set_target(ctx->xch, *domid, info->target_domid);
+ xs_set_target(ctx->xsh, *domid, info->target_domid);
+ return 0;
+}
+
static int libxl_create_stubdom(struct libxl_ctx *ctx,
libxl_device_model_info *info,
libxl_device_disk *disks, int num_disks,
@@ -1030,40 +1065,27 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
{
int i, num_console = 1, ret;
libxl_device_console *console;
- libxl_domain_create_info c_info;
- libxl_domain_build_info b_info;
libxl_domain_build_state state;
uint32_t domid;
char **args;
struct xs_permissions perm[2];
xs_transaction_t t;
libxl_device_model_starting *dm_starting = 0;
+ libxl_stubdom_create_info stubinfo;
+
+ /* initialize stubinfo create structure */
+ stubinfo.target_domid = info->domid;
+ stubinfo.max_memkb = 32 * 1024;
+ for (i = 0; i < 16; i++)
+ stubinfo.uuid[i] = info->uuid[i];
+ ret = libxl_stubdom_make(ctx, &stubinfo, &state, &domid);
+ if (ret)
+ return ret;
args = libxl_build_device_model_args(ctx, info, vifs, num_vifs);
if (!args)
return ERROR_FAIL;
- memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
- c_info.hvm = 0;
- c_info.name = libxl_sprintf(ctx, "%s-dm", libxl_domid_to_name(ctx, info->domid));
- for (i = 0; i < 16; i++)
- c_info.uuid[i] = info->uuid[i];
-
- memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
- b_info.max_vcpus = 1;
- b_info.max_memkb = 32 * 1024;
- b_info.target_memkb = b_info.max_memkb;
- b_info.kernel = libxl_abs_path(ctx, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
- b_info.u.pv.cmdline = libxl_sprintf(ctx, " -d %d", info->domid);
- b_info.u.pv.ramdisk = "";
- b_info.u.pv.features = "";
- b_info.hvm = 0;
-
- ret = libxl_domain_make(ctx, &c_info, &domid);
- if (ret) return ret;
- ret = libxl_domain_build(ctx, &b_info, domid, &state);
- if (ret) return ret;
-
libxl_write_dmargs(ctx, domid, info->domid, args);
libxl_xs_write(ctx, XBT_NULL,
libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, info->domid)),
@@ -1071,8 +1093,6 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
libxl_xs_write(ctx, XBT_NULL,
libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)),
"%d", info->domid);
- xc_domain_set_target(ctx->xch, domid, info->domid);
- xs_set_target(ctx->xsh, domid, info->domid);
perm[0].id = domid;
perm[0].perms = XS_PERM_NONE;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 85f8196..a0a3a1a 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -121,6 +121,13 @@ typedef struct {
} libxl_domain_build_info;
typedef struct {
+ uint8_t uuid[16];
+ char *name;
+ uint32_t max_memkb;
+ uint32_t target_domid;
+} libxl_stubdom_create_info;
+
+typedef struct {
uint32_t store_port;
unsigned long store_mfn;
uint32_t console_port;
@@ -364,6 +371,9 @@ struct libxl_dominfo * libxl_list_domain(struct libxl_ctx*, int *nb_domain);
struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx*, int *nb_pool);
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_create_device_model(struct libxl_ctx *ctx,
libxl_device_model_info *info,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev 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 ` Vincent Hanquez [this message]
2010-07-07 13:00 ` [PATCH 2/3] let the user of libxenlight choose explicitely if it want to start a stubdom or not Vincent Hanquez
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-2-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).