flexarray_set(dm_args, num++, "-vnc");
if (info->vncdisplay) {
if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
- flexarray_set(dm_args, num++, libxl_sprintf(ctx, "%s:%d", info->vnclisten, info->vncdisplay));
+ flexarray_set(
+ dm_args, num++,
+ libxl_sprintf(ctx, "%s:%d%s",
+ info->vnclisten,
+ info->vncdisplay,
+ info->vncpasswd ? ",password" : ""));
} else {
flexarray_set(dm_args, num++, libxl_sprintf(ctx, "127.0.0.1:%d", info->vncdisplay));
}
vfb->vnclisten = info->vnclisten;
vfb->vncdisplay = info->vncdisplay;
vfb->vncunused = info->vncunused;
+ vfb->vncpasswd = info->vncpasswd;
vfb->keymap = info->keymap;
vfb->sdl = info->sdl;
vfb->opengl = info->opengl;
int rc;
char **args;
struct libxl_device_model_starting buf_starting, *p;
+ xs_transaction_t t;
+ char *vm_path;
+ char **pass_stuff;
if (strstr(info->device_model, "stubdom-dm")) {
libxl_device_vfb vfb;
p->dom_path = libxl_xs_get_dompath(ctx, info->domid);
if (!p->dom_path) { libxl_free(ctx, p); return ERROR_FAIL; }
+ if (info->vncpasswd) {
+ retry_transaction:
+ /* Find uuid and the write the vnc password to xenstore for qemu. */
+ t = xs_transaction_start(ctx->xsh);
+ vm_path = libxl_xs_read(ctx,t,libxl_sprintf(ctx, "%s/vm", p->dom_path));
+ if (vm_path) {
+ /* Now write the vncpassword into it. */
+ pass_stuff = libxl_calloc(ctx, 2, sizeof(char *));
+ pass_stuff[0] = "vncpasswd";
+ pass_stuff[1] = info->vncpasswd;
+ libxl_xs_writev(ctx,t,vm_path,pass_stuff);
+ if (!xs_transaction_end(ctx->xsh, t, 0))
+ if (errno == EAGAIN)
+ goto retry_transaction;
+ }
+ }
+
rc = libxl_spawn_spawn(ctx, p, "device model", dm_xenstore_record_pid);
if (rc < 0) goto xit;
if (!rc) { /* inner child */
info->vnclisten = libxl_sprintf(ctx, "%s", vfb->vnclisten);
info->vncdisplay = vfb->vncdisplay;
info->vncunused = vfb->vncunused;
+ if (vfb->vncpasswd)
+ info->vncpasswd = vfb->vncpasswd;
if (vfb->keymap)
info->keymap = libxl_sprintf(ctx, "%s", vfb->keymap);
info->sdl = vfb->sdl;
flexarray_set(back, boffset++, libxl_sprintf(ctx, "%d", vfb->vnc));
flexarray_set(back, boffset++, "vnclisten");
flexarray_set(back, boffset++, vfb->vnclisten);
+ flexarray_set(back, boffset++, "vncpasswd");
+ flexarray_set(back, boffset++, vfb->vncpasswd);
flexarray_set(back, boffset++, "vncdisplay");
flexarray_set(back, boffset++, libxl_sprintf(ctx, "%d", vfb->vncdisplay));
flexarray_set(back, boffset++, "vncunused");
bool stdvga; /* stdvga enabled or disabled */
bool vnc; /* vnc enabled or disabled */
char *vnclisten; /* address:port that should be listened on for the VNC server if vnc is set */
+ char *vncpasswd; /* the VNC password */
int vncdisplay; /* set VNC display number */
bool vncunused; /* try to find an unused port for the VNC server */
char *keymap; /* set keyboard layout, default is en-us keyboard */
int devid;
bool vnc; /* vnc enabled or disabled */
char *vnclisten; /* address:port that should be listened on for the VNC server if vnc is set */
+ char *vncpasswd; /* the VNC password */
int vncdisplay; /* set VNC display number */
bool vncunused; /* try to find an unused port for the VNC server */
char *keymap; /* set keyboard layout, default is en-us keyboard */
(*vfbs)[*num_vfbs].vnc = atoi(p2 + 1);
} else if (!strcmp(p, "vnclisten")) {
(*vfbs)[*num_vfbs].vnclisten = strdup(p2 + 1);
+ } else if (!strcmp(p, "vncpasswd")) {
+ (*vfbs)[*num_vfbs].vncpasswd = strdup(p2 + 1);
} else if (!strcmp(p, "vncdisplay")) {
(*vfbs)[*num_vfbs].vncdisplay = atoi(p2 + 1);
} else if (!strcmp(p, "vncunused")) {
dm_info->vnc = l;
if (!xlu_cfg_get_string (config, "vnclisten", &buf))
dm_info->vnclisten = strdup(buf);
+ if (!xlu_cfg_get_string (config, "vncpasswd", &buf))
+ dm_info->vncpasswd = strdup(buf);
if (!xlu_cfg_get_long (config, "vncdisplay", &l))
dm_info->vncdisplay = l;
if (!xlu_cfg_get_long (config, "vncunused", &l))