[libvirt] PATCH: Support VNC password for QEMU guests

Radek Hladik radek at eadresa.cz
Sun Jan 25 20:22:53 UTC 2009


Daniel P. Berrange napsal(a):
> 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.
> 
>  qemu_conf.c   |   45 ++++++++++++-----------
>  qemu_driver.c |  112 ++++++++++++++++++++++++++++++++++++++++++++--------------
>  virsh.c       |   30 ++++++++++-----
>  3 files changed, 131 insertions(+), 56 deletions(-)
> 
> Daniel
> 

I tried the patch and I've found that define command do not set the 
password as the SECURE flag is not set when defining the domain from XML 
file. This can be very unpleasant as it effectively disables the 
password when redefining the domain. I've tried this simple dirty hotfix

diff -ur b/domain_conf.c a/domain_conf.c
--- b/domain_conf.c     2008-12-23 14:20:02.000000000 +0100
+++ a/domain_conf.c     2009-01-25 20:12:47.000000000 +0100
@@ -2297,7 +2297,7 @@
      }

      def = virDomainDefParseNode(conn, caps, xml, root,
-                                VIR_DOMAIN_XML_INACTIVE);
+                                VIR_DOMAIN_XML_INACTIVE | 
VIR_DOMAIN_XML_SECURE );

  cleanup:
      xmlFreeParserCtxt (pctxt);


and it works. However there must be some better way how to do it but I 
do not know the libvirt source code good enough to find it.

Radek

P.S. I've also found that virt-manager is missing handler for login 
button when asking for password but I will send email to virt-manager 
mailing list about it.




More information about the libvir-list mailing list