[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 4/6] libxl: spawn a qemu to implement channels
Since every channel is mapped to a console device in xenstore with 'output=chardev:libxl-channel%d', we need to tell qemu to create the appropriate chardevs. Signed-off-by: David Scott <dave.scott@xxxxxxxxxx> --- tools/libxl/libxl_create.c | 3 ++- tools/libxl/libxl_dm.c | 39 +++++++++++++++++++++++++++++++++++++-- tools/libxl/libxl_internal.h | 3 ++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 6356e55..e178672 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1214,7 +1214,8 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, need_qemu = libxl__need_xenpv_qemu(gc, 1, &console, d_config->num_vfbs, d_config->vfbs, - d_config->num_disks, &d_config->disks[0]); + d_config->num_disks, &d_config->disks[0], + d_config->num_channels); console.backend_domid = state->console_domid; libxl__device_console_add(gc, domid, &console, state); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 51ab2bf..32c1362 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -394,8 +394,9 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, const libxl_sdl_info *sdl = dm_sdl(guest_config); const char *keymap = dm_keymap(guest_config); flexarray_t *dm_args; - int i; + int i, type, devid; uint64_t ram_size; + const char *path, *chardev; dm_args = flexarray_make(gc, 16, 1); @@ -412,6 +413,34 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, "-mon"); flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); + for (i = 0; i < guest_config->num_channels; i++) { + type = guest_config->channels[i].type; + path = guest_config->channels[i].path; + devid = guest_config->channels[i].devid; + switch (type) { + case LIBXL_CHANNEL_TYPE_NONE: + chardev = GCSPRINTF("null,id=libxl-channel%d", devid); + break; + case LIBXL_CHANNEL_TYPE_PTY: + chardev = GCSPRINTF("pty,id=libxl-channel%d", devid); + break; + case LIBXL_CHANNEL_TYPE_PATH: + chardev = GCSPRINTF("file,id=libxl-channel%d,path=%s", + devid, path); + break; + case LIBXL_CHANNEL_TYPE_SOCKET: + chardev = GCSPRINTF("socket,id=libxl-channel%d,path=%s," + "server,nowait", devid, path); + break; + default: + /* We've forgotten to add the clause */ + LOG(ERROR, "%s: unknown channel type %d", __func__, type); + return NULL; + } + flexarray_append(dm_args, "-chardev"); + flexarray_append(dm_args, (void*)chardev); + } + /* * Remove default devices created by qemu. Qemu will create only devices * defined by xen, since the devices not defined by xen are not usable. @@ -1517,7 +1546,8 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl__device_console *consoles, int nr_vfbs, libxl_device_vfb *vfbs, - int nr_disks, libxl_device_disk *disks) + int nr_disks, libxl_device_disk *disks, + int nr_channels) { int i, ret = 0; uint32_t domid; @@ -1557,6 +1587,11 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, } } + if (nr_channels > 0) { + ret = 1; + goto out; + } + out: return ret; } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 082749e..a3b1f57 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1450,7 +1450,8 @@ _hidden const char *libxl__domain_device_model(libxl__gc *gc, _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl__device_console *consoles, int nr_vfbs, libxl_device_vfb *vfbs, - int nr_disks, libxl_device_disk *disks); + int nr_disks, libxl_device_disk *disks, + int nr_channels); /* * This function will cause the whole libxl process to hang -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |