Commit Graph

8917 Commits

Author SHA1 Message Date
Pino Toscano
d2e81b42e7 inspect: use os-release for CoreOS
Look for /lib/os-release in the /usr partition and try to use it, if
present, before using lsb-release later on.  This should not change the
final result of the inspection, while using the os-release detection
method also for CoreOS.

Update the phony CoreOS image to use os-release instead, uploading the
version found in the current stable version.
2016-03-31 11:38:00 +02:00
Matteo Cafasso
5fd0819ebc Rename icat command in download_inode
The "icat" name comes from the employed command line tool which might be
replaced at any time with a different implementation.

The command name is a bit confusing because it's similar to "cat" but
act as "download".

download_inode is more clear and descriptive.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-31 10:50:42 +02:00
Pino Toscano
ca4516d94c inspect: os-release: fix single-number version parsing (RHBZ#1321620)
Use the proper length modifier for asprintf, instead of a padding
modifier.  This fixes the parsing of versions in VERSION_ID which are a
single number (i.e. "X" and not "X.Y", etc).

Bug introduced with commit 32d19e3289, but
uncovered recently with the switch away from VLAs, i.e.
commit 07c496c53c.
2016-03-30 15:49:16 +02:00
Matteo Cafasso
88d5186eb4 renamed daemon/tsk.c to daemon/sleuthkit.c
In order to support the new features I am renaming the file with a better name.

The file sleuthkit.c will contain the code depending on the sleuthkit package.

The original tsk.c file will contain the logic built using libtsk
which is the sleuthkit core library.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-30 13:02:30 +02:00
Richard W.M. Jones
c67bab9c5d builder: Update Fedora 23 image.
Contains a fix for RHBZ#1317843 and another dnf bug.
2016-03-30 11:25:00 +01:00
Pino Toscano
807433bc23 appliance: init: generate /etc/machine-id
Some of the systemd-tmpfiles snippets need the machine ID of the running
system; the current lack of this file produces warning messages during
the appliance boot like:

[/usr/lib/tmpfiles.d/systemd.conf:26] Failed to replace specifiers: /run/log/journal/%m
[/usr/lib/tmpfiles.d/systemd.conf:28] Failed to replace specifiers: /run/log/journal/%m
[/usr/lib/tmpfiles.d/systemd.conf:29] Failed to replace specifiers: /run/log/journal/%m

Thus create a new randomly-generated /etc/machine-id on boot.
2016-03-30 10:15:49 +02:00
Richard W.M. Jones
da7e22b648 boot-analysis: Add --memsize, --smp and --append options.
These options allow you to control the appliance memory size, number
of vCPUs, and extra kernel options respectively.

Note that using --smp is not usually a good idea.  Not only does it
slow down the appliance, but it tends to break the boot analysis
program because it makes runs (more) non-deterministic.
2016-03-29 12:01:42 +01:00
Richard W.M. Jones
de66981917 v2v: Don't use List.sort_uniq, add util function for this instead (RHBZ#1321338).
List.sort_uniq was added in OCaml 4.02, so this breaks compilation on
earlier versions of OCaml.

Thanks: Jean-Christophe Manciot
2016-03-25 17:13:58 +00:00
Richard W.M. Jones
f756002b54 builder: Add ubuntu ppc64le script.
Thanks: Gustavo Romero
2016-03-24 20:19:19 +00:00
Lars Kellogg-Stedman
c6512ead45 document behavior of --selinux-relabel
the description of the --selinux-relabel option suggests that it
perform an immediate relabel, when in fact it may (and probably will)
instead simply touch /.autorelabel on the image, which schedules a
relabel operation for the next time the image boots.  This can be
surprising because it results both in an extended initial boot time
*and* results in an automatic reboot (on some distributions).
2016-03-24 20:19:09 +00:00
Richard W.M. Jones
6cdd20716c Version 1.33.16. 1.33.16 2016-03-24 18:51:36 +00:00
Richard W.M. Jones
c3fb5deab6 rescue: Fix test to deal with new --suggest output.
Fixed commit 72fd0531ab.
2016-03-24 18:51:36 +00:00
Richard W.M. Jones
aae74c9e4e python: Add README documenting how to run a single test. 2016-03-24 14:46:42 +00:00
Richard W.M. Jones
a5507a16c6 rescue: Print chroot suggestion for Linux guests. 2016-03-24 13:56:29 +00:00
Richard W.M. Jones
72fd0531ab rescue: Suggest using recursive bind mounts.
Since /dev and other directories contain sub-mounts, suggest using
--rbind instead of --bind.  This also allows us to remove the /dev/pts
line.
2016-03-24 13:56:29 +00:00
Richard W.M. Jones
0024e5a13e python: Misspelling in tests, libirt -> libvirt. 2016-03-24 13:56:29 +00:00
Roman Kagan
db982654d1 v2v: better explain --in-place
It seems that the documentation for --in-place mode of v2v wasn't clear
enough, so try to explain it better.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 16:43:29 +03:00
Roman Kagan
fb73d8261d v2v: in-place: request caps based on source config
In in-place mode, the decisions on which interfaces to use are made and
the source VM configuration is created by the outside entity.  So in
that case v2v needs to look it up in the source configuraion, and try to
follow.

For that, the source VM configuration is used to populate requested caps
object which is then passed to the convert routine.

It's assumed that the configuration has exactly one type of storage
devices and no more than one type of network and video adapters;
anything else is rejected.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
ee02191483 v2v: take requested caps into account when converting
Give the caller certain control over what kind of interface to use for
virtual disks, network and video cards upon conversion.

For that, make convert functions accept additional rcaps parameter
containing an object with optional capabilities similar to the ones
produced on output, with None indicating that the decision is left to
the convert function itself.

To facilicate review, this patch unconditionally passes rcaps with no
preferences; populating it with more sensible values is done in a
followup patch.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
94c83c0165 v2v: introduce requested guestcaps type
Introduce a type to contain the guestcaps that are to be put in effect
in the converted VM: options of the block type, net type, and video.

It'll be populated by the caller and passed into convert function to
affect its choice of devices and drivers.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
ad5bb4f6bd v2v: collect source network and video adapter types
Those will be useful when making decisions about what configuration to
set on output.

The data is also included in --print-source so the tests are adjusted
accordingly.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Richard W.M. Jones
0ba59db611 tests/qemu: Add program for tracing and analyzing boot times. 2016-03-23 13:25:46 +00:00
Richard W.M. Jones
cd57851019 conn: Pretend to be a serial terminal, so sgabios doesn't hang.
This tedious workaround avoids a 0.26 second pause when using sgabios
(the Serial Graphics Adapter).  It's basically a workaround for buggy
code in sgabios, but much easier than fixing the assembler.
2016-03-23 13:25:46 +00:00
Richard W.M. Jones
f36ba38886 appliance: init: Don't run hwclock command.
This command alone took 0.3 seconds which is about 10% of the current
launch time.  It appears to be unnecessary.

This reverts commit 508f1ee87e.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
705b721b42 appliance: init: Mount selinuxfs along with other special filesystems.
Move this earlier.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
cb8f69e959 appliance: init: Move cmdline parsing earlier.
Since commit bb5d30ab2a, we don't
require any external programs like grep to parse the command line.  We
only use bash intrinsics.

Therefore we can do it early (but after /proc is mounted).

This allows verbose mode to enable set -x early on, so we can trace
most things that the init script does.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
d368fa0895 appliance: When using verbose mode, 'set -x' in the appliance init script. 2016-03-23 12:58:15 +00:00
Richard W.M. Jones
9423c16607 launch: Add a virtio-rng device to the guest. 2016-03-23 12:58:15 +00:00
Richard W.M. Jones
e94e61f76f launch: Remove guestfs_int_print_timestamped_message function.
This function was kind of like debug(), except that it didn't check
the g->verbose flag and it only worked in the library (it would crash
if used after fork).

It also wasn't very useful.  The sort of boot analysis done by
[forthcoming program] tests/qemu/boot-analysis.c means that
timestamping (some) messages is even less interesting than before.

Remove it and replace calls with debug() instead.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b7b3411976 launch: direct: Don't run qemu -version.
Dr. David Gilbert pointed out to me that the first line of the
qemu -help output includes the qemu version, so we don't need
to run qemu -version at all.

This saves about 0.04s on the launch time when using the direct
backend.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b3e843e5b4 launch: Factor out earlyprintk from the command line.
Just code motion.

In theory we could also add earlyprintk=ttyS0,115200 on x86, but I
cannot get it to work.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b652cc419d launch: direct: Remove dead code promising we were going to use virtio-console.
We're never going to use virtio-console since, although it is faster,
it's not available during early boot, and that is more important for
debugging.
2016-03-23 12:57:55 +00:00
Pino Toscano
bb5d30ab2a appliance: use bash features for string matching in files
Read the content of /proc/cmdline using bash features, and use its
[[ ... ]] expression to find texts in a variable.

This shaves off 5 grep invocations.
2016-03-22 22:30:59 +00:00
Pino Toscano
e2457d0773 Reduce GUESTFS_PRIVATE usage
Remove the GUESTFS_PRIVATE=1 define for some tools and tests which don't
really use any private API.
2016-03-22 22:30:59 +00:00
Pino Toscano
40017ba7f3 build: improve GUESTFS_FIND_DB_TOOL macro
- find the unversioned name just once
- add 5.3 and 5.2 as versions
- add db_$TOOL-X and db_$TOOL-X.Y as patterns (found on FreeBSD)
2016-03-22 09:45:41 +01:00
Pino Toscano
5f24d45ab5 build: check the path of true, and use it in tests
Check for the full path of true, and use it instead of hardcoding
/bin/true (which is still left as fallback).
2016-03-22 09:45:41 +01:00
Pino Toscano
76a01fe41d php: pass $(MAKE) to run-php-tests.sh
Instead of hardcoding "make" in run-php-tests.sh, pass the actual name
of make from the Makefile; the default is still "make", mostly to use
the script without having to set $MAKE.
2016-03-22 09:45:41 +01:00
Pino Toscano
39772344ad v2v: tests: use guestfs-hashsums.sh for MD5
Use the common helper for MD5 checksum, instead of assuming md5sum(1).
2016-03-22 09:45:41 +01:00
Pino Toscano
8aee5726d3 v2v: tests: isolate SHA1 calculation in an own shared function
sha1sum(1) does not exist everywhere, so wrap it in an own function so
the right implementation can be chosen on each OS.  Also, wrapping it
avoid using awk everytime.
2016-03-22 09:45:41 +01:00
Pino Toscano
41795a1c98 tests: move guestfs-md5.sh to test-data
Move it to the test-data directory, giving it a more generic name so it
can be used also for more than just md5; adjust qemu tests accordingly.

This is just code motion, no behaviour change.
2016-03-22 09:45:41 +01:00
Pino Toscano
7e970fcdb3 build: check the path of fuser, and use it in FUSE code
Check for the full path of fuser, and use it instead of hardcoding
/sbin/fuser (which is still left as fallback).
2016-03-22 09:45:41 +01:00
Richard W.M. Jones
5897b3bbad appliance: Quiet some warnings about missing files.
Try to make the appliance script as quiet as possible along
the fast path.
2016-03-18 13:18:13 +00:00
Richard W.M. Jones
23028cb30d appliance: Make it clear that the init script is a bash script.
We have used /bin/sh here since 2009.  However this is a bash
script and probably won't work well with other shells.
2016-03-18 13:18:13 +00:00
Richard W.M. Jones
ed739e71f6 appliance: Pass "quiet" option to kernel when !verbose.
The quiet option suppresses kernel messages.  On my laptop it improves
appliance boot times by about 40% (3.5s -> 2.5s).

The emulated UART is slow and has a fixed, small FIFO (16 bytes).  But
it has the advantage of being a simple ISA device which is available
very early in boot, thus enabling us to diagnose early boot problems.
So the aim is to reduce our usage of this UART on fast paths.

Of course when we are in verbose mode, we should not add this flag
because we want to see all the messages.

This change is not entirely invisible:

(1) Progress messages use the "Linux version ..." string from kernel
output in order to determine part of where we are in the boot process.
This string will no longer be detected.  We should probably use a BIOS
message or maybe drop this altogether.  I have added a comment to the
code.

(2) It is possible for programs to be listening for
GUESTFS_EVENT_APPLIANCE events, and they will see fewer messages now
(although what kernel messages programs see is never defined).
2016-03-18 13:18:13 +00:00
Pino Toscano
1df34fd8d1 inspect: improve UsrMove detection (RHBZ#1186935)
In case /usr is a symlink to /usr/bin, then we cannot rely on /usr/bin
to exist, since /usr might be in a different partition.  Thus, in case
/bin is a symlink, check it points to "usr/bin".
2016-03-17 15:28:18 +01:00
Pino Toscano
b0be4c1130 inspector: define more multichoice tags in the RELAX NG schema
Provide new <define> for the following elements: "distro",
"package_format", "package_management", and "format", adding all the
values so far possible for each.
2016-03-17 15:28:18 +01:00
Pino Toscano
9775777a55 builder: fedora: ensure images are up-to-date
Update the system at the end of the installation, so the generated image
is up-to-date.  This also removes the need to manually update dnf on
i686 and x86_64.
2016-03-17 10:39:11 +01:00
Richard W.M. Jones
a5bf0e7e64 Version 1.33.15. 1.33.15 2016-03-16 15:17:12 +00:00
Richard W.M. Jones
180b853658 fish: Link with LIBTINFO_LIBS.
Required on Gentoo.

Thanks: Mark Pictor
2016-03-16 15:16:39 +00:00
Richard W.M. Jones
1129cbba3d docs: Fix cross-reference to fixed appliance section.
The fixed appliance documentation moved from guestfs(3) to
guestfs-internals(1).

Thanks: Mark Pictor (mark999 on IRC)
2016-03-15 19:13:59 +00:00