[libvirt] PATCH: Support VNC password for QEMU guests

Jim Meyering jim at meyering.net
Wed Jan 21 12:48:25 UTC 2009


"Daniel P. Berrange" <berrange at redhat.com> wrote:
> This patch adds support for using the monitor interface to set the VNC
> password
>
>   (qemu) change vnc password
>   Password: ********
>
> A minor tricky thing is that we can't just send the command and password
> all in one go, we must wait for the 'Password' prompt before sending the
> password.
>
> When doing this I noticed that virsh dumpxml has no way to request a
> secure XML dump (required to see the password element), nor did the
> virsh edit command set the SECURE or INACTIVE flags when changing
> the XML.
...
> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
> --- a/src/qemu_conf.c
> +++ b/src/qemu_conf.c
> @@ -1138,37 +1138,42 @@ int qemudBuildCommandLine(virConnectPtr
>
>      if (vm->def->graphics &&
>          vm->def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
> -        char vncdisplay[PATH_MAX];
> -        int ret;
> +        virBuffer opt = VIR_BUFFER_INITIALIZER;
> +        char *optstr;
...
> +        optstr = virBufferContentAndReset(&opt);
>
>          ADD_ARG_LIT("-vnc");
> -        ADD_ARG_LIT(vncdisplay);
> +        ADD_ARG(optstr);

Looks fine.
Just be sure to add this:

           VIR_FREE(optstr);

Also, there are a few new lines longer than 80.

BTW, can you outline what you do to test this?
and I'll see about adding something to exercise the new code.




More information about the libvir-list mailing list