qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] PATCH 2/8: Extend monitor 'change' command for VNC
Date: Mon, 13 Aug 2007 20:42:51 +0100	[thread overview]
Message-ID: <20070813194251.GD30789@redhat.com> (raw)
In-Reply-To: <20070813192517.GB30789@redhat.com>

This patch extends the QEMU monitor 'change' command so that it can
be used to change the configuration of the VNC server. On the command
line the user can use -vnc none, and then issue the 'change vnc :1'
command later from the monitor. This is utilized in the next patch
to let the monitor fetch a password for the server. The concept could
also be extended to serial & parallel devices allowing changing of
their configuration on the fly.

Example usage:

  qemu [...OPTIONS...] -vnc none -monitor stdio
  (qemu) change vnc 127.0.0.1:1,password


   Signed-off-by: Daniel P. Berrange <berrange@redhat.com>


diff -r 4bae9b5b1e5b monitor.c
--- a/monitor.c	Wed Aug 08 15:04:25 2007 -0400
+++ b/monitor.c	Wed Aug 08 15:04:27 2007 -0400
@@ -386,7 +386,7 @@ static void do_eject(int force, const ch
     eject_device(bs, force);
 }
 
-static void do_change(const char *device, const char *filename)
+static void do_change_block(const char *device, const char *filename)
 {
     BlockDriverState *bs;
 
@@ -399,6 +399,21 @@ static void do_change(const char *device
         return;
     bdrv_open(bs, filename, 0);
     qemu_key_check(bs, filename);
+}
+
+static void do_change_vnc(const char *target)
+{
+    if (vnc_display_open(NULL, target) < 0)
+	term_printf("could not start VNC server on %s\n", target);
+}
+
+static void do_change(const char *device, const char *target)
+{
+    if (strcmp(device, "vnc") == 0) {
+	do_change_vnc(target);
+    } else {
+	do_change_block(device, target);
+    }
 }
 
 static void do_screen_dump(const char *filename)
diff -r 4bae9b5b1e5b vnc.c
--- a/vnc.c	Wed Aug 08 15:04:25 2007 -0400
+++ b/vnc.c	Wed Aug 08 15:04:27 2007 -0400
@@ -1208,7 +1208,7 @@ void vnc_display_init(DisplayState *ds)
 
 void vnc_display_close(DisplayState *ds)
 {
-    VncState *vs = (VncState *)ds->opaque;
+    VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
 
     if (vs->display) {
 	qemu_free(vs->display);
@@ -1238,7 +1238,7 @@ int vnc_display_open(DisplayState *ds, c
     int reuse_addr, ret;
     socklen_t addrlen;
     const char *p;
-    VncState *vs = (VncState *)ds->opaque;
+    VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
 
     vnc_display_close(ds);
     if (strcmp(arg, "none") == 0)

-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

  parent reply	other threads:[~2007-08-13 19:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13 19:25 [Qemu-devel] PATCH 0/8: Authentication support for the VNC server Daniel P. Berrange
2007-08-13 19:41 ` [Qemu-devel] PATCH 1/8: Refactor VNC server setup API Daniel P. Berrange
2007-08-13 19:42 ` Daniel P. Berrange [this message]
2007-08-13 19:44 ` [Qemu-devel] PATCH 3/8: VNC password authentication Daniel P. Berrange
2007-08-13 19:46 ` [Qemu-devel] PATCH 4/8: VeNCrypt basic TLS support Daniel P. Berrange
2007-08-13 19:47 ` [Qemu-devel] PATCH 5/8: x509 certificate for server Daniel P. Berrange
2007-08-13 19:48 ` [Qemu-devel] PATCH 6/8: x509 client certificate verification Daniel P. Berrange
2007-08-13 19:50 ` [Qemu-devel] PATCH 7/8: custom location for x509 cert paths Daniel P. Berrange
2007-08-13 19:51 ` [Qemu-devel] PATCH 8/8: document all VNC authentication options Daniel P. Berrange
2007-08-15  4:32 ` [Qemu-devel] PATCH 0/8: Authentication support for the VNC server Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2007-07-31 19:23 Daniel P. Berrange
2007-07-31 19:25 ` [Qemu-devel] PATCH 2/8: Extend monitor 'change' command for VNC Daniel P. Berrange
2007-08-01  1:43   ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070813194251.GD30789@redhat.com \
    --to=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).