14.13. Displaying Per-guest Virtual Machine Information

This section provides information about displaying virtual machine information for each guest.

14.13.1. Displaying the Guest Virtual Machines

To display the guest virtual machine list and their current states with virsh:
# virsh list
Other options available include:
  • --inactive option lists the inactive guest virtual machines (that is, guest virtual machines that have been defined but are not currently active)
  • --all option lists all guest virtual machines. For example:
    # virsh list --all
     Id Name                 State
    ----------------------------------
      0 Domain-0             running
      1 Domain202            paused
      2 Domain010            inactive
      3 Domain9600           crashed
    
    There are seven states that can be visible using this command:
    • Running - The running state refers to guest virtual machines which are currently active on a CPU.
    • Idle - The idle state indicates that the domain is idle, and may not be running or able to run. This can be caused because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.
    • Paused - The paused state lists domains that are paused. This occurs if an administrator uses the paused button in virt-manager or virsh suspend. When a guest virtual machine is paused it consumes memory and other resources but it is ineligible for scheduling and CPU resources from the hypervisor.
    • Shutdown - The shutdown state is for guest virtual machines in the process of shutting down. The guest virtual machine is sent a shutdown signal and should be in the process of stopping its operations gracefully. This may not work with all guest virtual machine operating systems; some operating systems do not respond to these signals.
    • Shut off - The shut off state indicates that the domain is not running. This can be caused when a domain completely shuts down or has not been started.
    • Crashed - The crashed state indicates that the domain has crashed and can only occur if the guest virtual machine has been configured not to restart on crash.
    • Dying - Domains in the dying state are in is in process of dying, which is a state where the domain has not completely shut-down or crashed.
  • --managed-save Although this option alone does not filter the domains, it will list the domains that have managed save state enabled. In order to actually list the domains separately you will need to use the --inactive option as well.
  • --name is specified domain names are printed in a list. If --uuid is specified the domain's UUID is printed instead. Using the option --table specifies that a table style output should be used. All three commands are mutually exclusive
  • --title This command must be used with --table output. --titlewill cause an extra column to be created in the table with the short domain description (title).
  • --persistentincludes persistent domains in a list. Use the --transient option.
  • --with-managed-save lists the domains that have been configured with managed save. To list the commands without it, use the command --without-managed-save
  • --state-running filters out for the domains that are running, --state-paused for paused domains, --state-shutoff for domains that are turned off, and --state-other lists all states as a fallback.
  • --autostart this option will cause the auto-starting domains to be listed. To list domains with this feature disabled, use the option --no-autostart.
  • --with-snapshot will list the domains whose snapshot images can be listed. To filter for the domains without a snapshot, use the option --without-snapshot
$ virsh list --title --name

    Id       Name                                          State     Title
    0        Domain-0                                      running   Mailserver1
    2        rhelvm                                        paused
For an example of virsh vcpuinfo output, refer to Section 14.13.2, “Displaying Virtual CPU Information”