[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 4/4] 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 | 44 ++++++++++++++++++++++++++++++++++++++++-- tools/libxl/libxl_internal.h | 3 ++- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 13a2a27..2d2fb55 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1210,7 +1210,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..3269577 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; uint64_t ram_size; + const char *path; dm_args = flexarray_make(gc, 16, 1); @@ -412,6 +413,39 @@ 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++) { + flexarray_append(dm_args, "-chardev"); + type = guest_config->channels[i].type; + path = guest_config->channels[i].path; + switch (type) { + case LIBXL_CHANNEL_TYPE_NONE: + flexarray_append(dm_args, + libxl__sprintf(gc, "null,id=libxl-channel%d", + i)); + break; + case LIBXL_CHANNEL_TYPE_PTY: + flexarray_append(dm_args, + libxl__sprintf(gc, "pty,id=libxl-channel%d", + i)); + break; + case LIBXL_CHANNEL_TYPE_PATH: + flexarray_append(dm_args, + libxl__sprintf(gc, "file,id=libxl-channel%d," + "path=%s", i, path)); + break; + case LIBXL_CHANNEL_TYPE_SOCKET: + flexarray_append(dm_args, + libxl__sprintf(gc, "socket,id=libxl-channel%d," + "path=%s,server,nowait", + i, path)); + break; + default: + /* We've forgotten to add the clause */ + LOG(ERROR, "%s: unknown channel type %d", __func__, type); + return NULL; + } + } + /* * 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 +1551,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 +1592,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 |