[libvirt] [PATCH v2 1/4] QEMU guest agent support
Eric Blake
eblake at redhat.com
Mon Jan 23 20:40:01 UTC 2012
On 01/23/2012 07:48 AM, Michal Privoznik wrote:
> There is now a standard QEMU guest agent that can be installed
> and given a virtio serial channel
>
> <channel type='unix'>
> <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
> <target type='virtio' name='org.qemu.guest_agent.0'/>
> </channel>
You also need to update docs/formatdomain.html.in to include this
specific example. May I propose that you squash in this:
diff --git i/docs/formatdomain.html.in w/docs/formatdomain.html.in
index de9b480..6667bed 100644
--- i/docs/formatdomain.html.in
+++ w/docs/formatdomain.html.in
@@ -3017,6 +3017,10 @@ qemu-kvm -net nic,model=? /dev/null
<channel type='pty'>
<target type='virtio'
name='arbitrary.virtio.serial.port.name'/>
</channel>
+ <channel type='unix'>
+ <source mode='bind'
path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
+ </channel>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
@@ -3045,7 +3049,11 @@ qemu-kvm -net nic,model=? /dev/null
optional element <code>address</code> can tie the channel to a
particular <code>type='virtio-serial'</code>
controller, <a href="#elementsAddress">documented above</a>.
- <span class="since">Since 0.7.7</span></dd>
+ With qemu, if <code>name</code> is "org.qemu.guest_agent.0",
+ then libvirt can interact with a guest agent installed in the
+ guest, for actions such as guest shutdown or file system quiescing.
+ <span class="since">Since 0.7.7, guest agent interaction
+ since 0.9.10</span></dd>
<dt><code>spicevmc</code></dt>
<dd>Paravirtualized SPICE channel. The domain must also have a
I think the RNG already covers the addition, though, so we are good
there, and that means that we can get by without any tests/ additions
(we already have tests for virtio <channel> parsing), although it
wouldn't hurt if you wanted to add some tests.
> +struct _qemuAgent {
> + virMutex lock; /* also used to protect fd */
> + virCond notify;
> +
> + int refs;
> +
> + int fd;
> + int watch;
> +
> + bool connectPending;
> +
> + virDomainObjPtr vm;
> +
> + qemuAgentCallbacksPtr cb;
> +
> + /* If there's a command being processed this will be
> + * non-NULL */
> + qemuAgentMessagePtr msg;
> +
> + /* Buffer incoming data ready for Text/QMP monitor
> + * code to process & find message boundaries */
s,Text/QMP,Agent,
> + switch (config->type) {
> + case VIR_DOMAIN_CHR_TYPE_UNIX:
> + mon->fd = qemuAgentOpenUnix(config->data.nix.path, vm->pid,
> + &mon->connectPending);
> + break;
> +
> + case VIR_DOMAIN_CHR_TYPE_PTY:
> + mon->fd = qemuAgentOpenPty(config->data.file.path);
> + break;
Do we really want to support <channel type='pty'> for agent interaction,
or just mandate that the guest agent must use <channel type='unix'>? I
guess we support both for the monitor as well, in case we ever use
qemu-attach to convert a running guest that used a pty monitor into a
libvirt-managed guest.
ACK with above fixes included.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120123/5ee6e9b9/attachment-0001.sig>
More information about the libvir-list
mailing list