[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 6/6] Implement VNC password change in QEMU



On Wed, Mar 24, 2010 at 11:46:27AM +0000, Daniel P. Berrange wrote:
> Use the new virDomainUpdateDeviceFlags API to allow the VNC password
> to be changed on the fly
> 
> * src/internal.h: Define STREQ_NULLABLE() which is like STREQ()
>   but does not crash if either argument is NULL, and treats two
>   NULLs as equal.
> * src/libvirt_private.syms: Export virDomainGraphicsTypeToString
> * src/qemu/qemu_driver.c: Support VNC password change on a live
>   machine
> * src/qemu/qemu_monitor.c: Disable crazy debugging info. Treat a
>   NULL password as "" (empty string), allowing passwords to be
>   disabled in the monitor
> ---
>  src/internal.h           |    6 +++
>  src/libvirt_private.syms |    1 +
>  src/qemu/qemu_driver.c   |   81 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor.c  |   17 ++++++++-
>  4 files changed, 103 insertions(+), 2 deletions(-)
> 
> diff --git a/src/internal.h b/src/internal.h
> index 4ec6edc..f82fbd2 100644
> --- a/src/internal.h
> +++ b/src/internal.h
> @@ -58,6 +58,12 @@
>  # define STRCASENEQLEN(a,b,n) (strncasecmp(a,b,n) != 0)
>  # define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0)
>  
> +# define STREQ_NULLABLE(a, b)                           \
> +    ((!(a) && !(b)) || ((a) && (b) && STREQ((a), (b))))
> +# define STRNEQ_NULLABLE(a, b)                          \
> +    ((!(a) ^ !(b)) || ((a) && (b) && STRNEQ((a), (b))))
> +

Not sure I can parse that, I would assume it's equivalent to:
  (!(STREQ_NULLABLE((a), (b))))
which would be simpler IMHO

[...]
>  
> +static virDomainGraphicsDefPtr qemuDomainFindGraphics(virDomainObjPtr vm,
> +                                                      virDomainGraphicsDefPtr dev)
> +{
> +    int i;
> +
> +    for (i = 0 ; i < vm->def->ngraphics ; i++) {
> +        if (vm->def->graphics[i]->type == dev->type)
> +            return vm->def->graphics[i];
> +    }
> +
> +    return NULL;
> +}

  it's a bit surprizing to match just on the type, what if we somehow
add dual graphic support for a given type ?

> +
[...]
>  
> -#if QEMU_DEBUG_RAW_IO
> +#if DEBUG_IO
> +#if DEBUG_RAW_IO
>      char *str1 = qemuMonitorEscapeNonPrintable(msg ? msg->txBuffer : "");
>      char *str2 = qemuMonitorEscapeNonPrintable(mon->buffer);
>      VIR_ERROR("Process %d %p %p [[[[%s]]][[[%s]]]", (int)mon->bufferOffset, mon->msg, msg, str1, str2);
> @@ -311,6 +313,8 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
>  #else
>      VIR_DEBUG("Process %d", (int)mon->bufferOffset);
>  #endif
> +#endif
> +

  hum, somehow I feel it's gonna break cppi indenting isn't it ?
but it's minor,

ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]