From: Luiz Capitulino <lcapitulino@redhat.com>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: aliguori@linux.vnet.ibm.com, Jes.Sorensen@redhat.com,
agl@linux.vnet.ibm.com, Michael Roth <mdroth@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [QAPI+QGA 3/3] QEMU Guest Agent (virtagent) v7
Date: Fri, 15 Jul 2011 13:27:45 -0300 [thread overview]
Message-ID: <20110715132745.332414d0@doriath> (raw)
In-Reply-To: <CAEH94LjDZdNECT=khCSFYr5H0UyXs9bRLbDbcS2aBWAHoVJX=A@mail.gmail.com>
On Fri, 15 Jul 2011 09:15:18 +0800
Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
> On Fri, Jul 15, 2011 at 4:00 AM, Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> > This is Set 3/3 of the QAPI+QGA patchsets.
> >
> > These patches apply on top of qapi-backport-set2-v6, and can also be obtained from:
> > git://repo.or.cz/qemu/mdroth.git qapi-backport-set3-v7
> >
> > (Set1+2 are a backport of some of the QAPI-related work from Anthony's
> > glib tree. The main goal is to get the basic code generation infrastructure in
> > place so that it can be used by the guest agent to implement a QMP-like guest
> > interface, and so that future work regarding the QMP conversion to QAPI can be
> > decoupled from the infrastructure bits. Set3 is the Qemu Guest Agent
> > (virtagent), rebased on the new code QAPI code generation infrastructure. This
> > is the first user of QAPI, QMP will follow.)
> > ___
> >
> > CHANGES SINCE V6:
> > - Made "/dev/virtio-ports/org.qemu.guest_agent.0" default device path for agent
> > - Consolidated uneeded fcntl() calls into qemu_open()
> > - JSON/QMP parse errors now propagated to client
> > - Replaced non-assertion uses of g_error() with exit()
> > - Added guest-file-flush
> > - Removed limit on max read size for guest-file-read
> > - 'count' parameters to guest-file-read/guest-file-write are now optional (default to 4KB and size of provided buffer, base64-decoded, respectively)
> > - Removed redundant 'file_' and 'shutdown_' prefixes from guest-file-*/guest-shutdown commands, switched to "-" in place of "_" in parameter names, renamed guest-file-read's "buf" param to "buf-b64" and guest-file-write's "data_b64" param to "buf-b64" for consistency.
> > - guest-fsfreeze-freeze now returns error objects on error rather as part of it's integer return values, and on error will unfreeze previously frozen filesystems.
> > - GUEST_FSFREEZE_STATUS_INPROGRESS removed, GUEST_FSFREEZE_STATUS_ERROR now serves the explicit purpose of noting a failure to find a previously mounted filesytem/directory after initial freeze, or failure to unfreeze 1 or more filesystems.
> > - -c/--channel option to qemu-ga is now -m/--method
> >
> > CHANGES SINCE V5:
> > - switched to using qemu malloc/list functions where possible
> > - removed unused proxy_path field in struct GAState
> > - pid file now opened write-only, removed lockf() in favor of O_EXCL, added SIGINT/SIGTERM signal handlers to handle cleanup
> > - cleaned up error-handling, switched to asserts where appropriate, removed unecessary gotos and NULL checks for qemu_free()/qobject_decref()
> > - refactored send_payload() using helper functions
> > - fixed improper handling of pidfile fd==0
> > - changed guest-shutdown's "shutdown_mode" param to "mode"
> > - switched to using kernel-generated FDs for guest-file-open rather than an autoincrement value
> > - add maximum chunk size of guest-file-read/guest-file-write
> > - added checks to avoid guest-file-write from writing data beyond the provided data buffer
> > - made logging best-effort, removed handling of failures to log as errors
> > - guest-shutdown exec errors now logged to guest syslog, clarified shutdown's asynchronous, no gauruntee nature in schema.
> >
> > CHANGES SINCE V4:
> > - Removed timeout mechanism via worker thread/pthread_cancel due to potential memory leak. Will re-introduce guest-side timeout support in future version.
> > - Fixed up fsfreeze code to use enums specified within the guest agent's qapi schema.
> > - Fixed memory leak due to a log statement, and added missing cleanup functions for heap-allocated g_error objects.
> > - Made "mode" param to guest-file-open optional, defaults to "r" (read-only)
> >
> > CHANGES SINCE V3:
> > - Fixed error-handling issues in fsfreeze commands leading to certain mounted directories causing freeze/thaw operations to fail
> > - Added cleanup hook to thaw filesystems on graceful guest agent exit
> > - Removed unused enum values and added additional details to schema documentation
> > - Fixed build issue that was missed due to deprecated files in source tree, removed unused includes
> >
> > CHANGES SINCE V2:
> > - Rebased on new QAPI code generation framework
> > - Dropped ability for QMP to act as a proxy for the guest agent, will be added when new QMP server is backported from Anthony's glib tree
> > - Replaced negotiation/control events with a simple 2-way handshake implemented by a standard RPC (guest-sync)
> > - Removed enforcement of "pristine" sessions, state is now global/persistant across multiple clients/connections
> > - Fixed segfault in logging code
> > - Added Jes' filesystem freeze patches
> > - General cleanups
> >
> > CHANGES SINCE V1:
> > - Added guest agent worker thread to execute RPCs in the guest. With this in place we have a reliable timeout mechanism for hung commands, currently set at 30 seconds.
> > - Add framework for registering init/cleanup routines for stateful RPCs to clean up after themselves after a timeout.
> > - Added the following RPCs: guest-file-{open,close,read,write,seek}, guest-shutdown, guest-info, and removed stubs for guest-view-file (now deprecated)
> > - Added GUEST_AGENT_UP/GUEST_AGENT_DOWN QMP events
> > - Switched to a TCP-style host-initiated 3-way handshake for channel negotiation, this simplifies client negotiation/interaction over the wire
> > - Added configurable log level/log file/pid file options for guest agent
> > - Various fixes for bugs/memory leaks and checkpatch.pl fixups
> >
> > ISSUES/TODOS:
> > - Add unit tests for guest agent wire protocol
> >
> > OVERVIEW
> >
> > For a better overview of what these patches are meant to accomplish, please reference the RFC for virtagent:
> >
> > http://comments.gmane.org/gmane.comp.emulators.qemu/96096
> >
> > These patches integrate the previous virtagent guest agent work directly in QAPI/QMP to leverage it's auto-generated marshalling code. This has numerous benefits:
> >
> > - addresses previous concerns over relying on external libraries to handle data encapsulation
> > - reduces the need for manual unmarshalling of requests/responses, which makes adding new RPCs much safer/less error-prone, as well as cutting down on redundant code
> > - QAPI documentation aligns completely with guest-side RPC implementation
> > - is Just Better (TM)
> >
> > BUILD/USAGE
> >
> > build:
> > ./configure --target-list=x86_64-softmmu
> > make
> > make qemu-ga #should be built on|for target guest
> HI, Macheal.
> Is qemu-ga built in guest? if yes, it will require the guest to set up
> a gcc environment. Can we make it built on the host?
Yes, if the host OS matches the guest OS or if you can cross-compile.
Otherwise I think we'll have to rely on distros making qemu-ga available,
and/or use the guest tools iso Michael is planning. Another option would
be to compile qemu-ga statically, but this is probably unfeasible.
>
> >
> > start guest:
> > qemu \
> > -drive file=/home/mdroth/vm/rhel6_64_base.raw,snapshot=off,if=virtio \
> > -net nic,model=virtio,macaddr=52:54:00:12:34:00 \
> > -net tap,script=/etc/qemu-ifup \
> > -vnc :1 -m 1024 --enable-kvm \
> > -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
> > -device virtio-serial \
> > -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"
> >
> > use guest agent:
> > ./qemu-ga -h
> > ./qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0
> >
> > start/use qmp:
> > mdroth@illuin:~$ sudo socat unix-connect:/tmp/qga.sock readline
> > {"execute":"guest-sync", "arguments":{"id":1234}}
> > {"return": 1234}
> >
> > {"execute":"guest-ping"}
> > {"return": {}}
> >
> > {"execute": "guest-info"}
> > {"return": {"version": "1.0"}}
> >
> > // write "hello world!\n" to /tmp/testqga
> > {"execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"w+"}}
> > {"return": 0}
> > {"execute":"guest-file-write", "arguments":{"handle":0,"buf-b64":"aGVsbG8gd29ybGQhCg=="}}
> > {"return": {"count": 13, "eof": false}}
> > {"execute":"guest-file-close", "arguments":{"handle":0}}
> > {"return": {}}
> >
> > // read back the "hello world!\n" from /tmp/testqga
> > {"execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"r"}}
> > {"return": 1}
> > {"execute":"guest-file-read", "arguments":{"handle":1,"count":1024}}
> > {"return": {"buf-b64": "aGVsbG8gd29ybGQhCg==", "count": 13, "eof": true}}
> > {"execute":"guest-file-close","arguments":{"handle":1}}
> > {"return": {}}
> >
> > Makefile | 25 ++-
> > configure | 1 +
> > qapi-schema-guest.json | 217 +++++++++++++
> > qemu-ga.c | 671 +++++++++++++++++++++++++++++++++++++++
> > qerror.c | 13 +
> > qerror.h | 6 +
> > qga/guest-agent-command-state.c | 73 +++++
> > qga/guest-agent-commands.c | 512 +++++++++++++++++++++++++++++
> > qga/guest-agent-core.h | 31 ++
> > 9 files changed, 1544 insertions(+), 5 deletions(-)
> >
> >
> >
>
>
>
next prev parent reply other threads:[~2011-07-15 16:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-14 20:00 [Qemu-devel] [QAPI+QGA 3/3] QEMU Guest Agent (virtagent) v7 Michael Roth
2011-07-14 20:00 ` [Qemu-devel] [PATCH v7 1/4] qerror: add QERR_JSON_PARSE_ERROR to qerror.c Michael Roth
2011-07-14 20:00 ` [Qemu-devel] [PATCH v7 2/4] guest agent: command state class Michael Roth
2011-07-14 20:00 ` [Qemu-devel] [PATCH v7 3/4] guest agent: qemu-ga daemon Michael Roth
2011-07-14 20:00 ` [Qemu-devel] [PATCH v7 4/4] guest agent: add guest agent RPCs/commands Michael Roth
2011-07-15 16:23 ` Luiz Capitulino
2011-07-15 17:21 ` Michael Roth
2011-07-15 18:01 ` Luiz Capitulino
2011-07-15 1:15 ` [Qemu-devel] [QAPI+QGA 3/3] QEMU Guest Agent (virtagent) v7 Zhi Yong Wu
2011-07-15 16:27 ` Luiz Capitulino [this message]
2011-09-07 6:36 ` Zhi Yong Wu
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=20110715132745.332414d0@doriath \
--to=lcapitulino@redhat.com \
--cc=Jes.Sorensen@redhat.com \
--cc=agl@linux.vnet.ibm.com \
--cc=aliguori@linux.vnet.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=zwu.kernel@gmail.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).