Commit Graph

9745 Commits

Author SHA1 Message Date
Pino Toscano
e86b36a31c appliance: add ldmtools/libldm packages on more distros (RHBZ#1409023)
Add them also for Debian and Mageia, where libldm is shipped, and
adjust the comment on the RedHat line.
2017-01-03 17:41:16 +01:00
Pino Toscano
55bf7de97c Update copyright dates for 2017
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2016/$1-2017/g' `git ls-files`

(Thanks Rich for the perl snippet, as used in past years.)
2017-01-03 16:48:21 +01:00
Richard W.M. Jones
dd519e8a8e lib: Move some appliance functions around.
Move some appliance functions out of src/appliance.c and src/launch.c
into separate files.

No functional change, just code movement.
2016-12-24 16:00:07 +00:00
Richard W.M. Jones
61d26f85fc Version 1.35.19. v1.35.19 2016-12-23 22:56:15 +00:00
Richard W.M. Jones
f7bd9bd37f launch: Validate $TERM before passing it through to the kernel command line.
Make sure it is reasonable before we pass it through to the kernel
command line.  I don't believe this is exploitable, but it might cause
obscure bugs.
2016-12-23 21:53:10 +00:00
Richard W.M. Jones
f94cfde5e7 launch: Rationalize how we construct the Linux kernel command line.
This is just code refactoring.
2016-12-23 21:53:10 +00:00
Richard W.M. Jones
764fd3fcc6 appliance: Disable EDD (edd=off) (RHBZ#1404287).
EDD (https://en.wikipedia.org/wiki/Enhanced_Disk_Drive) is a BIOS INT 13h
subcall for communicating the extended size of the boot disk over 8GB
to the OS.  Since libguestfs doesn't use a boot disk, and the
appliance disk is limited to 4GB, and we use virtio-scsi, this is all
useless.

EDD is also broken currently on RHEL 7.3, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1404287

Also the EDD probing takes significant extra time (about 80ms on my
laptop), and using edd=off reduces this time although doesn't entirely
eliminate it.
2016-12-18 20:13:55 +00:00
Pino Toscano
331517d9a3 sysprep: remove anaconda's /root/original-ks.cfg
Remove one more leftover file from anaconda.

Related to: RHBZ#1401320.
Thanks to: Marko Myllynen.
2016-12-15 09:37:01 +01:00
Richard W.M. Jones
adb6a85bf9 Version 1.35.18. v1.35.18 2016-12-14 18:16:16 +00:00
Richard W.M. Jones
b460c50bf5 sysprep: Add new test to EXTRA_DIST.
Fixes commit 3cb43460d3.
2016-12-14 18:14:26 +00:00
Richard W.M. Jones
d131d2af92 sysprep: Add common pod_of_list function to new module 'Utils'. 2016-12-14 17:23:11 +00:00
Richard W.M. Jones
d12636dadd sysprep: Add new operation for removing /etc/passwd- and other backup files (RHBZ#1401320). 2016-12-14 17:15:29 +00:00
Richard W.M. Jones
3cb43460d3 sysprep: Add a new operation to remove editor backup files (RHBZ#1401320).
Remove editor backup files such as *~ and *.bak wherever
they occur within the guest filesystem.

This also includes a test.
2016-12-14 17:15:29 +00:00
Richard W.M. Jones
ca0ce0c2ec mllib: Add a function to test if a guest is "unix-like".
This is not a precise replacement, since we now allow SSH key
injection into Minix, but that is probably correct anyway.
2016-12-14 17:15:29 +00:00
Richard W.M. Jones
2dd2d5cc64 mllib: Add a binding for fnmatch(3) in glibc or gnulib.
This is taken from supermin.
2016-12-14 17:15:29 +00:00
Richard W.M. Jones
4a62e52111 mllib: Add a binding for visit function in cat/visit.c. 2016-12-14 17:15:29 +00:00
Richard W.M. Jones
f87ec46558 v2v: Add a comment about why virt-v2v needs the network.
Only to run unconfigure_vmware ().
2016-12-14 16:52:29 +00:00
Pino Toscano
401e58cba8 tests: drop expected-failing btrfs_subvolume_show test
One of the tests for btrfs_subvolume_show tries to invoke it on the
toplevel subvolume, expecting its failure (since btrfs-progs used to not
be able to list that).  However, since v4.8.3 btrfs-progs can do that
(even if the data returned for that subvolume is limited/incomplete),
and thus this test fails because the API does not fail anymore.

Since we can consider that functionality working (for some kind of it),
then drop this test.
2016-12-14 17:09:32 +01:00
Pino Toscano
7bd6a73f00 libvirt: fix reading secret by usage type
Use the right variable to determine the usage type of a secret.

Fixes commit a94d551345.
2016-12-14 11:09:37 +01:00
Matteo Cafasso
46669d17c5 lib: use guestfs_int_make_temp_path to generate temporary files
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-12-13 18:10:44 +00:00
Matteo Cafasso
774b00e862 lib: generic function for temporary path generation
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-12-13 18:10:44 +00:00
Pino Toscano
3ed0a7a57d v2v: tests: avoid '..' in member names for tar
Very recent versions of tar (most probably as a consequence of
CVE-2016-6321) may refuse archive members with '..', like the relative
paths to upper level directories.

Since these are just tests, simply copy the files in the temporary
directories where tar (or zip as well) is run, so all the files are in
the same directory.
2016-12-13 09:16:29 +01:00
Pino Toscano
99834b85b2 perl: fix memory leak in RStruct actions
The return value struct was freed using a simple free() instead of the
own cleanup function of each struct: this meant dynamically allocated
values (such as strings) were leaked.

Use the proper cleanup functions instead.
2016-12-13 09:16:29 +01:00
Pino Toscano
9089b9eaa2 java: fix memory leak in RStruct actions
The return value struct was freed using a simple free() instead of the
own cleanup function of each struct: this meant dynamically allocated
values (such as strings) were leaked.

Use the proper cleanup functions instead.
2016-12-13 09:16:29 +01:00
Richard W.M. Jones
25ed84c64d builder: Fixed CentOS 7.3 image.
The previous one had apparent filesystem corruption.

Fixes commit b16627d679.
2016-12-12 22:14:47 +00:00
Richard W.M. Jones
b16627d679 builder: Add CentOS 7.3 template.
Release notice:
https://lists.centos.org/pipermail/centos-announce/2016-December/022172.html
2016-12-12 20:14:20 +00:00
Richard W.M. Jones
a200c4c32b Version 1.35.17. v1.35.17 2016-12-11 18:30:46 +00:00
Richard W.M. Jones
8f32e5d67e builder: Fix copying of virt-builder index.asc etc to website.
The definition of BUILDFILES was accidentally removed, resulting
in the error:

  cp  /home/rjones/d/websites/libguestfs/download/builder/
  cp: missing destination file operand after '/home/rjones/d/websites/libguestfs/download/builder/'

Fixes commit 65a0570385.
2016-12-11 18:23:11 +00:00
Richard W.M. Jones
89ea624571 Version 1.35.16. v1.35.16 2016-12-10 16:31:17 +00:00
Richard W.M. Jones
2e7aecd1ad builder: Don't try to translate make-template.ml.
It fails with:

  File "../builder/templates/make-template.ml", line 1, characters 0-1:
  Parse error: [a_LIDENT] expected after "#" (in [implem])
  End_of_file
  An error occurs while processing.

In any case this doesn't matter because this file should not be
translated.

Fixes commit a1ea9a2599.
2016-12-10 16:20:34 +00:00
Richard W.M. Jones
a1ea9a2599 Version 1.35.15. v1.35.15 2016-12-10 15:45:19 +00:00
Richard W.M. Jones
f070774e2c v2v: Fix POTFILES-ml.
Fixes commit 222535fa12.
2016-12-10 15:37:33 +00:00
Richard W.M. Jones
546fd23504 builder: Add website/download/builder/* files to EXTRA_DIST.
Fixes commit 65a0570385.
2016-12-10 15:37:29 +00:00
Pino Toscano
f2435c7ab4 inspect: improve canonical_mountpoint implementation
Use a simplier version using a loop, skipping multiple '/' at once,
reducing the amount of memmove and strlen needed.

Updates commit 865d070ddc.
2016-12-09 13:52:00 +01:00
Richard W.M. Jones
24d14e1d26 v2v: Fix ambiguous and probably incorrect pattern match (warning 57).
See:
http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#ss%3Awarn57

I believe the code as written previously was incorrect.  However we
are lucky because if neither clause matches then it will fall through
to displaying an error message, allowing the user to correct the
problem.
2016-12-09 11:28:02 +00:00
Richard W.M. Jones
c540676f5e Remove most instances of OCaml warning 52.
See:
http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#s:comp-warnings
2016-12-09 09:31:25 +00:00
Richard W.M. Jones
63ff96ccda customize: Remove Customize_utils module.
After the previous commit this module is empty, so remove it.
2016-12-09 09:31:25 +00:00
Richard W.M. Jones
07fb30b161 mllib: Add quote function to Common_utils module.
Remove multiple places where we let quote = Filename.quote
2016-12-09 09:31:25 +00:00
Richard W.M. Jones
2cc348448a generator: Share Common_utils code.
For a very long time we have maintained two sets of utility functions,
in mllib/common_utils.ml and generator/utils.ml.  This changes things
so that the same set of utility functions can be shared with both
directories.

It's not possible to use common_utils.ml directly in the generator
because it provides several functions that use modules outside the
OCaml stdlib.  Therefore we add some lightweight post-processing which
extracts the functions using only the stdlib:

  (*<stdlib>*)
  ...
  (*</stdlib>*)

and creates generator/common_utils.ml and generator/common_utils.mli
from that.  The effect is we only need to write utility functions
once.

As with other tools, we still have generator-specific utility
functions in generator/utils.ml.

Also in this change:

 - Use String.uppercase_ascii and String.lowercase_ascii in place
   of deprecated String.uppercase/String.lowercase.

 - Implement String.capitalize_ascii to replace deprecated
   String.capitalize.

 - Move isspace, isdigit, isxdigit functions to Char module.
2016-12-09 09:31:25 +00:00
Richard W.M. Jones
865d070ddc inspect: fstab: Canonicalize paths appearing in fstab.
For example, converts "///usr//local//" -> "/usr/local".
2016-12-07 14:54:24 +00:00
Richard W.M. Jones
222535fa12 v2v: Rename RHEV to RHV throughout.
You can now use -o rhv (-o rhev is supported for compatibility).
2016-12-07 14:12:28 +00:00
Richard W.M. Jones
bdaeeb4e60 v2v: -o vdsm: Add --vdsm-compat flag. -o rhev: Drop support for RHV < 4.1 (RHBZ#1400205).
Support for RHEV with RHEL 6 nodes required us to output the old style
qcow2 compat=0.10 images.  Since RHEV 3.6 GA, RHEL 6 has not been
supported as a RHEV node type.  Since RHV 4.1, compat=1.1 is
supported.  (Support for compat=1.1 is uncertain in RHV 4.0 even on
RHEL 7 nodes.)

There are significant downsides to using qcow2 compat=0.10 instead of
the modern default (compat=1.1).

Therefore this patch does two things:

For -o rhev, it drops support for compat=0.10 completely.  You must
use RHV 4.1.

For -o vdsm, it adds an interim flag (--vdsm-compat=0.10 or
--vdsm-compat=1.1) which controls the compat level of the qcow2 output
file.  VDSM should use --vdsm-compat=1.1 when it is known that modern
qemu is available.  We can make this the default later when all RHV
instances have moved to 4.1.

It also adds:

  vdsm-compat-option

to the `virt-v2v --machine-readable' output to indicate that this flag
can be used.

Thanks: Yaniv Kaul, Michal Skrivanek.
2016-12-07 14:12:28 +00:00
Pino Toscano
1d86b37689 inspect: gather info from /usr filesystems as well (RHBZ#1401474)
Flag the filesystems for Linux /usr properly as USR role, and detect
some data out of it, like the distro information from an os-release
(if present), and the architecture (since the binaries used for our
architecture check will be available there only).

Later on, collect the results in a way similar to what is done for
CoreOS: for each non-CoreOS root, try to find its /usr filesystem, and
if found then merge what is missing from root; in the last case, also
override the distro inspection data (version, product name) if available
in /usr.
2016-12-07 14:23:11 +01:00
Pino Toscano
dad35e55fa inspect: fix existance check of /dev/mapper devices
When checking for the existance of /dev/mapper devices found in the
fstab of a filesystem, using guestfs_exists means they are checked as
files in the guest, while they really appear as devices on the
appliance. Instead, try the lvm name resolution anyway, and ignore them
when they are reported as missing.

Thanks to: Richard W.M. Jones.

Fixes commit 96b6504b09.
2016-12-07 14:23:11 +01:00
Pino Toscano
e21b055f3e resize: shrink/expand swap partitions
Handle the swap partition on their own, rebuilding them using the
existing UUID and label.
2016-12-07 14:20:35 +01:00
Pino Toscano
aad24f4d56 daemon: allow to change the labels of swap partitions 2016-12-07 14:20:31 +01:00
Pino Toscano
a94d551345 libvirt: read secrets of disks (RHBZ#1392798)
Read also the secrets associated to disks (<secret> tag within <auth>),
so qemu can properly open them later on.
2016-12-07 13:48:47 +01:00
Pino Toscano
bef838202b libvirt: un-duplicate XPath code
Move the checks for empty xmlXPathObjectPtr, and for extracting the
result string out of it, to a new helper functions.

This is just code motion, there should be no behaviour changes.
2016-12-07 13:38:29 +01:00
Pino Toscano
e77e1ef95e inspect: mark CoreOS /usr partitions with own USR role
Add a new inspect role for "/usr" partitions, and use that to mark the
/usr partition in CoreOS: this additional role allows to ease its lookup
later on, when merging its results into those of the root.
2016-12-06 18:11:44 +01:00
Pino Toscano
0c4edcecba inspect: change is_root flag into enum
Introduce a new enum to classify the role of a filesystem, if available.
This will help later on when doing operations on non-root filesystems,
like detecting particular mountpoints such as /usr.

The new enum has only "root" as known role, which replaces the is_root
flag.
2016-12-06 18:11:44 +01:00