Questo contenuto non è disponibile nella lingua selezionata.

20.17. Guest Virtual Machine Retrieval Commands


20.17.1. Displaying the Host Physical Machine Name

The virsh domhostname domain command displays the specified guest virtual machine's physical host name provided the hypervisor can publish it.

Example 20.39. How to display the host physical machine name

The following example displays the host physical machine name for the guest1 virtual machine, if the hypervisor makes it available:
# virsh domhostname guest1

20.17.2. Displaying General Information about a Virtual Machine

The virsh dominfo domain command displays basic information about a specified guest virtual machine. This command may also be used with the option [--domain] guestname.

Example 20.40. How to display general information about the guest virtual machine

The following example displays general information about the guest virtual machine named guest1:
# virsh dominfo guest1
Id:             8
Name:           guest1
UUID:           90e0d63e-d5c1-4735-91f6-20a32ca22c40
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       271.9s
Max memory:     1048576 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c422,c469 (enforcing)

20.17.3. Displaying a Virtual Machine's ID Number

Although virsh list includes the ID in its output, the virsh domid domain>|<ID displays the ID for the guest virtual machine, provided it is running. An ID will change each time you run the virtual machine. If guest virtual machine is shut off, the machine name will be displayed as a series of dashes ('-----'). This command may also be used with the [--domain guestname] option.

Example 20.41. How to display a virtual machine's ID number

In order to run this command and receive any usable output, the virtual machine should be running. The following example produces the ID number of the guest1 virtual machine:
# virsh domid guest1
8

20.17.4. Aborting Running Jobs on a Guest Virtual Machine

The virsh domjobabort domain command aborts the currently running job on the specified guest virtual machine. This command may also be used with the [--domain guestname] option.

Example 20.42. How to abort a running job on a guest virtual machine

In this example, there is a job running on the guest1 virtual machine that you want to abort. When running the command, change guest1 to the name of your virtual machine:
# virsh domjobabort guest1

20.17.5. Displaying Information about Jobs Running on the Guest Virtual Machine

The virsh domjobinfo domain command displays information about jobs running on the specified guest virtual machine, including migration statistics. This command may also be used with the [--domain guestname] option, or with the --completed option to return information on the statistics of a recently completed job.

Example 20.43. How to display statistical feedback

The following example lists statistical information about the guest1 virtual machine:
# virsh domjobinfo guest1
Job type:         Unbounded
Time elapsed:     1603         ms
Data processed:   47.004 MiB
Data remaining:   658.633 MiB
Data total:       1.125 GiB
Memory processed: 47.004 MiB
Memory remaining: 658.633 MiB
Memory total:     1.125 GiB
Constant pages:   114382
Normal pages:     12005
Normal data:      46.895 MiB
Expected downtime: 0            ms
Compression cache: 64.000 MiB
Compressed data:  0.000 B
Compressed pages: 0
Compression cache misses: 12005
Compression overflows: 0

20.17.6. Displaying the Guest Virtual Machine's Name

The virsh domname domainID command displays the name guest virtual machine name, given its ID or UUID. Although the virsh list --all command will also display the guest virtual machine's name, this command only lists the guest's name.

Example 20.44. How to display the name of the guest virtual machine

The following example displays the name of the guest virtual machine with domain ID 8:
# virsh domname 8
guest1

20.17.7. Displaying the Virtual Machine's State

The virsh domstate domain command displays the state of the given guest virtual machine. Using the --reason argument will also display the reason for the displayed state. This command may also be used with the [--domain guestname] option, as well as the --reason option, which displays the reason for the state. If the command reveals an error, you should run the command virsh domblkerror. See Section 20.12.7, “Displaying Errors on Block Devices” for more details.

Example 20.45. How to display the guest virtual machine's current state

The following example displays the current state of the guest1 virtual machine:
# virsh domstate guest1
running

20.17.8. Displaying the Connection State to the Virtual Machine

virsh domcontrol domain displays the state of an interface to the hypervisor that is used to control a specified guest virtual machine. For states that are not OK or Error, it will also print the number of seconds that have elapsed since the control interface entered the displayed state.

Example 20.46. How to display the guest virtual machine's interface state

The following example displays the current state of the guest1 virtual machine's interface.
# virsh domcontrol guest1
ok
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.