[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: Set VNC password through QMP
# HG changeset patch # User Anthony PERARD <anthony.perard@xxxxxxxxxx> # Date 1329763529 0 # Node ID 3059bc2c14f710b50133d8fcccc985413bdd0c11 # Parent 2c2afbd7cef7f497423fedb5ffe2af3b4df6f133 libxl: Set VNC password through QMP This patch provide the code to set the VNC password to QEMU upstream through VNC. The password is still stored in xenstore but will not be used by QEMU upstream. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> --- diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Mon Feb 20 18:45:29 2012 +0000 +++ b/tools/libxl/libxl_create.c Mon Feb 20 18:45:29 2012 +0000 @@ -594,7 +594,7 @@ if (dm_starting) { if (d_config->b_info.device_model_version == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) { - libxl__qmp_initializations(gc, domid); + libxl__qmp_initializations(gc, domid, d_config); } ret = libxl__confirm_device_model_startup(gc, &state, dm_starting); if (ret < 0) { diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Mon Feb 20 18:45:29 2012 +0000 +++ b/tools/libxl/libxl_dm.c Mon Feb 20 18:45:29 2012 +0000 @@ -361,10 +361,8 @@ if (vnc) { int display = 0; const char *listen = "127.0.0.1"; + char *vncarg = NULL; - if (vnc->passwd && vnc->passwd[0]) { - assert(!"missing code for supplying vnc password to qemu"); - } flexarray_append(dm_args, "-vnc"); if (vnc->display) { @@ -377,13 +375,19 @@ } if (strchr(listen, ':') != NULL) - flexarray_append(dm_args, - libxl__sprintf(gc, "%s%s", listen, - vnc->findunused ? ",to=99" : "")); + vncarg = libxl__sprintf(gc, "%s", listen); else - flexarray_append(dm_args, - libxl__sprintf(gc, "%s:%d%s", listen, display, - vnc->findunused ? ",to=99" : "")); + vncarg = libxl__sprintf(gc, "%s:%d", listen, display); + if (vnc->passwd && vnc->passwd[0]) { + vncarg = libxl__sprintf(gc, "%s,password", vncarg); + } + if (vnc->findunused) { + /* This option asks to QEMU to try this number of port before to + * give up. So QEMU will try ports between $display and $display + + * 99. This option needs to be the last one of the vnc options. */ + vncarg = libxl__sprintf(gc, "%s,to=99", vncarg); + } + flexarray_append(dm_args, vncarg); } if (sdl) { flexarray_append(dm_args, "-sdl"); @@ -965,6 +969,8 @@ } if (vnc && vnc->passwd) { + /* This xenstore key will only be used by qemu-xen-traditionnal. + * The code to supply vncpasswd to qemu-xen is later. */ retry_transaction: /* Find uuid and the write the vnc password to xenstore for qemu. */ t = xs_transaction_start(ctx->xsh); diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Mon Feb 20 18:45:29 2012 +0000 +++ b/tools/libxl/libxl_internal.h Mon Feb 20 18:45:29 2012 +0000 @@ -1013,7 +1013,8 @@ _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid); /* this helper calls qmp_initialize, query_serial and qmp_close */ -_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid); +_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid, + const libxl_domain_config *guest_config); /* from libxl_json */ #include <yajl/yajl_gen.h> diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_qmp.c --- a/tools/libxl/libxl_qmp.c Mon Feb 20 18:45:29 2012 +0000 +++ b/tools/libxl/libxl_qmp.c Mon Feb 20 18:45:29 2012 +0000 @@ -880,8 +880,33 @@ return rc; } -int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid) +static int qmp_change(libxl__gc *gc, libxl__qmp_handler *qmp, + char *device, char *target, char *arg) { + flexarray_t *parameters = NULL; + libxl_key_value_list args = NULL; + int rc = 0; + + parameters = flexarray_make(6, 1); + flexarray_append_pair(parameters, "device", device); + flexarray_append_pair(parameters, "target", target); + if (arg) + flexarray_append_pair(parameters, "arg", arg); + args = libxl__xs_kvs_of_flexarray(gc, parameters, parameters->count); + if (!args) + return ERROR_NOMEM; + + rc = qmp_synchronous_send(qmp, "change", &args, + NULL, NULL, qmp->timeout); + + flexarray_free(parameters); + return rc; +} + +int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid, + const libxl_domain_config *guest_config) +{ + const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config); libxl__qmp_handler *qmp = NULL; int ret = 0; @@ -889,6 +914,9 @@ if (!qmp) return -1; ret = libxl__qmp_query_serial(qmp); + if (!ret && vnc && vnc->passwd) { + ret = qmp_change(gc, qmp, "vnc", "password", vnc->passwd); + } libxl__qmp_close(qmp); return ret; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |