Chapter 11. Enhancing Virtualization with the QEMU Guest Agent and SPICE Agent
Note
11.1. QEMU Guest Agent
Important
11.1.1. Setting up Communication between the QEMU Guest Agent and Host
Note
11.1.1.1. Configuring the QEMU Guest Agent on a Linux Guest
virsh
or virt-manager can be used to configure communication between the guest and the QEMU guest agent. The following instructions describe how to configure the QEMU guest agent on a Linux guest.
Procedure 11.1. Setting up communication between guest agent and host with virsh
on a shut down Linux guest
Shut down the virtual machine
Ensure the virtual machine (named rhel7 in this example) is shut down before configuring the QEMU guest agent:#
virsh shutdown rhel7
Add the QEMU guest agent channel to the guest XML configuration
Edit the guest's XML file to add the QEMU guest agent details:#
virsh edit rhel7
Add the following to the guest's XML file and save the changes:<channel type='unix'> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel>
Start the virtual machine
#
virsh start rhel7
Install the QEMU guest agent on the guest
Install the QEMU guest agent if not yet installed in the guest virtual machine:#
yum install qemu-guest-agent
Start the QEMU guest agent in the guest
Start the QEMU guest agent service in the guest:#
systemctl start qemu-guest-agent
Procedure 11.2. Setting up communication between guest agent and host on a running Linux guest
Create an XML file for the QEMU guest agent
#
cat agent.xml
<channel type='unix'> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel>Attach the QEMU guest agent to the virtual machine
Attach the QEMU guest agent to the running virtual machine (named rhel7 in this example) with this command:#
virsh attach-device rhel7 agent.xml
Install the QEMU guest agent on the guest
Install the QEMU guest agent if not yet installed in the guest virtual machine:#
yum install qemu-guest-agent
Start the QEMU guest agent in the guest
Start the QEMU guest agent service in the guest:#
systemctl start qemu-guest-agent
Procedure 11.3. Setting up communication between the QEMU guest agent and host with virt-manager
Shut down the virtual machine
Ensure the virtual machine is shut down before configuring the QEMU guest agent.To shut down the virtual machine, select it from the list of virtual machines in Virtual Machine Manager, then click the light switch icon from the menu bar.Add the QEMU guest agent channel to the guest
Open the virtual machine's hardware details by clicking the lightbulb icon at the top of the guest window.Click the Add New Virtual Hardware window, and select Channel.button to open theSelect the QEMU guest agent from the Name drop-down list and click :Figure 11.1. Selecting the QEMU guest agent channel device
Start the virtual machine
To start the virtual machine, select it from the list of virtual machines in Virtual Machine Manager, then click on the menu bar.Install the QEMU guest agent on the guest
Open the guest with virt-manager and install the QEMU guest agent if not yet installed in the guest virtual machine:#
yum install qemu-guest-agent
Start the QEMU guest agent in the guest
Start the QEMU guest agent service in the guest:#
systemctl start qemu-guest-agent