[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 19 of 20] libxl: remove libxl_device_model_info



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1327336698 0
# Node ID 62bffbc5495b3e897d6fbb654453f2335556e06e
# Parent  4ef7e58d38791a1bbcb982e6f948ab1f0c805d5f
libxl: remove libxl_device_model_info.

All that is left here is the target domain's domid which we can pass around as
a parameter.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl.c       Mon Jan 23 16:38:18 2012 +0000
@@ -2370,7 +2370,7 @@ out:
 }
 
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb)
+                             uint32_t *need_memkb)
 {
     GC_INIT(ctx);
     int rc = ERROR_INVAL;
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl.h       Mon Jan 23 16:38:18 2012 +0000
@@ -230,7 +230,6 @@ enum {
 typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
-    libxl_device_model_info dm_info;
 
     int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
 
@@ -258,10 +257,6 @@ int libxl_init_create_info(libxl_ctx *ct
 int libxl_init_build_info(libxl_ctx *ctx,
                           libxl_domain_build_info *b_info,
                           libxl_domain_create_info *c_info);
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info);
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid);
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
@@ -359,7 +354,7 @@ int libxl_set_memory_target(libxl_ctx *c
 int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t 
*out_target);
 /* how much free memory in the system a domain needs to be built */
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb);
+                             uint32_t *need_memkb);
 /* how much free memory is available in the system */
 int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
 /* wait for a given amount of memory to be free in the system */
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Jan 23 16:38:18 2012 +0000
@@ -48,7 +48,6 @@ void libxl_domain_config_dispose(libxl_d
 
     libxl_domain_create_info_dispose(&d_config->c_info);
     libxl_domain_build_info_dispose(&d_config->b_info);
-    libxl_device_model_info_dispose(&d_config->dm_info);
 }
 
 int libxl_init_create_info(libxl_ctx *ctx, libxl_domain_create_info *c_info)
@@ -127,17 +126,6 @@ int libxl_init_build_info(libxl_ctx *ctx
     return 0;
 }
 
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info)
-{
-    memset(dm_info, '\0', sizeof(*dm_info));
-
-
-    return 0;
-}
-
 static int init_console_info(libxl_device_console *console, int dev_num)
 {
     memset(console, 0x00, sizeof(libxl_device_console));
@@ -151,7 +139,6 @@ static int init_console_info(libxl_devic
 
 int libxl__domain_build(libxl__gc *gc,
                         libxl_domain_build_info *info,
-                        libxl_device_model_info *dm_info,
                         uint32_t domid,
                         libxl__domain_build_state *state)
 {
@@ -167,7 +154,7 @@ int libxl__domain_build(libxl__gc *gc,
 
     switch (info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
-        ret = libxl__build_hvm(gc, domid, info, dm_info, state);
+        ret = libxl__build_hvm(gc, domid, info, state);
         if (ret)
             goto out;
 
@@ -221,8 +208,7 @@ out:
 
 static int domain_restore(libxl__gc *gc, libxl_domain_build_info *info,
                           uint32_t domid, int fd,
-                          libxl__domain_build_state *state,
-                          libxl_device_model_info *dm_info)
+                          libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char **vments = NULL, **localents = NULL;
@@ -474,7 +460,6 @@ static int do_domain_create(libxl__gc *g
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info *dm_info = &d_config->dm_info;
     libxl__domain_build_state state;
     uint32_t domid;
     int i, ret;
@@ -511,9 +496,9 @@ static int do_domain_create(libxl__gc *g
     memset(&state, 0, sizeof(state));
 
     if ( restore_fd >= 0 ) {
-        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, 
dm_info);
+        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state);
     } else {
-        ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, 
&state);
+        ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
     }
 
     if (ret) {
@@ -560,8 +545,7 @@ static int do_domain_create(libxl__gc *g
         libxl_device_vkb_add(ctx, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
 
-        dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, d_config, dm_info,
+        ret = libxl__create_device_model(gc, domid, d_config,
                                          &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -574,7 +558,6 @@ static int do_domain_create(libxl__gc *g
     {
         int need_qemu = 0;
         libxl_device_console console;
-        libxl_device_model_info xenpv_dm_info;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
@@ -596,11 +579,7 @@ static int do_domain_create(libxl__gc *g
         libxl_device_console_dispose(&console);
 
         if (need_qemu) {
-            /* only copy those useful configs */
-            memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-            libxl__create_xenpv_qemu(gc, domid, d_config,
-                                     &xenpv_dm_info, &state, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config, &state, 
&dm_starting);
         }
         break;
     }
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Mon Jan 23 16:38:18 2012 +0000
@@ -73,8 +73,7 @@ static const char *libxl__domain_bios(li
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -85,8 +84,7 @@ static const libxl_vnc_info *dm_vnc(cons
     return vnc && vnc->enable ? vnc : NULL;
 }
 
-static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config)
 {
     const libxl_sdl_info *sdl = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -97,8 +95,7 @@ static const libxl_sdl_info *dm_sdl(cons
     return sdl && sdl->enable ? sdl : NULL;
 }
 
-static const char *dm_keymap(const libxl_domain_config *guest_config,
-                             const libxl_device_model_info *info)
+static const char *dm_keymap(const libxl_domain_config *guest_config)
 {
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
@@ -109,18 +106,17 @@ static const char *dm_keymap(const libxl
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
-    const char *keymap = dm_keymap(guest_config, info);
+    const char *keymap = dm_keymap(guest_config);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -129,7 +125,7 @@ static char ** libxl__build_device_model
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-d", libxl__sprintf(gc, "%d", domid), NULL);
 
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
@@ -225,7 +221,8 @@ static char ** libxl__build_device_model
                                    LIBXL_MAC_FMT, 
LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname)
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, 
vifs[i].devid);
+                    ifname = libxl__sprintf(gc,
+                                            "tap%d.%d", domid, vifs[i].devid);
                 else
                     ifname = vifs[i].ifname;
                 flexarray_vappend(dm_args,
@@ -320,9 +317,8 @@ static char *dm_spice_options(libxl__gc 
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -332,9 +328,9 @@ static char ** libxl__build_device_model
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
-    const char *keymap = dm_keymap(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
+    const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
 
@@ -343,14 +339,14 @@ static char ** libxl__build_device_model
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-xen-domid", libxl__sprintf(gc, "%d", info->domid), 
NULL);
+                      "-xen-domid",
+                      libxl__sprintf(gc, "%d", guest_domid), NULL);
 
     flexarray_append(dm_args, "-chardev");
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
                                     "path=%s/qmp-libxl-%d,server,nowait",
-                                    libxl_run_dir_path(),
-                                    info->domid));
+                                    libxl_run_dir_path(), guest_domid));
 
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
@@ -460,7 +456,8 @@ static char ** libxl__build_device_model
                                 LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname) {
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, 
vifs[i].devid);
+                    ifname = libxl__sprintf(gc, "tap%d.%d",
+                                            guest_domid, vifs[i].devid);
                 } else {
                     ifname = vifs[i].ifname;
                 }
@@ -581,18 +578,21 @@ static char ** libxl__build_device_model
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info, 
state);
+        return libxl__build_device_model_args_old(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info, 
state);
+        return libxl__build_device_model_args_new(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version 
%d",
                          guest_config->b_info.device_model_version);
@@ -624,7 +624,9 @@ static int libxl__vfb_and_vkb_from_hvm_g
     return 0;
 }
 
-static int libxl__write_dmargs(libxl__gc *gc, int domid, int guest_domid, char 
**args)
+static int libxl__write_stub_dmargs(libxl__gc *gc,
+                                    int dm_domid, int guest_domid,
+                                    char **args)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i;
@@ -636,7 +638,7 @@ static int libxl__write_dmargs(libxl__gc
 
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
-    roperm[1].id = domid;
+    roperm[1].id = dm_domid;
     roperm[1].perms = XS_PERM_READ;
 
     vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, 
"/local/domain/%d/vm", guest_domid));
@@ -673,8 +675,8 @@ retry_transaction:
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 int guest_domid,
                                  libxl_domain_config *guest_config,
-                                 libxl_device_model_info *info,
                                  libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
@@ -685,12 +687,11 @@ static int libxl__create_stubdom(libxl__
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
     libxl__domain_build_state stubdom_state;
-    uint32_t domid;
+    uint32_t dm_domid;
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info xenpv_dm_info;
 
     if (guest_config->b_info.device_model_version !=
         LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
@@ -700,7 +701,8 @@ static int libxl__create_stubdom(libxl__
 
     memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", 
libxl__domid_to_name(gc, info->domid));
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
+                                    libxl__domid_to_name(gc, guest_domid));
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
@@ -713,7 +715,7 @@ static int libxl__create_stubdom(libxl__
     dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
                                               libxl_xenfirmwaredir_path());
-    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
@@ -738,62 +740,69 @@ static int libxl__create_stubdom(libxl__
     dm_config.num_vkbs = 1;
 
     /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    dm_domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &dm_domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, 
&stubdom_state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, dm_domid, &stubdom_state);
     if (ret)
         goto out;
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info, d_state);
+    args = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
+                                          guest_config, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
     }
 
-    libxl__write_dmargs(gc, domid, info->domid, args);
+    libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/image/device-model-domid", 
libxl__xs_get_dompath(gc, info->domid)),
-                   "%d", domid);
+                   libxl__sprintf(gc, "%s/image/device-model-domid",
+                                  libxl__xs_get_dompath(gc, guest_domid)),
+                   "%d", dm_domid);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, 
domid)),
-                   "%d", info->domid);
-    ret = xc_domain_set_target(ctx->xch, domid, info->domid);
+                   libxl__sprintf(gc, "%s/target",
+                                  libxl__xs_get_dompath(gc, dm_domid)),
+                   "%d", guest_domid);
+    ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid);
     if (ret<0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> 
%d", domid, info->domid);
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "setting target domain %d -> %d",
+                         dm_domid, guest_domid);
         ret = ERROR_FAIL;
         goto out_free;
     }
-    xs_set_target(ctx->xsh, domid, info->domid);
+    xs_set_target(ctx->xsh, dm_domid, guest_domid);
 
-    perm[0].id = domid;
+    perm[0].id = dm_domid;
     perm[0].perms = XS_PERM_NONE;
-    perm[1].id = info->domid;
+    perm[1].id = guest_domid;
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t, libxl__sprintf(gc, 
"/local/domain/0/device-model/%d", info->domid));
-    xs_set_permissions(ctx->xsh, t, libxl__sprintf(gc, 
"/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
+    xs_mkdir(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid));
+    xs_set_permissions(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid),
+                       perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
             goto retry_transaction;
 
     for (i = 0; i < dm_config.num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
+        ret = libxl_device_disk_add(ctx, dm_domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
     for (i = 0; i < dm_config.num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
+        ret = libxl_device_nic_add(ctx, dm_domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
+    ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
+    ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -818,14 +827,14 @@ retry_transaction:
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
                 name = libxl__sprintf(gc, "qemu-dm-%s",
-                                      libxl_domid_to_name(ctx, info->domid));
+                                      libxl_domid_to_name(ctx, guest_domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
                 break;
             case STUBDOM_CONSOLE_SAVE:
                 console[i].output = libxl__sprintf(gc, "file:%s",
-                                libxl__device_model_savefile(gc, info->domid));
+                                libxl__device_model_savefile(gc, guest_domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
                 if (d_state->saved_state)
@@ -836,17 +845,14 @@ retry_transaction:
                 console[i].output = "pty";
                 break;
         }
-        ret = libxl__device_console_add(gc, domid, &console[i],
+        ret = libxl__device_console_add(gc, dm_domid, &console[i],
                         i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
 
-    memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-    if (libxl__create_xenpv_qemu(gc, domid,
+    if (libxl__create_xenpv_qemu(gc, dm_domid,
                                  &dm_config,
-                                 &xenpv_dm_info,
                                  &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -857,12 +863,12 @@ retry_transaction:
         goto out_free;
     }
 
-    libxl_domain_unpause(ctx, domid);
+    libxl_domain_unpause(ctx, dm_domid);
 
     if (starting_r) {
         *starting_r = calloc(1, sizeof(libxl__spawner_starting));
-        (*starting_r)->domid = info->domid;
-        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, info->domid);
+        (*starting_r)->domid = guest_domid;
+        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, guest_domid);
         (*starting_r)->for_spawn = NULL;
     }
 
@@ -875,15 +881,15 @@ out:
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -895,7 +901,7 @@ int libxl__create_device_model(libxl__gc
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
+        rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r);
         goto out;
     }
 
@@ -910,18 +916,18 @@ int libxl__create_device_model(libxl__gc
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
+    args = libxl__build_device_model_args(gc, dm, domid, guest_config, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
     }
 
-    path = xs_get_domain_path(ctx->xsh, info->domid);
+    path = xs_get_domain_path(ctx->xsh, domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", 
path),
                     "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
-    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
                     "%d", !b_info->u.hvm.xen_platform_pci);
@@ -945,8 +951,8 @@ int libxl__create_device_model(libxl__gc
         p->for_spawn = NULL;
     }
 
-    p->domid = info->domid;
-    p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->domid = domid;
+    p->dom_path = libxl__xs_get_dompath(gc, domid);
     p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
@@ -1068,14 +1074,6 @@ out:
     return ret;
 }
 
-static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
-                                        uint32_t domid,
-                                        libxl_device_model_info *info)
-{
-    info->domid = domid;
-    return 0;
-}
-
 int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
@@ -1115,12 +1113,10 @@ out:
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
-                             libxl_device_model_info *info,
                              libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, state, starting_r);
+    libxl__create_device_model(gc, domid, guest_config, state, starting_r);
     return 0;
 }
 
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl_dom.c   Mon Jan 23 16:38:18 2012 +0000
@@ -290,8 +290,7 @@ static int hvm_build_set_params(xc_inter
 }
 
 static const char *libxl__domain_firmware(libxl__gc *gc,
-                                          libxl_domain_build_info *info,
-                                          libxl_device_model_info *dm_info)
+                                          libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *firmware;
@@ -319,12 +318,11 @@ static const char *libxl__domain_firmwar
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_FAIL;
-    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
+    const char *firmware = libxl__domain_firmware(gc, info);
 
     if (!firmware)
         goto out;
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Mon Jan 23 16:38:18 2012 +0000
@@ -263,7 +263,6 @@ _hidden int libxl__build_pv(libxl__gc *g
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
@@ -485,10 +484,11 @@ _hidden void libxl__exec(int stdinfd, in
                const char *arg0, char **args); // logs errors, never returns
 
 /* from xl_create */
-_hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, 
uint32_t *domid);
+_hidden int libxl__domain_make(libxl__gc *gc,
+                               libxl_domain_create_info *info,
+                               uint32_t *domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_build_info *info,
-                                libxl_device_model_info *dm_info,
                                 uint32_t domid,
                                 libxl__domain_build_state *state);
 
@@ -496,13 +496,12 @@ _hidden int libxl__domain_build(libxl__g
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                         const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *dm_info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Mon Jan 23 16:38:18 2012 +0000
@@ -266,12 +266,6 @@ libxl_domain_build_info = Struct("domain
     ],
 )
 
-# Device Model Information
-libxl_device_model_info = Struct("device_model_info",[
-    ("domid",            libxl_domid),
-    ],
-)
-
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
diff -r 4ef7e58d3879 -r 62bffbc5495b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Jan 23 16:38:18 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jan 23 16:38:18 2012 +0000
@@ -289,8 +289,7 @@ static void dolog(const char *file, int 
 }
 
 static void printf_info(int domid,
-                        libxl_domain_config *d_config,
-                        libxl_device_model_info *dm_info)
+                        libxl_domain_config *d_config)
 {
     int i;
     libxl_dominfo info;
@@ -571,8 +570,7 @@ static void split_string_into_string_lis
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
-                              libxl_domain_config *d_config,
-                              libxl_device_model_info *dm_info)
+                              libxl_domain_config *d_config)
 {
     const char *buf;
     long l;
@@ -1110,9 +1108,6 @@ skip_vfb:
         break;
     }
 
-    /* init dm from c and b */
-    if (libxl_init_dm_info(ctx, dm_info, c_info, b_info))
-        exit(1);
     /* parse device model arguments, this works for pv, hvm and stubdom */
     if (!xlu_cfg_get_string (config, "device_model", &buf, 0)) {
         fprintf(stderr,
@@ -1363,7 +1358,7 @@ struct domain_create {
     int no_incr_generationid;
 };
 
-static int freemem(libxl_domain_build_info *b_info, libxl_device_model_info 
*dm_info)
+static int freemem(libxl_domain_build_info *b_info)
 {
     int rc, retries = 3;
     uint32_t need_memkb, free_memkb;
@@ -1371,7 +1366,7 @@ static int freemem(libxl_domain_build_in
     if (!autoballoon)
         return 0;
 
-    rc = libxl_domain_need_memory(ctx, b_info, dm_info, &need_memkb);
+    rc = libxl_domain_need_memory(ctx, b_info, &need_memkb);
     if (rc < 0)
         return rc;
 
@@ -1554,7 +1549,7 @@ static int create_domain(struct domain_c
     if (!dom_info->quiet)
         printf("Parsing config file %s\n", config_file);
 
-    parse_config_data(config_file, config_data, config_len, &d_config, 
&d_config.dm_info);
+    parse_config_data(config_file, config_data, config_len, &d_config);
 
     if (migrate_fd >= 0) {
         if (d_config.c_info.name) {
@@ -1579,7 +1574,7 @@ static int create_domain(struct domain_c
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config, &d_config.dm_info);
+        printf_info(-1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -1592,7 +1587,7 @@ start:
     if (rc < 0)
         goto error_out;
 
-    ret = freemem(&d_config.b_info, &d_config.dm_info);
+    ret = freemem(&d_config.b_info);
     if (ret < 0) {
         fprintf(stderr, "failed to free memory for the domain\n");
         ret = ERROR_FAIL;
@@ -2336,7 +2331,6 @@ static void list_domains_details(const l
     char *config_file;
     uint8_t *data;
     int i, len, rc;
-    libxl_device_model_info dm_info;
 
     for (i = 0; i < nb_domain; i++) {
         /* no detailed info available on dom0 */
@@ -2347,8 +2341,8 @@ static void list_domains_details(const l
             continue;
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         memset(&d_config, 0x00, sizeof(d_config));
-        parse_config_data(config_file, (char *)data, len, &d_config, &dm_info);
-        printf_info(info[i].domid, &d_config, &dm_info);
+        parse_config_data(config_file, (char *)data, len, &d_config);
+        printf_info(info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.