Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
Applies to SUSE Linux Enterprise Server 15 SP2

19 QEMU Guest Agent Edit source

The QEMU guest agent (GA) runs inside the VM Guest and allows the VM Host Server to run commands in the guest operating system via libvirt. It supports many functions—for example, getting details about guest file systems, freezing and thawing file systems, or suspending or rebooting a guest.

QEMU GA is included in the qemu-guest-agent package and is installed, configured, and activated by default on KVM or Xen virtual machines.

19.1 Running QEMU GA Commands Edit source

QEMU GA includes many native commands that do not have direct libvirt counterparts. Refer to Section 19.4, “For More Information” to find the complete list. You can run all of the QEMU GA commands by using libvirt's general purpose command qemu-agent-command:

virsh qemu-agent-command DOMAIN_NAME '{"execute":"QEMU_GA_COMMAND"}'

For example:

tux > sudo virsh qemu-agent-command sle15sp2 '{"execute":"guest-info"}' --pretty
"return": {
  "version": "4.2.0",
  "supported_commands": [
      "enabled": true,
      "name": "guest-get-osinfo",
      "success-response": true

19.2 virsh Commands that Require QEMU GA Edit source

Several virsh commands require QEMU GA for their functionality. Here are some of them:

virsh guestinfo

Prints information about the guest from the guest's point of view.

virsh guestvcpus

Queries or changes the state of virtual CPUs from the guest's point of view.

virsh set-user-password

Sets the password for a user account in the guest.

virsh domfsinfo

Shows a list of mounted file systems within the running domain.

virsh dompmsuspend

Suspends a running guest.

19.3 Enhancing libvirt Commands Edit source

If QEMU GA is enabled inside the guest, a number of virsh subcommands have enhanced functionality when run in the agent mode. The following list includes only some examples of them. For a complete list, see the virsh manual page and search for the agent string.

virsh shutdown --mode agent and virsh reboot --mode agent

This method of shutting down or rebooting leaves the guest clean for its next run, similar to the ACPI method.

virsh domfsfreeze and virsh domfsthaw

Instructs the guest to make its file system quiescent: to flush all I/O operations in the cache and leave volumes in a consistent state, so that no checks will be needed when they are remounted.

virsh setvcpus --guest

Changes the number of CPUs assigned to a guest.

virsh domifaddr --source agent

Queries the QEMU GA for the guest's IP address.

virsh vcpucount --guest

Prints information about the virtual CPU counts from the perspective of the guest.

19.4 For More Information Edit source

Print this page