Commit Graph

8999 Commits

Author SHA1 Message Date
Richard W.M. Jones
b23e149774 podwrapper: Send errors to stderr and die if any errors seen.
Enable a few POD options:

 - Don't generate an errata section in the output.

 - Send errors and warnings to stderr.

 - Die if any errors or warnings are seen while generating the outputs.
2016-04-22 09:09:10 +01:00
Richard W.M. Jones
71a4ffdd05 builder: Add Ubuntu 16.04 (Xenial) image. 2016-04-21 13:41:52 +01:00
Richard W.M. Jones
d585aca1d5 builder: ubuntu: Lock the 'builder' account that we have to add to the template. 2016-04-21 13:41:00 +01:00
Richard W.M. Jones
f56a46d0b5 builder: ubuntu: Fix URL of archive.ubuntu.com.
The archive.ubuntu.net address appears to work only intermittently.
2016-04-21 13:40:37 +01:00
Richard W.M. Jones
a1e47c4b47 tools: Reduce use of _ (wildcard) in match statements.
No functional change, just various improvements to the safety of match
statements.
2016-04-21 12:50:58 +01:00
Richard W.M. Jones
234c4091b5 sparsify: Refactor handling of checks of copying mode / --in-place.
Just refactoring, no change.
2016-04-21 12:40:18 +01:00
Richard W.M. Jones
906e2e0a96 dib: Rewrite match statement as ordinary if statement.
Just stylistic change, no functional change.
2016-04-21 12:05:01 +01:00
Richard W.M. Jones
cb0818ea86 mllib: Add documentation to Common_utils, JSON and Mkdtemp modules. 2016-04-20 23:15:51 +01:00
Richard W.M. Jones
dec30914e8 mllib: Rename uRI -> URI.
There is no difference in the OCaml module name, which remains 'URI'.
2016-04-20 22:48:37 +01:00
Pino Toscano
541d07e35f launch: direct: specify format for appliance drive
The drive used for the appliance is a raw (sparse) disk: specify that
explicitly in its -drive qemu command line options, so qemu can skip the
autodetection of its format and save a tiny bit of time.
2016-04-18 16:27:24 +02:00
Richard W.M. Jones
fb74a275c1 p2v: Allow p2v kernel options to override GUI configuration (RHBZ#1327488).
Allow kernel options such as p2v.o=libvirt to override internal
defaults, even for GUI configuration.

The main change is to split up the kernel conversion into two steps:
reading the kernel command line configuration, and performing the
conversion.  The kernel command line can then be read by the main
program and used to initialize the config structure for either kernel
conversion or GUI conversion.

A small adjustment is required in the test because p2v.pre no longer
runs before kernel command line parsing.  (The aim is to have
p2v.pre/post/fail still only run when doing a kernel conversion, not
in the GUI case.)
2016-04-18 14:48:09 +01:00
Richard W.M. Jones
f267840aa4 Version 1.33.22. 1.33.22 2016-04-17 09:54:47 +01:00
Richard W.M. Jones
9df3daccad valgrind: Ignore another glibc "leak".
See commit 74b604d7e6.
2016-04-17 09:49:28 +01:00
Richard W.M. Jones
0d9a9ec429 Version 1.33.21. 1.33.21 2016-04-16 22:42:08 +01:00
Richard W.M. Jones
0108240364 tests: Fix 'make check-slow'.
Since we started to use the parallel tests framework in automake,
'make check-slow' has been broken.  This is because parallel tests
doesn't allow you to run 'make check TESTS=...' with a set of test
scripts which do not also appear in the static list of tests in the
Makefile.am.  We would like to list and run only "fast" tests in the
Makefile.am, and have other scripts for slow tests.

The solution is to add the slow tests to Makefile.am, but condition
those tests on an environment variable SLOW=1 being set.

This commit fixes all the existing slow tests in this way, and updates
the documentation (guestfs-hacking(1)) to document how slow tests
should be written in future.
2016-04-16 20:40:49 +01:00
Richard W.M. Jones
90f6267606 v2v: Also check Fedora 23, RHEL 7.2 conversions in check-slow. 2016-04-16 19:32:15 +01:00
Richard W.M. Jones
74b604d7e6 valgrind: Use --run-libc-freeres=no.
Valgrind has a weird hack where it invokes a glibc function called
__libc_freeres on exit.  See:

  http://valgrind.org/docs/manual/faq.html#faq.exit_errors

This is intended to free up memory that glibc won't normally free
(since glibc doesn't free everything on exit for efficiency reasons).

More importantly, valgrind runs __libc_freeres even if the process
calls _exit, resulting in this bug:

  https://bugs.kde.org/show_bug.cgi?id=361810

(either a bug in valgrind, or in glibc, or in both, depending on your
point of view).

In any case we don't want this behaviour, so disable it.

Also we have to add suppressions for new "leaks" in glibc found by
valgrind because __libc_freeres no longer runs.  In fact there is only
one such suppression needed, for TLS allocation in multithreaded
tests.
2016-04-16 18:33:21 +01:00
Richard W.M. Jones
429a098839 valgrind: Use --trace-children=no --child-silent-after-fork=yes
When we are valgrinding we don't really care about the child
processes, which might be qemu, libvirtd, etc.  So disable tracing
into children (at least, as far as is possible with valgrind, which is
not entirely disabling it, but suppressing it).
2016-04-15 17:20:52 +01:00
Richard W.M. Jones
6f4de25369 Version 1.33.20. 1.33.20 2016-04-14 20:31:32 +01:00
Richard W.M. Jones
1b4d8ed72e docs: Add docs/C_SOURCE_FILES to EXTRA_DIST.
Fixes commit 04229c68d6.
2016-04-14 20:30:20 +01:00
Richard W.M. Jones
e84ceeada7 dist: Make AUTHORS/BUGS/etc rules safe if the output command fails.
Also use $@ instead of target name.
2016-04-14 19:54:05 +01:00
Richard W.M. Jones
788d2dbbff dist: Split up dist-hook so we have separate rules for each generated file.
This is convenient because it allows you to do:

  rm -f docs/C_SOURCE_FILES
  make docs/C_SOURCE_FILES

if you ever wanted to recreate that file (without doing 'make dist').

Note that the rules depend on configure.ac so that the files get
updated on each new version (otherwise the files would never get
updated).
2016-04-14 19:52:36 +01:00
Richard W.M. Jones
d2921ef270 Add safe wrapper around waitpid which deals with EINTR correctly.
Thanks: Eric Blake.
2016-04-14 19:42:28 +01:00
Richard W.M. Jones
1a77e61a41 utils: Allow use of gnulib in this file.
Almost all the tools link to -lgnu, so really this is fine.

Updates commit 768ab2e01d
and commit 83e92b4a97.
2016-04-14 18:09:55 +01:00
Richard W.M. Jones
64a04a4af0 builder: pxzcat: Remove ineffective POSIX_FADV_WILLNEED.
On Linux this will load the whole file into the page cache.  However
the output file is empty and zero sized just after it is opened, so
this has no effect.  Note that the advice is not persistent, so this
really does nothing.

I considered adding the call back after the file has been written,
just before the close, but:

 - If we do a virt-resize next then we will open and read the file mostly
   sequentially, so readahead will deal with any missing pages.

 - If we do a virt-customize next then we will only access a small
   part of the disk image, so loading it all into the page cache adds
   extra work.

 - In any case, since we have just written the file it's likely to
   still be in the page cache.
2016-04-14 17:00:44 +01:00
Richard W.M. Jones
816eb7605f builder: pxzcat: Close the output file.
After uncompressing the template we didn't close the output file,
which potentially could cause writes to the output file to be lost.
2016-04-14 16:10:47 +01:00
Richard W.M. Jones
0b1196ce6c fadvise: Add guestfs_int_fadvise_normal, document Linux behaviour.
This commit adds guestfs_int_fadvise_normal, but it's not enabled
since nothing calls it.

It also documents what Linux actually does, which is a bit different
from what I thought these settings did.  Note this is for Linux 4.6.0rc3
and may change in future.

This updates commit 83e92b4a97.
2016-04-14 16:04:08 +01:00
Richard W.M. Jones
f23d6d9e68 builder: pxzcat: Add further posix_fadvise hints.
Setting POSIX_FADV_RANDOM makes no measurable difference, but at least
it's the right thing to do.

POSIX_FADV_WILLNEED makes no measurable difference either.

Moving the calls to posix_fadvise to just after the open() makes no
measurable difference, but does make the code a bit clearer.

Changing POSIX_FADV_NOREUSE on the input file descriptor to
POSIX_FADV_DONTNEED slows things down by about 10%.
2016-04-14 15:23:00 +01:00
Richard W.M. Jones
83e92b4a97 utils, builder: Add wrappers for posix_fadvise.
Add wrappers around posix_fadvise and use them in places we were
calling posix_fadvise directly before.

Also in virt-builder we were doing this (and ignoring the result):

  posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED);

However the POSIX_FADV_* flags are _not_ bitmasks!  In fact
POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED == POSIX_FADV_NOREUSE so we were
giving a completely different hint from what we thought we were
giving.
2016-04-14 15:23:00 +01:00
Richard W.M. Jones
eeacb4ef60 launch: Implement a safer getumask.
The current implementation of getumask involves writing a file with
mode 0777 and then testing what mode was created by the kernel.  This
doesn't work properly if the user set a per-mount umask (or fmask/
dmask).

This alternative method was suggested by Josh Stone.  By forking, we
can use the thread-unsafe method (calling umask) and pass the result
back over a pipe.

This change also fixes another problem: mode_t is unsigned, so cannot
be used to return an error indication (ie. -1).  Return a plain int
instead.

Thanks: Josh Stone, Jiri Jaburek, Eric Blake.
2016-04-14 15:10:25 +01:00
Pino Toscano
f5821fe6b7 customize: cast value to intptr_t for pointer usage
Cast a Int64 OCaml value to intptr_t before casting it to a pointer, so
this avoids warnings about casting an int to pointer.

Fixes commit 80a13b7216.
2016-04-14 15:25:52 +02:00
Pino Toscano
3cc039bf17 docs: exclude more generated sources from C_SOURCE_FILES
Exclude more files from the documented sources in C_SOURCE_FILES:
- sources generated by XDR definitions
- sources generated by gperf
- errnostring.c (generated by the generator, and copied around from src
  to daemon during build)

Also update C_SOURCE_FILES as well, so libguestfs builds again from
scratch.
2016-04-14 13:12:31 +02:00
Roman Kagan
47aa64aec9 v2v: add support for virtio-scsi
Virtio-SCSI offers a number of advantages over virtio-blk, in
particular, it supports SCSI UNMAP (aka trim) which is crucial for
keeping the virtual drive from wasting host disk space.

This patch adds support for virtio-scsi as the virtual disk connection
type both on input and on output of v2v.

Virtio-blk remains the default, so for now virtio-scsi-based guests can
only be produced in --in-place mode.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-04-14 14:08:04 +03:00
Richard W.M. Jones
01f98a2500 docs: Convert more ordinary comments to internal documentation comments. 2016-04-13 13:47:50 +01:00
Richard W.M. Jones
63e9293b35 docs: Add internal documentation for a few virt-df functions. 2016-04-12 21:27:18 +01:00
Richard W.M. Jones
24e5b591e4 docs: Add internal documentation for a few guestfish functions. 2016-04-12 21:10:53 +01:00
Richard W.M. Jones
82aa5bd25e docs: Add internal documentation for a few daemon functions. 2016-04-12 20:59:40 +01:00
Richard W.M. Jones
4d55b046e3 docs: Add internal documentation for many core internal functions. 2016-04-12 20:19:58 +01:00
Richard W.M. Jones
5977fe9d2b docs, po: Only update C_SOURCE_FILES, POTFILES, etc when doing 'make dist'.
There's no particular reason that we have to update these files in
every 'make'.  It's slow, and it doesn't really matter if a single
file is accidentally omitted from translations on a developer's build
machine.

On the other hand generating it from 'make dist' has advantages:

 - We only do it once per release.

 - The maintainer can check the changes carefully.

 - If a developer adds some random files in their local build tree,
   these won't be picked up accidentally.

 - Changes to POTFILES etc won't leak into general commits.
2016-04-12 20:19:58 +01:00
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