10.2.2. Setting up Communication between Guest Agent and Host
The host machine communicates with the guest agent through a VirtIO serial connection between the host and guest machines. A VirtIO serial channel is connected to the host via a character device driver (typically a Unix socket), and the guest listens on this serial channel. The following procedure shows how to set up the host and guest machines for guest agent use.
For instructions on how to set up the QEMU guest agent on Windows guests, refer to the instructions found here.
Procedure 10.1. Setting up communication between guest agent and host
Open the guest XMLOpen the guest XML with the QEMU guest agent configuration. You will need the guest name to open the file. Use the command
# virsh liston the host machine to list the guests that it can recognize. In this example, the guest's name is rhel6:
virsh edit rhel6
Edit the guest XML fileAdd the following elements to the XML file and save the changes.
<channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/rhel6.agent'/> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel>
Figure 10.1. Editing the guest XML to configure the QEMU guest agent
Start the QEMU guest agent in the guestDownload and install the guest agent in the guest virtual machine using
yum install qemu-guest-agentif you have not done so already. Once installed, start the service as follows:
service start qemu-guest-agent
You can now communicate with the guest by sending valid libvirt commands over the established character device driver.