[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: now that dm creation takes domain_config stop passing down devices.
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1328023311 0 # Node ID 05435cdb21d323c2865cdd883fa0a7c2cdcdec0b # Parent 919ad96e3e2886bc5171bfed5205ad56a2390a5b libxl: now that dm creation takes domain_config stop passing down devices. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Tue Jan 31 14:41:00 2012 +0000 +++ b/tools/libxl/libxl_create.c Tue Jan 31 15:21:51 2012 +0000 @@ -572,8 +572,6 @@ dm_info->domid = domid; ret = libxl__create_device_model(gc, d_config, dm_info, - d_config->disks, d_config->num_disks, - d_config->vifs, d_config->num_vifs, &dm_starting); if (ret < 0) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, @@ -619,8 +617,7 @@ xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm; libxl__create_xenpv_qemu(gc, domid, - d_config, &xenpv_dm_info, - d_config->vfbs, &dm_starting); + d_config, &xenpv_dm_info, &dm_starting); } break; } diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Tue Jan 31 14:41:00 2012 +0000 +++ b/tools/libxl/libxl_dm.c Tue Jan 31 15:21:51 2012 +0000 @@ -76,10 +76,10 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc, const char *dm, const libxl_domain_config *guest_config, - const libxl_device_model_info *info, - const libxl_device_disk *disks, int num_disks, - const libxl_device_nic *vifs, int num_vifs) + const libxl_device_model_info *info) { + const libxl_device_nic *vifs = guest_config->vifs; + const int num_vifs = guest_config->num_vifs; int i; flexarray_t *dm_args; dm_args = flexarray_make(16, 1); @@ -231,11 +231,13 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, const char *dm, const libxl_domain_config *guest_config, - const libxl_device_model_info *info, - const libxl_device_disk *disks, int num_disks, - const libxl_device_nic *vifs, int num_vifs) + const libxl_device_model_info *info) { libxl_ctx *ctx = libxl__gc_owner(gc); + const libxl_device_disk *disks = guest_config->disks; + const libxl_device_nic *vifs = guest_config->vifs; + const int num_disks = guest_config->num_disks; + const int num_vifs = guest_config->num_vifs; flexarray_t *dm_args; int i; @@ -496,21 +498,15 @@ static char ** libxl__build_device_model_args(libxl__gc *gc, const char *dm, const libxl_domain_config *guest_config, - const libxl_device_model_info *info, - const libxl_device_disk *disks, int num_disks, - const libxl_device_nic *vifs, int num_vifs) + const libxl_device_model_info *info) { libxl_ctx *ctx = libxl__gc_owner(gc); switch (info->device_model_version) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: - return libxl__build_device_model_args_old(gc, dm, guest_config, info, - disks, num_disks, - vifs, num_vifs); + return libxl__build_device_model_args_old(gc, dm, guest_config, info); case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - return libxl__build_device_model_args_new(gc, dm, guest_config, info, - disks, num_disks, - vifs, num_vifs); + return libxl__build_device_model_args_new(gc, dm, guest_config, info); default: LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d", info->device_model_version); @@ -588,16 +584,14 @@ static int libxl__create_stubdom(libxl__gc *gc, libxl_domain_config *guest_config, 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__spawner_starting **starting_r) { libxl_ctx *ctx = libxl__gc_owner(gc); int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret; libxl_device_console *console; libxl_domain_config dm_config; + libxl_device_vfb vfb; + libxl_device_vkb vkb; libxl__domain_build_state state; uint32_t domid; char **args; @@ -629,6 +623,19 @@ dm_config.b_info.u.pv.ramdisk.path = ""; dm_config.b_info.u.pv.features = ""; + dm_config.disks = guest_config->disks; + dm_config.num_disks = guest_config->num_disks; + + dm_config.vifs = guest_config->vifs; + dm_config.num_vifs = guest_config->num_vifs; + + libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb); + + dm_config.vfbs = &vfb; + dm_config.num_vfbs = 1; + dm_config.vkbs = &vkb; + 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); @@ -639,9 +646,7 @@ goto out; args = libxl__build_device_model_args(gc, "stubdom-dm", - guest_config, info, - disks, num_disks, - vifs, num_vifs); + guest_config, info); if (!args) { ret = ERROR_FAIL; goto out; @@ -674,20 +679,20 @@ if (errno == EAGAIN) goto retry_transaction; - for (i = 0; i < num_disks; i++) { - ret = libxl_device_disk_add(ctx, domid, &disks[i]); + for (i = 0; i < dm_config.num_disks; i++) { + ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]); if (ret) goto out_free; } - for (i = 0; i < num_vifs; i++) { - ret = libxl_device_nic_add(ctx, domid, &vifs[i]); + for (i = 0; i < dm_config.num_vifs; i++) { + ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]); if (ret) goto out_free; } - ret = libxl_device_vfb_add(ctx, domid, vfb); + ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]); if (ret) goto out_free; - ret = libxl_device_vkb_add(ctx, domid, vkb); + ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]); if (ret) goto out_free; @@ -745,7 +750,7 @@ if (libxl__create_xenpv_qemu(gc, domid, &dm_config, &xenpv_dm_info, - vfb, &dm_starting) < 0) { + &dm_starting) < 0) { ret = ERROR_FAIL; goto out_free; } @@ -775,8 +780,6 @@ int libxl__create_device_model(libxl__gc *gc, libxl_domain_config *guest_config, libxl_device_model_info *info, - libxl_device_disk *disks, int num_disks, - libxl_device_nic *vifs, int num_vifs, libxl__spawner_starting **starting_r) { libxl_ctx *ctx = libxl__gc_owner(gc); @@ -791,14 +794,7 @@ const char *dm; if (info->device_model_stubdomain) { - libxl_device_vfb vfb; - libxl_device_vkb vkb; - - libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb); - rc = libxl__create_stubdom(gc, guest_config, info, - disks, num_disks, - vifs, num_vifs, - &vfb, &vkb, starting_r); + rc = libxl__create_stubdom(gc, guest_config, info, starting_r); goto out; } @@ -813,9 +809,7 @@ rc = ERROR_FAIL; goto out; } - args = libxl__build_device_model_args(gc, dm, guest_config, info, - disks, num_disks, - vifs, num_vifs); + args = libxl__build_device_model_args(gc, dm, guest_config, info); if (!args) { rc = ERROR_FAIL; goto out; @@ -1036,11 +1030,10 @@ int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid, libxl_domain_config *guest_config, libxl_device_model_info *info, - libxl_device_vfb *vfb, libxl__spawner_starting **starting_r) { - libxl__build_xenpv_qemu_args(gc, domid, vfb, info); - libxl__create_device_model(gc, guest_config, info, NULL, 0, NULL, 0, starting_r); + libxl__build_xenpv_qemu_args(gc, domid, &guest_config->vfbs[0], info); + libxl__create_device_model(gc, guest_config, info, starting_r); return 0; } diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Tue Jan 31 14:41:00 2012 +0000 +++ b/tools/libxl/libxl_internal.h Tue Jan 31 15:21:51 2012 +0000 @@ -868,13 +868,10 @@ _hidden int libxl__create_device_model(libxl__gc *gc, libxl_domain_config *guest_config, libxl_device_model_info *info, - libxl_device_disk *disks, int num_disks, - libxl_device_nic *vifs, int num_vifs, 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_device_vfb *vfb, libxl__spawner_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles, _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |