Commit Graph

8960 Commits

Author SHA1 Message Date
Richard W.M. Jones
dd85d4f06d docs: Add list of C source files instead of calculating it using 'find'.
Add the real list of C source files to the Makefile, instead of trying
to calculate it.  This (will, in the next commit) fix a problem with
the build on Koji where we created a subdirectory (for python3/) but
the find command picked up files from that directory for the
documentation (and then failed).

This fixes commit 04229c68d6.
2016-04-12 20:19:58 +01:00
Richard W.M. Jones
d13f438850 docs: Ignore gnulib files when producing internal documentation.
This fixes commit 04229c68d6.
2016-04-12 15:20:18 +01:00
Richard W.M. Jones
557b6ce35c Version 1.33.19. 1.33.19 2016-04-12 13:52:55 +01:00
Richard W.M. Jones
04229c68d6 Add internal documentation to C files.
As in libvirt, allow internal documentation comments in C files.
These are marked using '/**' comments.  Unlike libvirt which has an
ill-defined and inconsistent markup, the markup we use is Perl POD.

These comments are added to guestfs-internals(1), but are most likely
to be read in-place.

This commit changes some existing comments in src/launch.c to
demonstrate how this can be used.
2016-04-12 13:22:00 +01:00
Roman Kagan
e07459d994 v2v: win: factor out common bits in registry patching
Refactor registry patching to share common parts between Win <= 7 and
Win >= 8.  Also branch between the two based on the presence of the
DriverDatabase subtree rather than on the OS version, which allows not
to pass the inspect handle into the functions.

OTOH make the patching functions accept the driver name and device PCI
id as arguments; this will allow to easily expand the code to support
other drivers (e.g. vioscsi) later on.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-04-12 14:14:48 +03:00
Roman Kagan
9a441b0317 v2v: win >= 8: simplify registry patching
It turned out (by trial and error) that for Windows >= 8 / 2012, even
though the PnP system uses names related to the original driver's .inf
file for certain entries under DriverDatabase registry subtree, this
doesn't have to hold for the storage driver to make it boot.

So use our own artificial names there and simplify the surrounding code.
This will also make sure the added entries don't confilct with those
generated by PnP proper once the driver is installed, and that the
entries are easy to look up in the eventual registry.

The name chosen to refer to the driver -- "guestor" -- is intentionally
different from the original "viostor" both to avoid collisions and to
naturally expand to other relevant drivers (e.g. "vioscsi") later on.

Tested on

Win 8 x32
Win 8 x64
Win 8.1 x32
Win 8.1 x64
Win 2012R2 x64
Win 10 x64

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-04-12 14:14:48 +03:00
Roman Kagan
f0dce2452c v2v: win >= 8: reduce registry patch
The patch to the Windows registry allowing it to boot off a virtio-blk
drive was initially conceived by comparing the state with virtio-blk
driver properly installed, to that without.

However, we don't want to replicate the Windows PnP system; rather we
need to apply just enough edits to make the system boot, and then let
the Windows PnP manager figure out the rest.

It turned out (by trial and error) that for Windows >= 8 / 2012 the
"just enough" set includes only the service entry for the driver, and a
few entries under DriverDatabase.

Tested on

Win 8 x32
Win 8 x64
Win 8.1 x32
Win 8.1 x64
Win 2012R2 x64
Win 10 x64

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-04-12 14:14:48 +03:00
Roman Kagan
1f24364367 v2v: win <= 7: reduce registry patch
The patch to the Windows registry allowing it to boot off a virtio-blk
drive was initially conceived by comparing the state with virtio-blk
driver properly installed, to that without.

However, we don't want to replicate the Windows PnP system; rather we
need to apply just enough edits to make the system boot, and then let
the Windows PnP manager figure out the rest.

It turned out that for Windows <= 7 / 2008R2 the "just enough" set
includes only the service entry for the driver, and a
CriticalDeviceDatabase entry matching the PCI id of the device and
pointing at that service entry.

While at this, also drop CriticalDeviceDatabase entries for older and
no longer relevant PCI ids of the virtio-blk device.

Tested on

Win XP SP3 x32
Win XP SP2 x64
Win 2003R2 SP2 x32
Win 2003R2 SP2 x63
Win Vista SP2 x32
Win Vista SP2 x64
Win 2008 SP2 x32
Win 2008R2 SP1 x64
Win 7 SP1 x32
Win 7 SP1 x64

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-04-12 14:14:48 +03:00
Richard W.M. Jones
80a13b7216 customize/perl_edit-c.c: Don't use internal APIs.
We can now use the Guestfs.c_pointer method to access the underlying
guestfs_h *.  So no need to use internal APIs for this.
2016-04-12 10:37:12 +01:00
Richard W.M. Jones
fc4936661d v2v: Don't allow -oa option to be specified more than once on the command line. 2016-04-12 10:37:12 +01:00
Richard W.M. Jones
7bc0ea7d24 v2v: Reject duplicate -b/-n parameters on the command line (RHBZ#1325825). 2016-04-12 10:37:12 +01:00
Pino Toscano
57467ca88b php: support PHP 7
Adapt to the API changes in the newer versions of the Zend framework, in
particular regarding:
- strings handling
- resources handling (used for the guestfs_h pointer)
- iterating in hash maps
- data types for function arguments

Introduce helper macros to reduce greatly the amount of #if's all around
the generated C code.
2016-04-12 10:35:20 +02:00
Pino Toscano
4a337cd33b fish: improve formatting of help text of generated commands
In the generated description of the guestfish commands, wrap and indent
the help text, so it is a multiline string instead of a very long single
one.

This has no behaviour changes, only makes cmds.c more readable (and
easier to diff when the description of actions change).
2016-04-11 17:06:50 +02:00
Richard W.M. Jones
ea175fb244 ruby: Document that rubygem-rdoc is required for the Ruby bindings. 2016-04-09 21:18:54 +01:00
Richard W.M. Jones
ea300d8ffe docs: Refresh documentation for the ./run script. 2016-04-09 21:18:54 +01:00
Richard W.M. Jones
eb364b15eb build: ./run is documented in guestfs-building(1), not README. 2016-04-09 21:11:14 +01:00
Richard W.M. Jones
f24753ebb0 tests/qemu: boot-analysis: (Don't) set LIBVIRT_LOG_FILTERS.
Setting LIBVIRT_LOG_FILTERS is supposed to be better than setting
LIBVIRT_DEBUG, but I couldn't get it to work.

This updates commit b332d91bc9.
2016-04-06 17:49:38 +01:00
Richard W.M. Jones
b332d91bc9 tests/qemu: boot-analysis: Add support for logging libvirt events. 2016-04-06 13:06:23 +01:00
Richard W.M. Jones
0008d794cf tests/qemu: Don't leak backend variable in boot-analysis/boot-benchmark programs. 2016-04-06 10:42:21 +01:00
Richard W.M. Jones
171c84788e v2v: DOM: Add documentation for the obscure 'e' function.
No functional change, just comment.
2016-04-05 21:32:08 +01:00
Richard W.M. Jones
1dd3da54f1 v2v: Add documentation to Convert_windows and Convert_linux modules.
No functional change, just add comments / documentation.
2016-04-05 21:20:26 +01:00
Richard W.M. Jones
c8cf4dc0a1 Version 1.33.18. 1.33.18 2016-04-05 15:15:21 +01:00
Richard W.M. Jones
b2c845333f launch: libvirt: Disable virtio-rng in libvirt backend until we can use /dev/urandom.
This updates commit 9423c16607.
2016-04-05 15:02:20 +01:00
Cédric Bosdonnat
dc94de5bee v2v: extract controller offset discovery as a function
This function is needed for other drivers, move the code in order to
help sharing it later.
2016-04-05 13:22:46 +01:00
Richard W.M. Jones
19dc728c48 Version 1.33.17. 1.33.17 2016-04-05 12:09:22 +01:00
Richard W.M. Jones
91c7273899 builder: Add ubuntu-ppc64le.sh to EXTRA_DIST.
Fixes commit f756002b54.
2016-04-05 12:07:13 +01:00
Richard W.M. Jones
1ecd0b0058 Add python/t/README to EXTRA_DIST.
Fixes commit aae74c9e4e.
2016-04-05 12:06:23 +01:00
Richard W.M. Jones
a04b04c5c1 Remove .x-sc (syntax check) files from EXTRA_DIST.
Fixes commit 821db657d1.
Updates commit 017f1c6729.
2016-04-05 11:58:35 +01:00
Richard W.M. Jones
c48e04d9d2 align/scan: Remove stray comment that confuses clang-format. 2016-04-04 17:57:38 +01:00
Richard W.M. Jones
821db657d1 Further remove mention of 'make syntax-check'.
Updates commit 017f1c6729.
2016-04-04 17:57:38 +01:00
Richard W.M. Jones
fdfedcb4ef Use 'error' function for fprintf followed by exit.
Like with the previous commit, this replaces instances of:

  if (something_bad) {
    fprintf (stderr, "%s: error message\n", guestfs_int_program_name);
    exit (EXIT_FAILURE);
  }

with:

  if (something_bad)
    error (EXIT_FAILURE, 0, "error message");

(except in a few cases were errno was incorrectly being ignored, in
which case I have fixed that).

It's slightly more complex than the previous commit because we must be
careful to:

 - Remove the program name (since error(3) prints it).

 - Remove any trailing \n character from the message.

Candidates for replacement were found using:

  pcregrep --buffer-size 10M -M '\bfprintf\b.*\n.*\bexit\b' `git ls-files`
2016-04-04 17:57:38 +01:00
Richard W.M. Jones
129e4938ba Use 'error' function consistently throughout.
Wherever we had code which did:

  if (something_bad) {
    perror (...);
    exit (EXIT_FAILURE);
  }

replace this with use of the error(3) function:

  if (something_bad)
    error (EXIT_FAILURE, errno, ...);

The error(3) function is supplied by glibc, or by gnulib on platforms
which don't have it, and is much more flexible than perror(3).  Since
we already use error(3), there seems to be no downside to mandating it
everywhere.

Note there is one nasty catch with error(3): error (EXIT_SUCCESS, ...)
does *not* exit!  This is also the reason why error(3) cannot be
marked as __attribute__((noreturn)).

Because the examples can't use gnulib, I did not change them.

To search for multiline patterns of the above form, pcregrep -M turns
out to be very useful:

  pcregrep --buffer-size 10M -M '\bperror\b.*\n.*\bexit\b' `git ls-files`
2016-04-04 13:14:26 +01:00
Richard W.M. Jones
03b68d436c tests/qemu: boot-analysis: Don't force backend direct.
Current libvirt overhead is 220ms.  That didn't matter when our launch
time was 4000ms.  Now we're launching in 900ms, it really does.
2016-04-02 11:59:39 +01:00
Richard W.M. Jones
014b7c0ced tests/qemu: Standardize test info printed by boot-* tests.
It now looks like:

test version: libguestfs 1.33.16
 test passes: 5
host version: Linux moo 4.4.4-301.fc23.x86_64 #1 SMP Fri Mar 4 17:42:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
    host CPU: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
     backend: direct
        qemu: /home/rjones/d/qemu/x86_64-softmmu/qemu-system-x86_64
qemu version: QEMU emulator version 2.5.90, Copyright (c) 2003-2008 Fabrice Bellard
         smp: 1
     memsize: 500
      append: guestfs_boot_analysis=1 ignore_loglevel initcall_debug
2016-04-02 11:01:30 +01:00
Richard W.M. Jones
d470480b35 tests/qemu: boot-analysis: Display all times in ms.
It was confusing to have a mix of seconds and milliseconds.  For all
upstream testing (eg. with SeaBIOS) we are discussing everything in
milliseconds, so use those exclusively.
2016-04-02 10:42:12 +01:00
Richard W.M. Jones
96ce2f9afe tests/qemu: Add boot-benchmark.
Add a new test program called 'boot-benchmark'.  This is similar to
'boot-analysis' but it simply boots and shuts down the appliance
several times in a row and measures how long it takes, calculating
mean and standard deviation.
2016-04-01 19:22:56 +01:00
Richard W.M. Jones
2e04be377a docs: Link to boot-analysis program from guestfs-performance(1). 2016-04-01 17:47:19 +01:00
Matteo Cafasso
7ecec1ee55 python: Fix bug in code generator
When a struct containing FChar fields is defined
in generator/structs.ml, the Python code generator will generate
code referencing a dirent struct instead of the correct one
thus breaking at compile time.

This bug was left unnoticed because the dirent struct is the only
one using FChar fields. Yet it prevents any other struct
from using such fields.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-04-01 17:14:53 +01:00
Richard W.M. Jones
2cc8a4c1ff launch: Add a comment about why acpi=off (because it's slow). 2016-04-01 12:28:18 +01:00
Richard W.M. Jones
6c99a17dc5 launch: Only use sgabios when verbose is enabled.
The sgabios option ROM is slow.  Only use it when we're debugging.

Thanks: Paolo Bonzini.
2016-04-01 10:10:04 +01:00
Richard W.M. Jones
77e1ac5a97 launch: direct: Add a comment about use of -display none.
No functional change.
2016-04-01 10:09:42 +01:00
Richard W.M. Jones
68fc25e1d5 v2v: Document how to use 'cinder manage' for importing directly to Cinder.
Thanks: Tom Barron.
2016-03-31 14:03:56 +01:00
Richard W.M. Jones
b2f42a8dce builder: Update Fedora 23 (i686) image.
Contains a fix for RHBZ#1317843 and another dnf bug.
2016-03-31 13:43:55 +01:00
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