qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@linux.vnet.ibm.com>
Cc: agl@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com,
	markus_mueller@de.ibm.com, marcel.mittelstaedt@de.ibm.com,
	qemu-devel@nongnu.org, Jes.Sorensen@redhat.com, ryanh@us.ibm.com,
	Gerd Hoffmann <kraxel@redhat.com>,
	abeekhof@redhat.com
Subject: Re: [Qemu-devel] [RFC][PATCH v6 00/23] virtagent: host/guest RPC communication agent
Date: Mon, 31 Jan 2011 08:41:49 -0600	[thread overview]
Message-ID: <4D46CA2D.5050807@linux.vnet.ibm.com> (raw)
In-Reply-To: <4D359FED.6010209@linux.vnet.ibm.com>

On 01/18/2011 08:13 AM, Anthony Liguori wrote:
> On 01/18/2011 08:02 AM, Gerd Hoffmann wrote:
>> On 01/17/11 15:53, Michael Roth wrote:
>>> On 01/17/2011 07:53 AM, Gerd Hoffmann wrote:
>>>> What is your plan to handle system-level queries+actions (such as
>>>> reboot) vs. per-user stuff (such as cut+paste)?
>>>
>>> This is an area that hasn't been well-defined yet and is definitely open
>>> for suggestions.
>>
>> One option would be to have two virtio-serial channels, one for the
>> system and one for the user stuff. gdm could grant the desktop user
>> access to the user channel like it does with sound devices and simliar
>> stuff, so the user agent has access to it.
>>
>> Another option is to have some socket where the user agent can talk to
>> the system agent and have it relay the requests.
>
> I think this is the best approach. One requirement we've been working
> with is that all actions from guest agents are logged. This is to give
> an administrator confidence that the hypervisor isn't doing anything
> stupid. If you route all of the user traffic through a privileged
> daemon, you can log everything to syslog or an appropriate log file.
>

A brain-dump on how we're planning to do this. I tried to keep it 
concise, but that only went so far :)

We extend qemu-va, the virtagent guest agent, to be able to create a 
unix socket in the guest that listens for connections.

We also extend qemu-va so that it can run as a user-level daemon that 
can connect to the aforementioned socket.

   root: qemu-va -c virtio-serial -p 
/dev/virtio-ports/org.qemu.virtagent 
--user-socket=/var/run/virtagent.user.sock

   user: qemu-va -c unix-connect -p /var/run/virtagent.user.sock 
[--username=user] --user-daemon

The user-level daemon will drop priviledges to specified username if 
necessary, or run as the invoking user. User->daemon mappings will be 
determined by the system-level agent using getsockopt on new connections.

The user-level daemon operates in the same manner as the system-level 
daemon: it can execute RPCs in the host, and the host can execute RPCs 
it implements. This should theoretically make it capable of vdagent-like 
functionality by adding the appropriate host/guest-side RPCs. We would 
have to incorporate the X11 fd into the main select() for events and 
such, but that should be fairly straight-forward.

User-specific host->guest RPCs will add an http header, 
"X-Virtagent-Username", specifying the intended recipient. If that 
recipient has no associated running user-level daemon, an error will be 
returned by the system-level daemon. An RPC may be provided so the host 
can query the system-level agent for connected users.

User-generated guest->host RPCs will be routed directly to the host, 
with the same "X-Virtagent-Username" http header inserted by the 
system-level agent. The host will re-insert this header field in it's 
responses so the system-level agent can route the responses back to the 
user.

We will only allow one daemon per user at a time, and enforce this with 
a pid/lock file. If this is circumvented somehow (or we allow a 
user-specifiable pid file), a new connection specifying a user that's 
already been mapped to a user-level daemon will overwrite the existing 
mapping, and the old connection will be closed by the system-level 
daemon if it is still active.

Some caveats to consider however:

1) There may be user-level RPCs that are generally desirable...such as 
being able to execute a script as an unpriveledged user, or access a 
file in the same way. So it makes sense to invoke user-level agent 
startup with a login script. But for X-related things like Spice, an 
.xsession hook makes more sense. If we do both, the .xsession-spawned 
daemon will "take over", but any existing stateful interactions with 
that user will be effectively reset. This may be undesirable. One option 
is to XOpenDisplay() "on demand", rather than at startup. We won't know 
what $env{DISPLAY} is then, however, and there could be multiple 
displays for that user. I'm not sure if there's a reliable way to query 
such a thing, but assuming you can...we could implement stateful RPCs so 
establish a connection later: There could be multiple displays as well. 
My first inclination would be to have something like:

on host:
query_displays(user)
connect_display(user, display_name)
query_screens(user, display_name)
etc..

This requires either the host to poll for displays, or for the guest 
agent to do it and then notify the host, however. The only way I see 
around this is to only start the user-level daemon via .xsession or similar.

2) Pulling X11 dependencies into virtagent...I'm not sure how well this 
would go over. We may end up needing to move qemu-va into a seperate 
repo that pulls in deps from qemu.git

-Mike

  reply	other threads:[~2011-01-31 14:42 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 13:14 [Qemu-devel] [RFC][PATCH v6 00/23] virtagent: host/guest RPC communication agent Michael Roth
2011-01-17 13:14 ` [Qemu-devel] [RFC][PATCH v6 01/23] Move code related to fd handlers into utility functions Michael Roth
2011-01-17 13:56   ` Gerd Hoffmann
2011-01-17 13:14 ` [Qemu-devel] [RFC][PATCH v6 02/23] Add qemu_set_fd_handler() wrappers to qemu-tools.c Michael Roth
2011-01-17 13:14 ` [Qemu-devel] [RFC][PATCH v6 03/23] Make qemu timers available for tools Michael Roth
2011-01-21 16:30   ` [Qemu-devel] " Jes Sorensen
2011-01-21 17:26     ` Michael Roth
2011-01-24  7:56       ` Jes Sorensen
2011-01-17 13:14 ` [Qemu-devel] [RFC][PATCH v6 04/23] virtagent: common code for managing client/server rpc jobs Michael Roth
2011-01-17 13:14 ` [Qemu-devel] [RFC][PATCH v6 05/23] virtagent: transport definitions read/send callback functions Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 06/23] virtagent: base client definitions Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 07/23] virtagent: base server definitions Michael Roth
2011-01-21 16:38   ` [Qemu-devel] " Jes Sorensen
2011-01-21 17:55     ` Michael Roth
2011-01-24 10:16       ` Jes Sorensen
2011-01-24 16:51         ` Michael Roth
2011-01-24 17:04           ` Jes Sorensen
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 08/23] virtagent: add va.getfile RPC Michael Roth
2011-01-21 16:40   ` [Qemu-devel] " Jes Sorensen
2011-01-21 17:20     ` Daniel P. Berrange
2011-01-21 18:23       ` Michael Roth
2011-01-24 22:08         ` Richard W.M. Jones
2011-01-24 22:20           ` Richard W.M. Jones
2011-01-24 22:26             ` Anthony Liguori
2011-01-24 22:48               ` Richard W.M. Jones
2011-01-24 23:40                 ` Anthony Liguori
2011-01-25  0:22                   ` Michael Roth
2011-01-25  0:25                     ` Anthony Liguori
2011-01-25  9:21                   ` Richard W.M. Jones
2011-01-25 15:12                     ` Anthony Liguori
2011-01-25 15:43                       ` Richard W.M. Jones
2011-01-26 13:01                         ` Richard W.M. Jones
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 09/23] virtagent: add agent_viewfile qmp/hmp command Michael Roth
2011-01-21 16:41   ` [Qemu-devel] " Jes Sorensen
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 10/23] virtagent: add va.getdmesg RPC Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 11/23] virtagent: add agent_viewdmesg qmp/hmp commands Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 12/23] virtagent: add va.shutdown RPC Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 13/23] virtagent: add agent_shutdown qmp/hmp commands Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 14/23] virtagent: add va.ping RPC Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 15/23] virtagent: add agent_ping qmp/hmp commands Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 16/23] virtagent: add agent_capabilities " Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 17/23] virtagent: add client capabilities init function Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 18/23] virtagent: add va.hello RPC Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 19/23] virtagent: add "hello" notification function for guest agent Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 20/23] virtagent: add va.capabilities RPC Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 21/23] virtagent: add virtagent guest daemon Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 22/23] virtagent: integrate virtagent server/client via chardev Michael Roth
2011-01-17 13:15 ` [Qemu-devel] [RFC][PATCH v6 23/23] virtagent: various bits to build QEMU with virtagent Michael Roth
2011-01-24 10:24   ` [Qemu-devel] " Jes Sorensen
2011-01-17 13:53 ` [Qemu-devel] [RFC][PATCH v6 00/23] virtagent: host/guest RPC communication agent Gerd Hoffmann
2011-01-17 14:53   ` Michael Roth
2011-01-18 14:02     ` Gerd Hoffmann
2011-01-18 14:13       ` Anthony Liguori
2011-01-31 14:41         ` Michael Roth [this message]
2011-02-01 22:18           ` Michael Roth
2011-02-14  9:49             ` Gerd Hoffmann
2011-02-16 16:04 ` Jes Sorensen
2011-02-16 17:22   ` Michael Roth
2011-02-17  8:26     ` Jes Sorensen
2011-02-17  9:08       ` Dor Laor
2011-02-17 14:39       ` Michael Roth
2011-02-18 12:45         ` Jes Sorensen
2011-02-18 14:07           ` Anthony Liguori
2011-02-18 14:30             ` Jes Sorensen
2011-02-18 14:57               ` Anthony Liguori
2011-02-21  8:32                 ` Jes Sorensen
2011-02-21 13:36                   ` Michael Roth
2011-02-21 13:38                     ` Jes Sorensen
2011-02-18 15:22             ` Gerd Hoffmann
2011-02-18 15:25               ` 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=4D46CA2D.5050807@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=abeekhof@redhat.com \
    --cc=agl@linux.vnet.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=marcel.mittelstaedt@de.ibm.com \
    --cc=markus_mueller@de.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@us.ibm.com \
    --cc=stefanha@linux.vnet.ibm.com \
    /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).