[libvirt] PATCH: Support VNC password for QEMU guests

Daniel P. Berrange berrange at redhat.com
Mon Jan 26 12:48:14 UTC 2009


On Mon, Jan 26, 2009 at 11:15:01AM +0000, Daniel P. Berrange wrote:
> On Sun, Jan 25, 2009 at 09:22:53PM +0100, Radek Hladik wrote:
> > 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.
> 
> That is the correct place to put the flag - I'll include this in my
> patches. We need to tell it to parse the passwd when loading the files
> from disk upon daemon startup.

Actually this is not required. The password is always parsed from the
XML. The secure flag is only required when generating XML for output.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list