Questo contenuto non è disponibile nella lingua selezionata.
21.9. virt-inspector: Inspecting Guest Virtual Machines
This section provides information about inspecting guest virtual machines.
21.9.1. Introduction Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
virt-inspector
is a tool for inspecting a disk image to find out what operating system it contains.
21.9.2. Installation Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
To install virt-inspector and the documentation, enter the following command:
yum install libguestfs-tools
# yum install libguestfs-tools
The documentation, including example XML output and a Relax-NG schema for the output, will be installed in
/usr/share/doc/libguestfs-devel-*/
where * is replaced by the version number of libguestfs.
21.9.3. Running virt-inspector Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
You can run
virt-inspector
against any disk image or libvirt guest virtual machine as shown in the following example:
virt-inspector -a disk.img > report.xml
$ virt-inspector -a disk.img > report.xmlvirt-inspector -a disk.img > report.xmlvirt-inspector -a disk.img > report.xml
Or as shown here:
virt-inspector -d GuestName > report.xml
$ virt-inspector -d GuestName > report.xmlvirt-inspector -d GuestName > report.xmlvirt-inspector -d GuestName > report.xml
The result will be an XML report (
report.xml
). The main components of the XML file are a top-level <operatingsytems>
element containing usually a single <operatingsystem>
element, similar to the following:
Processing these reports is best done using W3C standard XPath queries. Red Hat Enterprise Linux 7 comes with the
xpath
command-line program, which can be used for simple instances. However, for long-term and advanced usage, you should consider using an XPath library along with your favorite programming language.
As an example, you can list out all file system devices using the following XPath query:
Or list the names of all applications installed by entering:
virt-inspector GuestName | xpath //application/name
$ virt-inspector GuestName | xpath //application/namevirt-inspector GuestName | xpath //application/namevirt-inspector GuestName | xpath //application/name
[...long list...]