Commit Graph

9307 Commits

Author SHA1 Message Date
Richard W.M. Jones
7c52d86de9 virt tools: Use Sys.file_exists instead of clumsy open_in/close_in hack.
No functional change.

Fixes commit c466d4cb92.
2016-06-23 14:51:48 +01:00
Richard W.M. Jones
8f8a651e59 p2v: ssh: Improve consistency of error messages. 2016-06-23 14:28:44 +01:00
Richard W.M. Jones
323c3e20a4 p2v: Make the sudo error message actionable.
Updates commit 5b6a8e0862.
2016-06-23 13:52:46 +01:00
Richard W.M. Jones
9221ef6f79 v2v: Refuse to convert if < 1GB of free space in temporary directory (RHBZ#1316479).
The error you would see is:

  virt-v2v: error: insufficient free space in the conversion server temporary
  directory /var/tmp (853.8M).

  Either free up space in that directory, or set the LIBGUESTFS_CACHEDIR
  environment variable to point to another directory with more than 1GB of
  free space.

  See also the virt-v2v(1) manual, section "Minimum free space check in the
  host".

Also adds some documentation.

Thanks: Ming Xie and Xiaodai Wang
2016-06-23 13:45:22 +01:00
Richard W.M. Jones
d8a465a14c v2v: Rename check_free_space -> check_guest_free_space. 2016-06-23 13:28:49 +01:00
Richard W.M. Jones
a7fb3d601a v2v: Move calculation of overlay directory to common code.
There is a tiny functional change in this patch, since overlay_dir is
now always evaluated once (eg. even in --inplace mode), whereas
previously it was evaluated twice but only in copying mode.
2016-06-23 13:28:48 +01:00
Richard W.M. Jones
24130d7872 sparsify: Move statvfs wrapper function to mllib.
We wish to use this function in virt-v2v too, so move it to the common
directory.

No functional change.
2016-06-23 13:28:48 +01:00
Richard W.M. Jones
5e794b8607 p2v: Set LANG=C in the remote shell so we can match on error messages.
Since commit 5b6a8e0862 we are now
matching on error messages, and therefore we must set LANG=C.
2016-06-23 11:34:00 +01:00
Richard W.M. Jones
d41cf142e1 p2v: Force bash as the remote shell.
As described in the comment, this solves a number of problems with
non-standard remote configurations.

I tested this with:

 - tcsh
 - zsh
 - ksh

and all behaved correctly.
2016-06-23 11:33:44 +01:00
Pino Toscano
5b6a8e0862 p2v: improve error message for sudo with password
Print a better error message when the non-root user on the conversion
server requires a password to use sudo, and p2v is told to use sudo.

See also RHZ#1340809.
2016-06-23 11:07:18 +02:00
Richard W.M. Jones
32cc27bb61 generator: filesystem_walk APIs added in 1.33.39 (not .37).
Updates commit 3de8abac4a and
commit 19e7a52f8f.
2016-06-23 08:30:48 +01:00
Matteo Cafasso
19e7a52f8f New API: filesystem_walk
Library's counterpart of the daemon's internal_filesystem_walk command.

It writes the daemon's command output on a temporary file and parses it,
deserialising the XDR formatted tsk_dirent structs.

It returns to the caller the list of tsk_dirent structs generated by the
internal_filesystem_walk command.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
7d8fbde4b2 lib: Added filesystem_walk command tests
The tests check whether the filesystem_walk command is able to retrieve
information regarding both existing and deleted files.

A NTFS image is used as Ext3+ filesystems deletion is more aggressive
in terms of metadata removal.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
3de8abac4a New API: internal_filesystem_walk
- generator: Added tsk_dirent struct

The tsk_dirent struct contains the information gathered via TSK APIs.

The struct contains the following fields:
 * tsk_inode: inode of a file
 * tsk_type: type of file such as for dirwalk command
 * tsk_size: file size in bytes
 * tsk_name: path relative to its disk partition
 * tsk_flags: bitfield containing extra information
 * tsk_spare[1-5]: extra space for future usage

 - configure: Added libtsk compile-time check

Ensure libtsk is available at compile time.
If not, daemon routines depending on it won't be available.

 - API: internal_filesystem_walk

The internal_filesystem_walk command walks through the FS structures
of a disk partition and returns all the files or directories
which could be found.

The command is able to retrieve information regarding deleted
or unaccessible files where other commands such as stat or find
would fail.

The gathered list of tsk_dirent structs is serialised into XDR format
and written to a file by the appliance.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
90e623d4c7 Code cleanup in daemon/sleuthkit.c
Adhere to coding standards.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:41:19 +01:00
Matteo Cafasso
434f617bdd Improve download_inode documentation string.
The download_inode does not require the disk to be mounted
in order to work.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:40:55 +01:00
Richard W.M. Jones
0421c5afa3 v2v: Add a regression test for floppy assignment (RHBZ#1309706). 2016-06-22 18:25:36 +01:00
Richard W.M. Jones
b9613acb94 v2v: Fix conversion of floppy removable devices (RHBZ#1309706).
The previous code treated floppy disks and CD-ROMs as the same kind of
thing, resulting in malformed libvirt XML.  You would see the
following error when importing a guest into libvirt:

  error: Failed to define domain from /tmp/v2vlibvirt063486.xml
  error: internal error: Invalid floppy device name: hdb

because we incorrectly generated this bogus libvirt XML fragment:

  <disk device='floppy' type='file'>
    <driver name='qemu' type='raw'/>
    <target dev='hdb' bus='ide'/>
  </disk>

This commit models floppy devices as a distinct type, occupying their
own bus ("/dev/fdX").  When writing to libvirt, we generate correct
XML fragments, looking like this:

  <disk device='floppy' type='file'>
    <driver name='qemu' type='raw'/>
    <target dev='fda'/>
  </disk>

Miscellaneous other changes were required in the code.  There is also
a regression test (see following commit).

Note this ignores floppy disks in '-o qemu' mode.
2016-06-22 18:25:36 +01:00
Richard W.M. Jones
044de389e7 builder: Add Fedora 24 images for x86-64, i686, armv7l.
aarch64 image isn't buildable at the moment because of
Anaconda bug RHBZ#1348980.

ppc64 & ppc64le images are not buildable because of delays updating
the Fedora mirrors.
2016-06-22 18:25:36 +01:00
Richard W.M. Jones
94e1504146 v2v: OVF: Add <BootOrder/> to the first drive.
This adds <BootOrder>1</BootOrder> to the first drive, which is
necessary to make the drive bootable (or would be necessary, if oVirt
hadn't implemented their own workaround for the OVF we were previously
generating).

https://bugzilla.redhat.com/show_bug.cgi?id=1308535#c11

This is not a full solution to the problem.  Really we should be
copying the boot order over from the source hypervisor, but that
requires extensions to libvirt as discussed here:

https://bugzilla.redhat.com/show_bug.cgi?id=1308535#c7

Thanks: Shmuel Melamud
2016-06-22 15:46:56 +01:00
Maxim Perevedentsev
6521be3aa7 ext: change e2fsck retcode processing during resize
e2fsck returns 1 in case of "file system errors corrected".
We treat it as success in normal e2fsck, but fail if e2fsck
is run by resize2fs.

Change 'manual' execution of e2fsck to dedicated function call.
2016-06-22 15:18:19 +01:00
Cédric Bosdonnat
62d23aa4f9 p2v: use yast2 lan on SUSE distros rather than NM
NetworkManager isn't provided on SLES. As yast2 lan is available on all
openSUSE / SLE distro, use it instead.
2016-06-22 13:26:13 +01:00
Richard W.M. Jones
e4e197bb86 builder: Use newly open sourced edk2 from Fedora, replacing kraxel's builds. 2016-06-22 12:47:20 +01:00
Richard W.M. Jones
27b3b2cf7d builder: Use a different mirror when building armv7l image. 2016-06-22 12:41:57 +01:00
Cédric Bosdonnat
f51c0bc837 p2v: add -x option to nm-online
On distros not running NetworkManager, use the nm-online -x parameter
to exit quickly. The network connection will be checked just after
anyway when attempting to connect to the conversion server using ssh.
2016-06-22 11:03:38 +01:00
Cédric Bosdonnat
9c0f547b02 p2v: add virt-p2v-make-kiwi to generate kiwi config
Kiwi is the tool used by openSUSE / SLES to generate many sort of
disk images. Add a virt-p2v-make-kiwi tool and his documentation to
geneate the p2v appliance kiwi configuration.
2016-06-22 11:02:44 +01:00
Cédric Bosdonnat
9507c79945 p2v: fix dependencies for SLES / openSUSE
Use the common denominator for SLES and openSUSE in the dependencies.
For example most of NetworkManager pieces and metacity aren't provided
on SLES.

ifconfig is in the net-tools-deprecated package in openSUSE Factory,
which means after openSUSE Leap 42.2. Older versions have it in the
net-tools package. Adding this complexity only to add ifconfig because
sysadmins prefer it isn't too good:  iproute2 is doing the job.
2016-06-22 10:58:45 +01:00
Richard W.M. Jones
10cbf35cbd p2v: Use a more specific password prompt regexp.
The password prompt is actually generated by the openssh client which
is under our control, so we can regexp match on the specific prompt
printed by openssh.  This also avoids mistaking any server-side
issue.net message for a password prompt (eg. if the server prints a
message like "all users must change their passwords today!")  which
would have prevented virt-p2v from logging in.
2016-06-22 10:53:37 +01:00
Richard W.M. Jones
c44ff0b789 p2v: Improve the error message when login fails (RHBZ#1348900).
This can fail because the username is wrong.  Also don't unnecessarily
reveal irrelevant implementation details in the error message, just
say the login failed.

Thanks: Juquin Zhou
2016-06-22 10:53:27 +01:00
Richard W.M. Jones
572b416468 Revert "aarch64: launch: libvirt: As a workaround, pass -cpu parameter to qemu."
Since libvirt bug https://bugzilla.redhat.com/1184411 is now fixed, we
don't need this workaround any longer.

This reverts commit 7e4b7a346a.
2016-06-21 14:20:20 +01:00
Richard W.M. Jones
c87eab35c0 p2v: Gtk 3 workaround for RHEL 7.
New enough to complain about gtk_widget_modify_font, not new enough to
have gtk_style_context.

Fixes commit ca6fea7616.
2016-06-21 14:11:57 +01:00
Richard W.M. Jones
b5725ef856 docs: internals: Fix cross-references to guestfs(3) man page. 2016-06-20 15:11:46 +01:00
Richard W.M. Jones
6da4941db7 p2v: Poll to make Cancel Conversion button more responsive.
Previously cancelling the conversion only set a flag, which was
checked when the run dialog displayed new output from virt-v2v.  When
virt-v2v was showing hundreds of debugging messages, this wasn't a
problem, but now that we are hiding those messages, cancelling the
conversion might mean a wait of seconds or minutes.

By polling (albeit infrequently) we can make the cancel button more
responsive.
2016-06-20 15:11:46 +01:00
Richard W.M. Jones
55a0ab845d p2v: Don't display libvirt XML and wrapper script on stderr.
Confusing for end users, and not necessary for debugging since those
files are saved on the conversion server.
2016-06-20 15:11:46 +01:00
Richard W.M. Jones
6f5abc9539 p2v: Display up to 50 lines of the virt-v2v conversion log on failure.
For some failures, 30 lines was not sufficient and only part of the
error was shown.  Increase the number of lines shown to 50.

This also colourizes the failure message, and prominently displays the
location of the full log.  The following message is now shown:

  *** virt-v2v command failed ***

  The full log is available on the conversion server in:
      /tmp/virt-p2v-20160620-sga9rhk7/virt-v2v-conversion-log.txt
  Only the last 50 lines are shown below.

  [followed by up to 50 lines of log]

Updates and fixes commit 7447fe2478.
2016-06-20 15:11:46 +01:00
Pino Toscano
44483e7eb3 inspect: recognize older PLD Linux versions
PLD Linux got /etc/os-release only in the recent 3.0 release; since
older versions have only /etc/pld-release, check for it to identify
the guest and get its version.
2016-06-20 14:22:16 +02:00
Richard W.M. Jones
6db1043342 Version 1.33.38. v1.33.38 2016-06-18 22:40:55 +01:00
Richard W.M. Jones
257f2cc6b4 p2v: Use absolute path in test.
Fixed because of change in commit 7447fe2478.
2016-06-18 21:47:21 +01:00
Richard W.M. Jones
ca6fea7616 p2v: Use a monospace font for the run dialog. 2016-06-18 21:16:54 +01:00
Richard W.M. Jones
7301c51da3 p2v: Add DejaVu Sans and Monospace fonts to the ISO.
Improves the general look of virt-p2v.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
7447fe2478 p2v: Don't display debugging messages in the run dialog.
Previously we displayed the complete output of virt-v2v in the run
dialog.  This output included all the debugging messages, and was very
long and confusing for users (especially we had false bug reports
about "errors" appearing in the debug output).

Only display stdout in the run dialog.  However make sure everything
(stdout and stderr) is still logged to the conversion log.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
514893b68b p2v: Use a wrapper script instead of long virt-v2v command lne.
Instead of constructing and directly executing a long virt-v2v command
line, build a wrapper script with the same command line and send it to
the remote server (stored in /<remote_dir>/virt-v2v-wrapper.sh).

This will make it a bit easier to construct more complex virt-v2v
wrappers.

Note this commit on its own is a simple refactoring and does not
change any functionality.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
5e8f820494 p2v: Use virt-v2v --colours option, support colour in the run dialog (RHBZ#1314244). 2016-06-18 21:16:52 +01:00
Richard W.M. Jones
b000d6bc68 virt tools: Add common --colours option.
This option (alternately spelled: --color, --colour, --colors, or
--colours) enables ANSI colour sequences output even if that would be
disabled becaues the output is not a TTY.
2016-06-18 21:15:59 +01:00
Richard W.M. Jones
5b131356e2 virt tools: Warnings are not errors, send them to stdout. 2016-06-18 21:15:59 +01:00
Richard W.M. Jones
bda1224b2b p2v: Fix size of run dialog window in Gtk 3.
Setting the size on the surrounding scrolled window works better.
2016-06-18 21:15:57 +01:00
Richard W.M. Jones
377bd8f921 p2v: Fix the rule for rebuilding windows.img.
Fixes commit 53ec66c7e2.
2016-06-18 19:56:38 +01:00
Richard W.M. Jones
fc292631da v2v: Be careful to send all debug messages to stderr.
The debug() function is already sending these to stderr, but in a few
places we were using printf.  Change those to eprintf, except for one
informational message which should have been using info().
2016-06-18 14:46:43 +01:00
Richard W.M. Jones
c5f12e47e4 p2v: Fix slow test so it runs our locally built virt-v2v.
The virt-p2v slow test tested the local virt-p2v.  However it ran
against the installed virt-v2v (and in fact would have failed if
virt-v2v was not installed).

This commit sets the environment up to run the locally built virt-v2v.

This is unfortunately quite a lot more complex than it should be.
There is no simple "set this environment variable" option in
sshd_config.
2016-06-18 11:47:13 +01:00
Richard W.M. Jones
87addfb440 p2v: test-virt-p2v-pxe.sshd_config is generated by awk, not configure. 2016-06-18 11:47:13 +01:00