Commit Graph

9460 Commits

Author SHA1 Message Date
Richard W.M. Jones
9d387b5eeb po: Update POTFILES. 2016-08-04 09:52:07 +01:00
Richard W.M. Jones
9fc0418db5 mllib: _exit should return 'a
Fixes commit 0dfa96c043.
2016-08-04 09:27:43 +01:00
Richard W.M. Jones
bdfce1995b Version 1.33.47. v1.33.47 2016-08-03 16:43:54 +01:00
Pino Toscano
d12be6625a dib: rework run of extra-data.d hooks (RHBZ#1362354)
Instead of running them before lanching the appliance with the disks and
then uploading the result after root.d hooks run, mount the root in the
local temporary directory using FUSE and then run the hooks on the
guest.  Other than being closer to what diskimage-builder does, it also
avoids issues with the extra-data.d scripts assuming to find things
already, and we don't error out while trying to unpack files on the
guest.

Since virt-dib requires FUSE now, build it only if FUSE is supported.
2016-08-03 16:48:11 +02:00
Pino Toscano
5077c02046 mllib: move _exit from v2v as Exit module
Move the OCaml binding to C _exit to an own module.

Just code motion, adapting v2v in the process.
2016-08-03 15:01:59 +02:00
Pino Toscano
2cb053d3fe mllib: check for executable existance in run_command (RHBZ#1362357)
run_command uses Unix.create_process which forks a child process, and
executes execve: the latter fails when the executable does not exist,
triggering the exit which, in older OCaml versions [1], also runs the
at_exit handlers.

Since there is not much that can be done to avoid this on the OCaml
side, to keep run_command working also in older OCaml version then
manually search for the existance of the given executable, exiting with
code 127 (as a shell does) in this case.

[1] http://caml.inria.fr/mantis/view.php?id=7209
2016-08-03 10:07:04 +02:00
Pino Toscano
398b940ea4 mllib: move which and its exception from dib
Rename it from "tool" to "executable" in the process, but otherwise
it is just code motion (with minimal adjustments in dib).
2016-08-03 10:07:04 +02:00
Richard W.M. Jones
c8c181e8d9 launch: libvirt: Autodetect backing format for readonly drive overlays (RHBZ#1354335).
If the user doesn't specify a format (ie. they want autodetection),
and the drive is set to read-only, previously we created a qcow2
overlay to protect the drive but didn't set the backing_fmt field.
However libvirt disabled this so now libvirt doesn't work at all on
qcow2 files that have no backing_fmt field set.

We must therefore do autodetection in libguestfs and use that to set
the backing_fmt field.

We were already doing autodetection in the non-readonly case, so this
commit refactors that code into a new function
("get_source_format_or_autodetect") and uses it on the readonly path
too.
2016-08-02 20:33:57 +01:00
Richard W.M. Jones
3b9cc56a45 v2v: linux: Ignore unused string return value of 'file_owner'.
Because we didn't give the type of 'g' there wasn't sufficient
information for the type checker to pick up this problem.  By
specifying the real type of 'g' in a type annotation, that reveals the
problem.

Thanks: Pino Toscano, Nyoxi on IRC.
2016-08-02 12:11:32 +01:00
Tomáš Golembiovský
75d3c5d3c9 v2v: fixed file_owner function
What was happening in file_owner function did not match the description
in the comment. When a path is owned by multiple packages the returned
string was in fact a concatenation of the names of all packages that own
it. E.g. for `Linux.is_file_owned g inspect "/etc"` the returned value
was "filesystemyum" (i.e. "filesystem" + "yum").

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-08-01 15:37:39 +02:00
Richard W.M. Jones
1d3f075502 v2v: xml: Rename internal xpath_new_context function.
This change is not necessary, but is consistent with the naming scheme
of the rest of the code in this file.
2016-07-31 17:20:08 +01:00
Richard W.M. Jones
9e0022cea8 v2v: xml: Link to libxml2 website.
No change, just finessing the documentation.
2016-07-31 17:04:16 +01:00
Pino Toscano
19b0ae6c65 lvm: do not pass --cache to vgscan
This breaks lvm setups with no lvmetad, and it seems to not be needed
even with lvmetad.

Reverts parts of commit 2c4f154b91.
2016-07-29 17:21:25 +02:00
Pino Toscano
12c05d5c36 osinfo: fix reading of shared osinfo DB
$OSINFO_SYSTEM_DIR (or its /usr/share/osinfo fallback) represents the
top-level directory of the osinfo data, while we need to read the "os"
subdirectory of it.

Fixes commit c2ae46a9eb.
2016-07-29 11:36:37 +02:00
Richard W.M. Jones
fa2949b7a5 docs: In API overview, add note that you should free returned values. 2016-07-29 09:09:17 +01:00
Pino Toscano
11a359c76c osinfo: do not assume every media is an installer
The osinfo has an "installer" attribute in <media>, which defaults to
true, and there are few entries which are marked as not.
2016-07-28 15:53:26 +02:00
Pino Toscano
bfedfb6e3c osinfo: simplify reading of attributes from <media>
Directly query the attributes in the media node, instead of using an
XPath expression to read it.

Saves ~10ms when parsing the libosinfo DB on a Fedora 24 installation
(other than making the code easier).
2016-07-28 15:32:31 +02:00
Pino Toscano
38ef48cde5 utils: add new CLEANUP_XMLFREE cleanup, to call xmlFree()
Small cleanup helper to dispose xmlChar* buffers.
2016-07-28 15:30:49 +02:00
Pino Toscano
2ed76e6f17 build: improve Gtk check
Check the presence of Gtk properly depending on the value of --with-gtk:
if a specific version is chosen, then let PKG_CHECK_MODULES fail if that
version if not found, otherwise fallback from gtk3 to gtk2 to no gtk.

Also move few common AC_SUBST in a single place.
2016-07-28 10:56:58 +02:00
Richard W.M. Jones
108509ec19 docs: hacking: Add a section describing the build system. 2016-07-27 19:02:49 +01:00
Richard W.M. Jones
7561d1bcae docs: hacking: Improve documentation on how OCaml programs are built. 2016-07-27 19:02:27 +01:00
Richard W.M. Jones
c008dd15a7 Version 1.33.46. v1.33.46 2016-07-27 15:09:18 +01:00
Pino Toscano
0a808d986a builder: fix EOF check with flex >= 2.6.1
It looks like flex 2.6.1 changed [1] the return code for EOF in
yyinput.  Therefore, use the right value depending on the version of
flex which generates the lexer.

[1] f863c9490e
2016-07-27 15:24:29 +02:00
Pino Toscano
a6330e9d3a appliance: run systemd-tmpfiles also for /run
Setup the volatile /run in the appliance also with the tmpfiles
configurations available.  In particular, setting up correctly the lvm
bits allow lvmetad to run.
2016-07-26 18:24:40 +02:00
Pino Toscano
7367945647 daemon: lvm: improve filter for LVs with activationskip flag set
Commit 2e16e3e993 added lv_active=active
as additional condition when listing LVs, to ignore those with the
activationskip flag set.  OTOH, this check is too broad, and matches
also other kind of LVs.

Change the condition to lv_skip_activation!=1, so matching precisely
what was meant, and only that.

Related to: RHBZ#1306666
2016-07-26 18:24:39 +02:00
Pino Toscano
2c4f154b91 daemon: lvm-filter: start lvmetad better
Currently lvmetad is started in init, and thus using the system
(= appliance) configuration of lvm.  Later on, in the daemon, a local
copy of the lvm configuration is setup, and set it for use using the
LVM_SYSTEM_DIR environment variable: this means only the programmes
executed by the daemon will use the local lvm configuration, and not
lvmetad.

Thus manually start lvmetad from the daemon, right after having setup
the local lvm configuration, and still without failing if it cannot be
executed.

Additionally, since lvmetad now respects the right configuration, make
sure to update its cache when rescanning the VGs by passing --cache to
vgscan.
2016-07-26 18:24:31 +02:00
Pino Toscano
5ce19cec4c daemon: lvm-filter: set also global_filter
When editing the lvm configuration to set the LVM filter, edit the
'global_filter' key in addition to 'filter': the latter is not used when
lvmetad is running, when only the former works.
2016-07-26 16:58:53 +02:00
Pino Toscano
ca1f8efd29 daemon: lvm: change the separator character to '\r'
Commit b91b39e06a changed the separator to
':', although this creates parsing issues when there are fields with
colons (for example lv_tags=imgbased:pool).

Change once more the separator, but this time using a non-printable
character such as '\r': while it will produce uglier debug logs, this
should greatly reduce the possibilities of conflicts with texts of
metadata.
2016-07-26 14:46:49 +02:00
Pino Toscano
1b8e6c7880 osinfo: map "sled" as "sles"
The "sles" distribution string in libguestfs represents both SLES and
SLED, so map the osinfo descriptions of "sled" distributions as "sles".
2016-07-26 11:55:31 +02:00
Pino Toscano
9dc3aa3786 osinfo: parse also single-digit version numbers
Switch to guestfs_int_version_from_x_y_or_x to parse version numbers --
although, restrict the parsing to what could look like a valid version
number, to discard quickly version strings like "unknown".

This makes sure that Debian, Fedora, Mageia, and SLED ISOs have the
right version number.
2016-07-26 11:55:31 +02:00
Pino Toscano
c2ae46a9eb osinfo: revamp db reading (RHBZ#1359652)
More recent versions of libosinfo switched the internal directory with
the XML files of OSes to a different layout (still with the same XML
format), causing libguestfs to not read them anymore.  Furthermore, the
internal directory is going to disappear soon, replaced by a public
osinfo database [1].

Revamp the way libguestfs reads the data: first try the upcoming osinfo
layout, falling back to the current libosinfo layout (which is the same
as osinfo), and then to the old flat layout.

[1] https://gitlab.com/libosinfo/libosinfo/blob/master/docs/database-layout.txt
2016-07-26 11:54:31 +02:00
Richard W.M. Jones
d5a8f82887 Use 'const' for stack integers where possible.
May improve optimization possibilities in a few cases.
2016-07-26 10:43:45 +01:00
Pino Toscano
4e391aad67 po: fix markups in Japanese translation
Avoid extra spaces in L<>, they cause the POD to be invalid.
2016-07-26 10:29:45 +02:00
Pino Toscano
91d17dfe7b po: fix placeholder in Ukrainian translation
__SOMETHING__ strings are placeholders which must be left as-is.
2016-07-26 10:29:00 +02:00
Pino Toscano
7b90ff3fc8 Limit GCC 6 pragmas.
-Wnull-dereference and -Wshift-overflow are new warnings in GCC 6, so do
not try to disable them with pragmas on older GCC versions.

Fixes commit a8e15ea924.
2016-07-25 19:45:03 +02:00
Richard W.M. Jones
5363502a38 Update gnulib to latest.
As a side effect this enables the -Wnull-dereference &
-Wshift-overflow warnings.
2016-07-24 12:18:10 +01:00
Richard W.M. Jones
a8e15ea924 daemon: Ignore -Wnull-dereference & -Wshift-overflow warnings.
One -Wnull-dereference warning is real: we deliberately cause a
segfault in one of the tests.

There is a -Wshift-overflow bug in a Gtk 2 header.

The others are the result of shortcomings in GCC.

In all cases we have to add GCC diagnostic overrides to ignore
the warnings when compiling with ./configure --enable-werror.
2016-07-24 10:55:52 +01:00
Richard W.M. Jones
d0e263248d Update translations from Zanata. 2016-07-23 23:26:16 +01:00
Richard W.M. Jones
5fe8149e00 df: Fix uninitialized variable when compiled without libvirt. 2016-07-23 23:08:42 +01:00
Richard W.M. Jones
1fac79e869 Version 1.33.45. v1.33.45 2016-07-22 17:34:50 +01:00
Pino Toscano
8e57268dd4 static const char *str -> static const char str[]
Make all the static constant strings as char arrays, so they can be
fully stored in read-only memory.
2016-07-22 13:16:02 +02:00
Richard W.M. Jones
8689bfa437 p2v: Remove dead code from virt-p2v kickstart.
Including some code which looks like it is disabling SELinux, but is
in fact commented out -- see previous commit.
2016-07-21 22:36:07 +01:00
Richard W.M. Jones
fcce1f694e Revert "p2v: Disable SELinux in virt-p2v-make-disk."
The commit claimed that SELinux was disabled in the
virt-p2v-make-kickstart script, and so this was just making things
consistent.  However this is not true.  SELinux *is* enabled in the
kickstart version.  There is some code to disable it, but it is
commented out (admittedly it's hard to tell because the code is buried
in a multi-line sed expression).

The commit message also claimed (this time correctly) that the
'--selinux-relabel' step caused an extra reboot each time virt-p2v is
run from the ISO.  However we have recently fixed this so it can
usually do the relabelling during the build, not at boot time, so this
is no longer a problem.

This reverts commit 25ffcc7d43.
2016-07-21 22:34:58 +01:00
Richard W.M. Jones
74b13550db Update release notes. 2016-07-21 21:17:14 +01:00
Pino Toscano
bb842b415e customize: use --noconfirm when installing Arch Linux packages
Otherwise the installation will fail right away, since pacman by default
asks for confirmation of the operation.
2016-07-21 13:53:27 +02:00
Pino Toscano
a5176e6014 customize: password: use SHA-512 on Void Linux and Arch Linux
They are rolling distributions, so we can assume they have a glibc
version greater than 2.7 (cca Oct 2007).
2016-07-21 13:53:27 +02:00
Richard W.M. Jones
5e65da07fa podcheck: Check tool --help output.
For OCaml tools this does essentially nothing useful because the
--help output is automatically generated from the options, and so
cannot be wrong.  However for C tools this is a useful check.

It would be nice to generate C tools --help output, but there isn't
enough information in the getopt data to do that.

This commit also includes fixes to the --help output for a few tools.
2016-07-21 12:45:15 +01:00
Matteo Cafasso
a77c6aac81 Added download_blocks API test
The test shows how the function can be used to retrieve deleted data
from a disk partition.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-07-20 15:26:50 +02:00
Matteo Cafasso
007ef02e7d New API: download_blocks
This function allows to download file system data units (blocks) from
the given partition.

The API can be used to detect data hidden within filesystem bad blocks
or slack space.

Moreover for filesystems such as Ext3 and Ext4, this function is the
only way to retrieve deleted files. An example is given in the function
tests.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-07-20 15:26:50 +02:00
Pino Toscano
5996080f7c v2v: make virsh command quiet if v2v is quiet (RHBZ#1358142)
Pass -q to virsh if virt-v2v was run with -q, to reduce its output in
quiet mode.

Unfortunately this does not currently work in virsh as it should, see
RHBZ#1358179, so only after that bug is fixed this change can actually
take effect.
2016-07-20 13:40:12 +02:00