.\" Automatically generated by Podwrapper::Man 1.44.0 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "guestfs-testing 1" .TH guestfs-testing 1 "2021-01-05" "libguestfs-1.44.0" "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" guestfs\-testing \- manual testing of libguestfs, you can help! .SH "DESCRIPTION" .IX Header "DESCRIPTION" This page has manual tests you can try on libguestfs. Everyone has a slightly different combination of platform, hardware and guests, so this testing is very valuable. Thanks for helping out! .PP Tests marked with a \fB*\fR (asterisk) can \fBdestroy data\fR if you're not careful. The others are safe and won't modify anything. .PP These tests \fBrequire libguestfs ≥ 1.22\fR. .PP You can report bugs you find through this link: .PP https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP or post on the mailing list (registration is \fBnot\fR required, but if you're not registered then you'll have to wait for a moderator to manually approve your message): .PP https://www.redhat.com/mailman/listinfo/libguestfs .SH "TESTS" .IX Header "TESTS" .SS "Run libguestfs-test-tool" .IX Subsection "Run libguestfs-test-tool" Run: .PP .Vb 1 \& libguestfs\-test\-tool .Ve .PP This command does a very simple, non-destructive test that basic libguestfs is functioning. You don't need to run it as root. .PP If it \fIdoesn't\fR print \f(CW\*(C`===== TEST FINISHED OK =====\*(C'\fR, report it as a bug. It is very important that you include the \fBcomplete, unedited\fR output of \f(CW\*(C`libguestfs\-test\-tool\*(C'\fR in your bug report. See the \&\*(L"\s-1BUGS\*(R"\s0 section at the end of this page. .SS "Check \s-1KVM\s0 acceleration is being used." .IX Subsection "Check KVM acceleration is being used." If your host has hardware virt acceleration, then with a hot cache libguestfs should be able to start up in a few seconds. Run the following command a few times: .PP .Vb 1 \& time guestfish \-a /dev/null run .Ve .PP After a few runs, the time should settle down to a few seconds (under 3 seconds on fast 64 bit hardware). .PP If the command above does not work at all, use \&\fBlibguestfs\-test\-tool\fR\|(1). .SS "Check which version of libguestfs, qemu, libvirt, etc is being used." .IX Subsection "Check which version of libguestfs, qemu, libvirt, etc is being used." Look at the output of \f(CW\*(C`libguestfs\-test\-tool\*(C'\fR and check: .IP "\(bu" 4 Which version of libguestfs is being used? Near the beginning of the output you'll see a line like: .Sp .Vb 1 \& library version: 1.22.0fedora=19,release=1.fc19,libvirt .Ve .IP "\(bu" 4 Is libvirt being used? You can tell the difference by looking for the backend: .Sp .Vb 1 \& guestfs_get_backend: direct .Ve .Sp or: .Sp .Vb 1 \& guestfs_get_backend: libvirt .Ve .IP "\(bu" 4 Which version of qemu is being used? It may be printed out: .Sp .Vb 1 \& libguestfs: qemu version 1.5 .Ve .IP "\(bu" 4 Which kernel is being used? \fBsupermin\fR\|(1) will try to pick the latest kernel installed on your machine. You can see the version in the appliance output, eg: .Sp .Vb 1 \& [ 0.000000] Linux version 3.9.2\-200.fc18.x86_64 [...] .Ve .SS "Try to open a local guest image with guestfish." .IX Subsection "Try to open a local guest image with guestfish." You can use any guest disk image for this test. Make sure you use the \&\f(CW\*(C`\-\-ro\*(C'\fR flag so that \fBguestfish\fR\|(1) will open the disk image read-only. .PP .Vb 1 \& guestfish \-\-ro \-a /path/to/disk.img \-i .Ve .PP If the command is successful, it should print out the guest operating system name and put you at the guestfish \f(CW\*(C`>\*(C'\fR prompt. You can use guestfish commands like \f(CW\*(C`ll /\*(C'\fR to look inside the disk image. To exit, type \f(CW\*(C`exit\*(C'\fR. .PP If you get an error, try enabling debugging (add \f(CW\*(C`\-v\*(C'\fR to the command line). Also make sure that \fBlibguestfs\-test\-tool\fR\|(1) succeeds. .SS "Try to open a remote guest image with guestfish." .IX Subsection "Try to open a remote guest image with guestfish." You may also have to disable libvirt by setting this: .PP .Vb 1 \& export LIBGUESTFS_BACKEND=direct .Ve .PP If you have a disk image available over \s-1HTTP/FTP,\s0 try to open it. .PP .Vb 1 \& guestfish \-\-ro \-i \-\-format=raw \-a http://www.example.com/disk.img .Ve .PP For \s-1SSH\s0 you will need to make sure that ssh-agent is set up so you don't need a password to log in to the remote machine. Then a command similar to this should work: .PP .Vb 2 \& guestfish \-\-ro \-i \-\-format=raw \e \& \-a ssh://remote.example.com/path/to/disk.img .Ve .PP If you get an error, try enabling debugging (add \f(CW\*(C`\-v\*(C'\fR to the command line). Also make sure that \fBlibguestfs\-test\-tool\fR\|(1) succeeds. .SS "Run virt-alignment-scan on all your guests." .IX Subsection "Run virt-alignment-scan on all your guests." Run \fBvirt\-alignment\-scan\fR\|(1) on guests or disk images: .PP .Vb 1 \& virt\-alignment\-scan \-a /path/to/disk.img .Ve .PP or: .PP .Vb 1 \& virt\-alignment\-scan \-d Guest .Ve .PP Does the alignment report match how the guest partitions are aligned? .SS "Run virt-cat on some files in guests." .IX Subsection "Run virt-cat on some files in guests." \&\fBvirt\-cat\fR\|(1) can display files from guests. For a Linux guest, try: .PP .Vb 1 \& virt\-cat LinuxGuest /etc/passwd .Ve .PP A recent feature is support for Windows paths, for example: .PP .Vb 1 \& virt\-cat WindowsGuest \*(Aqc:\ewindows\ewin.ini\*(Aq .Ve .PP An even better test is if you have a Windows guest with multiple drives. Do \f(CW\*(C`D:\*(C'\fR, \f(CW\*(C`E:\*(C'\fR etc paths work correctly? .SS "\fB*\fP Copy some files into a \fBshut off\fP guest." .IX Subsection "* Copy some files into a shut off guest." \&\fBvirt\-copy\-in\fR\|(1) can recursively copy files and directories into a guest or disk image. .PP .Vb 1 \& virt\-copy\-in \-d Guest /etc /tmp .Ve .PP This should copy local directory \fI/etc\fR to \fI/tmp/etc\fR in the guest (recursively). If you boot the guest, can you see all of the copied files and directories? .PP Shut the guest down and try copying multiple files and directories: .PP .Vb 1 \& virt\-copy\-in \-d Guest /home /etc/issue /tmp .Ve .SS "Copy some files out of a guest." .IX Subsection "Copy some files out of a guest." \&\fBvirt\-copy\-out\fR\|(1) can recursively copy files and directories out of a guest or disk image. .PP .Vb 1 \& virt\-copy\-out \-d Guest /home . .Ve .PP Note the final space and period in the command is not a typo. .PP This should copy \fI/home\fR from the guest into the current directory. .SS "Run virt-df." .IX Subsection "Run virt-df." \&\fBvirt\-df\fR\|(1) lists disk space. Run: .PP .Vb 1 \& virt\-df .Ve .PP You can try comparing this to the results from \fBdf\fR\|(1) inside the guest, but there are some provisos: .IP "\(bu" 4 The guest must be idle. .IP "\(bu" 4 The guest disks must be synched using \fBsync\fR\|(1). .IP "\(bu" 4 Any action such as booting the guest will write log files causing the numbers to change. .PP We don’t guarantee that the numbers will be identical even under these circumstances. They should be similar. It would indicate a bug if you saw greatly differing numbers. .SS "Try importing virt-df \s-1CSV\s0 output into a spreadsheet or database." .IX Subsection "Try importing virt-df CSV output into a spreadsheet or database." Run: .PP .Vb 1 \& virt\-df \-\-csv > /tmp/report.csv .Ve .PP Now try to load this into your favorite spreadsheet or database. Are the results reproduced faithfully in the spreadsheet/database? .PP http://www.postgresql.org/docs/8.1/static/sql\-copy.html http://dev.mysql.com/doc/refman/5.1/en/load\-data.html .SS "\fB*\fP Edit a file in a \fBshut off\fP guest." .IX Subsection "* Edit a file in a shut off guest." \&\fBvirt\-edit\fR\|(1) can edit files in guests. Try this command on a \s-1RHEL\s0 or Fedora guest: .PP .Vb 1 \& virt\-edit LinuxGuest /etc/sysconfig/network .Ve .PP On other Linux guests try editing other files such as: .PP .Vb 1 \& virt\-edit LinuxGuest /etc/motd .Ve .PP Are the changes seen inside the guest when it is booted? .SS "Display the filesystems / partitions / LVs in a guest." .IX Subsection "Display the filesystems / partitions / LVs in a guest." \&\fBvirt\-filesystems\fR\|(1) can be used to display filesystems in a guest. Try this command on any disk image or guest: .PP .Vb 1 \& virt\-filesystems \-a /path/to/disk.img \-\-all \-\-long \-h .Ve .PP or: .PP .Vb 1 \& virt\-filesystems \-d Guest \-\-all \-\-long \-h .Ve .PP Do the results match what is seen in the guest? .SS "Run virt-inspector on all your guests." .IX Subsection "Run virt-inspector on all your guests." Use \fBvirt\-inspector\fR\|(1) to get a report on all of your guests or disk images: .PP .Vb 1 \& virt\-inspector \-a /path/to/disk.img | less .Ve .PP or: .PP .Vb 1 \& virt\-inspector \-d Guest | less .Ve .PP Do the results match what is actually in the guest? .PP If you have an unusual guest (a rare Linux distro, a very new version of Windows), does virt-inspector recognize it? If not, then it's probably a bug. .SS "Try the auditing features of virt-ls on all your guests." .IX Subsection "Try the auditing features of virt-ls on all your guests." List all setuid or setgid programs in a Linux virtual machine: .PP .Vb 1 \& virt\-ls \-lR \-d Guest / | grep \*(Aq^\- [42]\*(Aq .Ve .PP List all public-writable directories in a Linux virtual machine: .PP .Vb 1 \& virt\-ls \-lR \-d Guest / | grep \*(Aq^d ...7\*(Aq .Ve .PP List all Unix domain sockets in a Linux virtual machine: .PP .Vb 1 \& virt\-ls \-lR \-d Guest / | grep \*(Aq^s\*(Aq .Ve .PP List all regular files with filenames ending in ‘.png’: .PP .Vb 1 \& virt\-ls \-lR \-d Guest / | grep \-i \*(Aq^\-.*\e.png$\*(Aq .Ve .PP Display files larger than 10MB in home directories: .PP .Vb 1 \& virt\-ls \-lR \-d Guest /home | awk \*(Aq$3 > 10*1024*1024\*(Aq .Ve .PP Find everything modified in the last 7 days: .PP .Vb 1 \& virt\-ls \-lR \-d Guest \-\-time\-days / | awk \*(Aq$6 <= 7\*(Aq .Ve .PP Find regular files modified in the last 24 hours: .PP .Vb 1 \& virt\-ls \-lR \-d Guest \-\-time\-days / | grep \*(Aq^\-\*(Aq | awk \*(Aq$6 < 1\*(Aq .Ve .PP Do the results match what is in the guest? .SS "Create a disk image from a tarball." .IX Subsection "Create a disk image from a tarball." Use \fBvirt\-make\-fs\fR\|(1) to create a disk image from any tarball that you happen to have: .PP .Vb 1 \& virt\-make\-fs \-\-partition=mbr \-\-type=vfat /any/tarball.tar.gz output.img .Ve .PP Add ‘output.img’ as a raw disk to an existing guest. Check the guest can see the files. This test is particularly useful if you try it with a Windows guest. .PP Try other partitioning schemes, eg. \fI\-\-partition=gpt\fR. .PP Try other filesystem formats, eg. \fI\-\-type=ntfs\fR, \fI\-\-type=ext2\fR. .SS "\fB*\fP Run virt-rescue on a \fBshut off\fP disk image or guest." .IX Subsection "* Run virt-rescue on a shut off disk image or guest." Use \fBvirt\-rescue\fR\|(1) to examine, rescue or repair a \fBshut off\fR guest or disk image: .PP .Vb 1 \& virt\-rescue \-a /path/to/disk.img .Ve .PP or: .PP .Vb 1 \& virt\-rescue \-d Guest .Ve .PP Can you use ordinary shell commands to examine the guest? .SS "\fB*\fP Resize your guests." .IX Subsection "* Resize your guests." Use \fBvirt\-resize\fR\|(1) to give a guest some more disk space. For example, if you have a disk image that is smaller than 30G, increase it to 30G by doing: .PP .Vb 4 \& truncate \-s 30G newdisk.img \& virt\-filesystems \-a /path/to/olddisk.img \-\-all \-\-long \-h \& virt\-resize /path/to/olddisk.img newdisk.img \-\-expand /dev/sda1 \& qemu\-kvm \-m 1024 \-hda newdisk.img .Ve .PP Does the guest still boot? Try expanding other partitions. .SS "\fB*\fP Sparsify a guest disk." .IX Subsection "* Sparsify a guest disk." Using \fBvirt\-sparsify\fR\|(1), make a disk image more sparse: .PP .Vb 1 \& virt\-sparsify /path/to/olddisk.img newdisk.img .Ve .PP Is \fInewdisk.img\fR still bootable after sparsifying? Is the resulting disk image smaller (use \f(CW\*(C`du\*(C'\fR to check)? .SS "Build and boot a guest" .IX Subsection "Build and boot a guest" Using \fBvirt\-builder\fR\|(1), choose a guest from the list: .PP .Vb 1 \& virt\-builder \-l .Ve .PP build it: .PP .Vb 1 \& virt\-builder \-o disk.img [os\-version from list above] .Ve .PP and boot it: .PP .Vb 1 \& qemu\-kvm \-cpu host \-m 2048 \-drive file=disk.img,format=raw .Ve .PP Does it boot? .ie n .SS "\fB*\fP ""Sysprep"" a \fBshut off\fP Linux guest." .el .SS "\fB*\fP ``Sysprep'' a \fBshut off\fP Linux guest." .IX Subsection "* Sysprep a shut off Linux guest." \&\fBNote\fR that this really will mess up an existing guest, so it's better to clone the guest before trying this. .PP .Vb 1 \& virt\-sysprep \-\-hostname newhost.example.com \-a /path/to/disk.img .Ve .PP Was the sysprep successful? After booting, what changes were made and were they successful? .SS "Dump the Windows Registry from your Windows guests." .IX Subsection "Dump the Windows Registry from your Windows guests." Use \fBvirt\-win\-reg\fR\|(1) to dump out the Windows Registry from any Windows guests that you have. .PP .Vb 2 \& virt\-win\-reg \-\-unsafe\-printable\-strings WindowsGuest \*(AqHKLM\eSoftware\*(Aq | \& less \& \& virt\-win\-reg \-\-unsafe\-printable\-strings WindowsGuest \*(AqHKLM\eSystem\*(Aq | \& less .Ve .PP Does the output match running \f(CW\*(C`regedit\*(C'\fR inside the guest? .PP A recent feature is the ability to dump user registries, so try this, replacing \fIusername\fR with the name of a local user in the guest: .PP .Vb 2 \& virt\-win\-reg \-\-unsafe\-printable\-strings WindowsGuest \*(AqHKEY_USERS\eusername\*(Aq | \& less .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBguestfs\fR\|(3), \&\fBguestfish\fR\|(1), \&\fBguestfs\-examples\fR\|(3), http://libguestfs.org/. .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones (\f(CW\*(C`rjones at redhat dot com\*(C'\fR) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2011\-2012 Red Hat Inc. .SH "LICENSE" .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This library is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 Lesser General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA 02110\-1301 USA\s0 .SH "BUGS" .IX Header "BUGS" To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools .PP To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP When reporting a bug, please supply: .IP "\(bu" 4 The version of libguestfs. .IP "\(bu" 4 Where you got libguestfs (eg. which Linux distro, compiled from source, etc) .IP "\(bu" 4 Describe the bug accurately and give a way to reproduce it. .IP "\(bu" 4 Run \fBlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR output into the bug report.