From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: agl@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com,
Jes Sorensen <Jes.Sorensen@redhat.com>,
marcel.mittelstaedt@de.ibm.com, qemu-devel@nongnu.org,
markus_mueller@de.ibm.com, aliguori@linux.vnet.ibm.com,
ryanh@us.ibm.com, abeekhof@redhat.com
Subject: Re: [Qemu-devel] Re: [RFC][PATCH v6 08/23] virtagent: add va.getfile RPC
Date: Fri, 21 Jan 2011 12:23:40 -0600 [thread overview]
Message-ID: <4D39CF2C.1000407@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110121172026.GK12589@redhat.com>
On 01/21/2011 11:20 AM, Daniel P. Berrange wrote:
> On Fri, Jan 21, 2011 at 05:40:54PM +0100, Jes Sorensen wrote:
>> On 01/17/11 14:15, Michael Roth wrote:
>>> Add RPC to retrieve a guest file. This interface is intended
>>> for smaller reads like peeking at logs and /proc and such.
>>>
>>> Signed-off-by: Michael Roth<mdroth@linux.vnet.ibm.com>
>>> ---
>>> virtagent-server.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 files changed, 59 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/virtagent-server.c b/virtagent-server.c
>>> index c38a9e0..af4b940 100644
>>> --- a/virtagent-server.c
>>> +++ b/virtagent-server.c
>>> @@ -62,12 +62,71 @@ out:
>>> return ret;
>>> }
>>>
>>> +/* RPC functions common to guest/host daemons */
>>> +
>>> +/* va_getfile(): return file contents
>>> + * rpc return values:
>>> + * - base64-encoded file contents
>>> + */
>>> +static xmlrpc_value *va_getfile(xmlrpc_env *env,
>>> + xmlrpc_value *params,
>>> + void *user_data)
>>> +{
>>> + const char *path;
>>> + char *file_contents = NULL;
>>> + char buf[VA_FILEBUF_LEN];
>>
>> malloc()!
>>
>>> + int fd, ret, count = 0;
>>> + xmlrpc_value *result = NULL;
>>> +
>>> + /* parse argument array */
>>> + xmlrpc_decompose_value(env, params, "(s)",&path);
>>> + if (env->fault_occurred) {
>>> + return NULL;
>>> + }
>>> +
>>> + SLOG("va_getfile(), path:%s", path);
>>> +
>>> + fd = open(path, O_RDONLY);
>>> + if (fd == -1) {
>>> + LOG("open failed: %s", strerror(errno));
>>> + xmlrpc_faultf(env, "open failed: %s", strerror(errno));
>>> + return NULL;
>>> + }
>>> +
>>> + while ((ret = read(fd, buf, VA_FILEBUF_LEN))> 0) {
>>> + file_contents = qemu_realloc(file_contents, count + VA_FILEBUF_LEN);
>>> + memcpy(file_contents + count, buf, ret);
>>
>> Sorry, I brought this up before. This realloc() stuff is a disaster
>> waiting to happen. Please remove it from the patch series, until you
>> have an implementation that copies over a page of the time.
>
> I can understand the need of virtagent for lifecycle control/interactions
> with the guest OS (reboot, shutdown, ping, screen lock/unlock, etc), but
> do we really want to reinvent libguestfs for file access ? A little dev
> work could enable users to install the libguestfs agent into a guest OS,
> and access it from the host over virtio-serial + the libguestfs API.
File/dmesg/etc access is a bit of a grey area. Technically it's not
lifecycle-specific, but it tends to become a requirement for
higher-level management policies, and being reliant on external tools to
provide what, at least in our case, has been an extremely common
request/requirement, greatly reduces the usefulness of such an agent.
Ultimately however these interfaces would be exposed via libvirt, which
libguestfs already makes use of, so it'd be a logically way to extend it
for disk access to live guests.
getfile() is confusingly named however, it's really just a means to peek
at a text file like /proc/meminfo. general file access will be done via
a stateful interface that implements similar semantics to
open()/read()/write()/close().
>
> This would be quite compelling usage model for app developers, because
> it would mean whether the guest OS was running, or shutoff, they can
> use the same libguestfs API for processing guest filesystem images.
> The level of functionality provided by libguestfs is really quite
> considerable now, letting you do pretty much any operation against
> files that you could do via local POSIX for non-virt access, as
> well as providing many useful higher level constructs
>
> Regards,
> Daniel
next prev parent reply other threads:[~2011-01-21 18:23 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 [this message]
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
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=4D39CF2C.1000407@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=berrange@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).