qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gilad Ben-Yossef <gilad@codefidence.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] starting qemu vnc session on a pre-allocated port
Date: Sun, 01 Jul 2007 00:15:48 +0300	[thread overview]
Message-ID: <4686C804.3090106@codefidence.com> (raw)
In-Reply-To: <4683D2CC.3070003@codemonkey.ws>

Anthony Liguori wrote:

>> The machine running qemu has a web based interface to start VMs.
>> A user asks for a new VM to start by browsing to a URL. The CGI
>> implmenting that URL will start a new qemu instance, send to the user
>> web browser an HTML page with a JAVA VNC viewer embedded and terminate.
> 
> Passing an fd is still the wrong solution due to the problems with 
> save/restore/migrate.

There is no problem with save/restore or migration.

For save/restore, the fd is not saved in the saved state. You need to 
specify a (new?) fd when you restore, if that is what you want to do, 
that is.

It just like I can run a VM with SDL, save the state and restore it with 
VNC - the question if the restored session should use the same fd (for 
whatever definition of "the same" you want) or not is left for the user. 
We should be providing mechanism, not policy.

The same applies for migration - when you migrate your VM, its your call 
and responsibility to do the right thing. Just spawn a wrapper on the 
target machine that opens a new fd and exec into qemu and use *that* as 
your migrate command line argument instead of plain qemu, as an obvious 
example.

As someone wrote in their blog (this is why I write my blog in a 
language that's been dead for aprox. 2000 years... :-):

"Instead of just saying 'migrate hostname' you now have to construct a 
rather long command like 'migrate "ssh hostname qemu -loadvm -"'. A nice 
side effect though is that you can completely change the command line 
arguments in case you have NFS mounts at different locations."

I couldn't agree more. :-)


> 
> It may be interesting to have something like -vnc 
> tcp://0.0.0.0:5900-6000 to let QEMU try to find an unused port in the 
> given range.  Combined with -daemonize and having the monitor on a Unix 
> socket, you could:
> 
> 1) create a vm with qemu -vnc tcp://0.0.0.0:5900-6000 -monitor 
> unix:/path/to/socket -daemonize
> 2) *wait* for qemu to finish running and daemonize properly
> 3) connect to /path/to/socket and issue a 'info vnc' command to discover 
> which port it's actually using
> 4) render that port with your HTML.

What you're saying is the same as claiming that "ls" needs to implement 
sorting, compression (in both gz and bzip algorithms), regexp searching 
and transferring it's output over an SSL connection to another machine.

We don't do that. We have pipes . VNC socket fd passing is just the old 
pipe concept (adapted to the situation) - nothing more.

Or in other words: you can easily implement the VNC over unix domain 
socket feature (if it was not in qemu already) using the fd passing 
method, but you can't do it the other way around (without an extra long 
running process, that is)

> 
> The nice thing about this is that it not only continues to work with 
> save/restore/migrate, it's smart enough to allocate a new port to ensure 
> that you always tend to succeed.  Choosing :3 might be okay on machine 
> A, but there's no guarantee that it's okay on machine B so you have to 
> allow QEMU to try and find a new port after restore/migrate.

You're assuming we know what the correct behavior is. We really don't 
know. Maybe we want to use the same fd number on the new machine, maybe 
we don't. The user somehow provided a good fd on the original machine, 
trust him to provide a good one on the new one (via a qemu wrapper for 
migrate as explained above, for example).

Again it's that mechanism vs. policy thing again.,

Gilad

PS. This is not some ego trip about whether you'll take the patch or 
not, so just tell me if this back and forth gets annoying and I'll shut 
up :-)

  reply	other threads:[~2007-06-30 21:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-24 13:05 [Qemu-devel] [PATCH] starting qemu vnc session on a pre-allocated port Shahar Livne
2007-06-24 14:07 ` Anthony Liguori
2007-06-24 21:45   ` Shahar Livne
2007-06-24 22:40     ` Anthony Liguori
2007-06-25  8:28       ` Gilad Ben-Yossef
2007-06-25 11:55         ` Anthony Liguori
2007-06-26 10:17           ` Gilad Ben-Yossef
2007-06-26 10:48             ` Jannes Faber
2007-06-28 15:25             ` Anthony Liguori
2007-06-30 21:15               ` Gilad Ben-Yossef [this message]
2007-07-01 15:33                 ` Anthony Liguori
2007-06-24 19:16 ` Paul Brook
2007-06-24 20:12   ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2007-06-25 14:58 n schembr

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=4686C804.3090106@codefidence.com \
    --to=gilad@codefidence.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).