Commit Graph

472 Commits

Author SHA1 Message Date
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
07c496c53c Use less stack.
GCC has two warnings related to large stack frames.  We were already
using the -Wframe-larger-than warning, but this reduces the threshold
from 10000 to 5000 bytes.

However that warning only covers the static part of frames (not
alloca).  So this change also enables -Wstack-usage=10000 which covers
both the static and dynamic usage (alloca and variable length arrays).

Multiple changes are made throughout the code to reduce frames to fit
within these new limits.

Note that stack allocation of large strings can be a security issue.
For example, we had code like:

 size_t len = strlen (fs->windows_systemroot) + 64;
 char software[len];
 snprintf (software, len, "%s/system32/config/software",
           fs->windows_systemroot);

where fs->windows_systemroot is guest controlled.  It's not clear what
the effects might be of allowing the guest to allocate potentially
very large stack frames, but at best it allows the guest to cause
libguestfs to segfault.  It turns out we are very lucky that
fs->windows_systemroot cannot be set arbitrarily large (see checks in
is_systemroot).

This commit changes those to large heap allocations instead.
2016-03-07 17:36:24 +00:00
Pino Toscano
82b0d25bb2 mllib: factor out mounting of guest root
Introduce and use a new inspect_mount_root function to mount all the
mountpoints of a root in the guest, replacing the same code doing that
in different tools.

inspect_mount_root_ro is inspect_mount_root with readonly mount option.
2016-03-03 14:52:39 +01:00
Richard W.M. Jones
ac76081f5a builder: Add Fedora 23 (armv7l) image. 2016-02-27 14:57:52 +00:00
Richard W.M. Jones
9ff2c3ef18 builder: armv7l: Specify virt-install --arch explicitly.
Allow us to run this script on x86_64 by specifying the --arch option
to virt-install, and removing the --cpu option.
2016-02-27 14:55:12 +00:00
Richard W.M. Jones
6b501cb6f2 builder: armv7l: Use latest available os-variant. 2016-02-27 14:55:12 +00:00
Richard W.M. Jones
fdc201a30c builder: armv7l: Use --vcpus=1 because TCG is not yet multithreaded. 2016-02-27 14:55:12 +00:00
Pino Toscano
0687bb8e07 builder: allow a specific template for --list
Allow the user to specify a template in --list mode, which will be the
only result in the resulting output (instead of all the available
templates).

This makes it easier to find out the details of a specific template.
2016-01-14 12:40:31 +01:00
Pino Toscano
0a84c67bd6 builder: move os-version search in own function
Simple code motion, no behaviour changes.
2016-01-14 11:51:13 +01:00
Richard W.M. Jones
446f7794e0 podwrapper: Add --warning flag for manual pages of CLI tools (RHBZ#1293527).
This doesn't add --warning flags to the translated pages,
which is a bug to be fixed at some point.
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
b527ff0dfc build: Require qemu >= 1.3.0 and yajl.
Require qemu >= 1.3.0, the first version that supported
`qemu-img --output=json'.

This means we require yajl (for parsing the JSON output of qemu-img),
and that in turn has consequences elsewhere.
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Richard W.M. Jones
9958dffc08 builder: Update Fedora 23 ppc64le image which was broken.
This updates commit d92758d8bb.
2015-12-19 21:30:50 +00:00
Richard W.M. Jones
d92758d8bb builder: Add Fedora 23 ppc64/ppc64le images. 2015-12-19 13:32:25 +00:00
Richard W.M. Jones
eed0e7a2e0 builder: Fix Fedora ppc64/ppc64le build scripts to use correct version. 2015-12-19 09:57:36 +00:00
Richard W.M. Jones
e44de65ec9 builder: Add CentOS 7.2 image. 2015-12-15 18:40:36 +00:00
Richard W.M. Jones
e69e9c1ece builder: website: Update comment in centos.sh script. 2015-12-15 18:20:17 +00:00
Richard W.M. Jones
0339b3d7a5 builder: Add Fedora 23 i686 image (RHBZ#1288733).
This includes the DNF fix, see
commit 59ea51d358.
2015-12-05 23:41:25 +00:00
Pino Toscano
a090a48f44 builder: create temporary images in the cachedir (RHBZ#1288201)
Temporary images can be quite big, more than the space available in
$TMPDIR when it's on a tmpfs; hence, place them in our cachedir
instead.
2015-12-04 11:06:35 +01:00
Richard W.M. Jones
59ea51d358 builder: Rebuild Fedora 23 image with new DNF (RHBZ#1280029, RHBZ#1278382).
We also need to add a small hack to the build script to ensure the
latest dnf is really included.
2015-12-01 13:03:31 +00:00
Richard W.M. Jones
4085acc67f builder: pxzcat: If write fails, display correct error message.
If uncompressing a template to a filesystem which is nearly full,
virt-builder displays an error which points to the wrong (source) file:

$ virt-builder fedora-22
[   1.2] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.7] Planning how to build this image
[   1.7] Uncompressing
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device

(The error message is usually printed once by each thread, so it is
printed several times.)

Change the error message to point to the output file, which might be a
temporary or the final file depending on the build plan:

$ virt-builder fedora-22
[   1.1] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.6] Planning how to build this image
[   1.6] Uncompressing
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
2015-11-27 09:08:07 +00:00
Richard W.M. Jones
6e15468337 builder: rhel: Fix path in rhel-aarch64.sh. 2015-11-24 15:41:56 +00:00
Richard W.M. Jones
a4c981e7bb builder: Make the interface between cmdline.ml and builder.ml explicit. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
7747723aa0 builder: Add Fedora 23 aarch64 image. 2015-11-12 18:12:04 +00:00
Richard W.M. Jones
c15b877310 builder: fedora-aarch64.sh: Switch to using Gerd's edk2. 2015-11-12 16:41:36 +00:00
Richard W.M. Jones
9307087bb5 builder: Use the 'may' pattern in a few places. 2015-11-11 16:12:35 +00:00
Pino Toscano
4cc98d8f6e OCaml tools: use open_guestfs everywhere
Instead of creating Guestfs handles and manually apply common options
(e.g. debug and trace), use the open_guestfs in Common_utils.
This also applies the common options to handles which didn't set them
before, so we can inspect also their messages if needed.
2015-11-10 11:38:40 +01:00
Richard W.M. Jones
b20d36aa1b tests: Change more conflicting temporary output file names.
Various tests cannot be run in parallel just because they happen to
use conflicting names for temporary output files (eg. "test.out").

Change these tests to use unique temporary names, so the tests could
be run in parallel.
2015-11-05 13:48:38 +00:00
Richard W.M. Jones
226848762b builder: Add fedora-23 image. 2015-11-04 13:06:11 +00:00
Richard W.M. Jones
9f70d71d4a builder: Document using 'qemu-img amend' for RHEL 6 compat (RHBZ#1204131). 2015-11-03 21:14:40 +00:00
Richard W.M. Jones
a2edda266e build: Make 'make clean' remove more files.
Remove man pages and other pages which 'make clean' did not remove
before.

To evaluate which pages could be removed, I did a full build and
check, and then ran 'make clean' followed by 'git clean -xdf'.  By
examining the output of the git clean command I could see which files
were being missed.

Files that are _not_ removed by make clean or make distclean:

 - generator-built files

 - Makefile, Makefile.in, .deps, .depend

 - any ./configure output files (maybe they should be?)
2015-11-03 13:53:37 +00:00
Richard W.M. Jones
47b095b928 website: Put website into a separate directory.
Move the random set of HTML files we build from html/ into
the website/ directory.

Also in the website/ directory, put the index.html file from
http://libguestfs.org, which was previously not under version control.
It is generated from index.html.in so we can automatically add the
current version and release date.

Also in the website/ directory, put various CSS file, images, etc.
which are required by the website and were also previously not under
version control.

Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
2015-10-31 17:09:29 +00:00
Richard W.M. Jones
dc1d0880b0 tests: Move the tests/data and tests/guests directories to test-data.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.

There are actually several new subdirectories created:

test-data/binaries: The pre-built binary and library files for random
architectures that we use to test various architecture detection
features (was part of tests/data).

test-data/blank-disks: The blank disks which are used for disk format
detection (was part of tests/data).

test-data/files: Other miscellaneous test files from tests/data that
are not included in the above.

test-data/phony-guests: The phony guests (was tests/guests).

test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
2015-10-30 16:07:32 +00:00
Richard W.M. Jones
63952d9666 ocaml: Rename Config module as Guestfs_config.
Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
25fee09a44 builder: Add Debian 7 sparc64 image. 2015-10-27 18:18:50 +00:00
Pino Toscano
a4da3f74c9 builder: run virt-resize with --unknown-filesystems=error
This way, we can make sure that if a template needs to be expanded, the
result will have all the filesystems correctly expanded, fitting into
the new sizes of their partitions.
2015-10-27 17:49:57 +01:00
Richard W.M. Jones
905a9c54e6 builder: Allow 'make install' to be run twice.
The error is:

ln -s xdg/virt-builder /tmp/p/etc/virt-builder
ln: failed to create symbolic link '/etc/virt-builder/virt-builder': File exists

There is no 'LN_SF' macro, but according to the documentation at
least, it should be safe to add a '-f' flag since it will work for
both the 'ln' and 'cp' variants of the macro.
2015-10-24 12:36:18 +01:00
Pino Toscano
753bf99f5c builder: fix conversion of double to OCaml (RHBZ#1270011).
Create the OCaml value for double using caml_copy_double, which is
the correct way, simplier, and works.
2015-10-12 16:38:50 +02:00
Richard W.M. Jones
0944acf90c mllib: Replace various ad hoc string_* functions with String.*
This is just a straight refactoring.  Various ad hoc string_*
functions that appeared in Common_utils have been renamed and placed
in the String.* namespace.  The old vs "new" functions are:

string_prefix  -> String.is_prefix
string_suffix  -> String.is_suffix
string_find    -> String.find
replace_str    -> String.replace
string_nsplit  -> String.nsplit
string_split   -> String.split
string_lines_split -> String.lines_split
string_random8 -> String.random8
2015-10-06 13:40:34 +01:00
Richard W.M. Jones
cab3d5d2f6 builder: Remove duplicate planner transition.
Seems to be a copy and paste bug in
commit 62cc7d3361.
2015-10-06 11:22:21 +01:00
Richard W.M. Jones
677c721e85 Fix whitespace.
Because of previous automated commits, such as changing 'guestfs___'
-> 'guestfs_int_', several function calls no longer lined up with
their parameters, and some lines were too long.

The bulk of this commit was done using emacs batch mode and the
technique described here:

  http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html

The changes suggested by emacs were then reviewed by hand.
2015-10-05 14:28:33 +01:00
Cédric Bosdonnat
d0aa7a032c Add opensuse.gpg to the dist tarball
Adding missing opensuse.gpg to EXTRA_DIST.
2015-09-30 16:04:12 +01:00
Cédric Bosdonnat
4bb4c0f4f7 builder: add opensuse images sources 2015-09-30 10:55:37 +02:00
Pino Toscano
1b8dd2150b builder: fix prototype virt_builder_yajl_tree_parse
Declare the prototype depending whether libyajl is available, and if it
isn't add also the noreturn attribute.

Fixes commit 87a42174f9.
2015-09-10 11:12:53 +02:00
Pino Toscano
27becc7e2f builder: handle output filenames with ':'
Use qemu_input_filename for the output file in the qemu-img convert
invocation.

See also commit 1709263613 for
virt-sparsify.
2015-09-09 13:19:57 +02:00
Pino Toscano
87a42174f9 builder: add noreturn for yajl functions without libyajl
caml_invalid_argument will not return, and GCC warns (or errors out with
-Werror) when the function is not marked as such.
2015-09-09 10:50:01 +02:00
Cédric Bosdonnat
fb9c17c8d4 Allow curl to follow redirects.
download.opensuse.org uses redirects to point to the relevant mirror.
Adding -L --max-redirs 5 to curl options will get us the requested
images.
2015-09-08 12:08:43 +02:00
Pino Toscano
268de62db6 builder: distribute simplestreams test files
Fixes commit b024aef6fb.
2015-09-08 11:51:49 +02:00
Pino Toscano
c8436df4a2 builder: replace colons in simplestreams test files
Colons won't be handled by make at all, so replace them with underscore
to be able to distribute them.
2015-09-08 11:51:49 +02:00
Pino Toscano
b024aef6fb builder: support Simple Streams v1.0 as index metadata
Add a new "simplestreams" repository type, and a simple parser for
fetching and reading the JSON indexes of the Simple Streams v1.0
format.

Read only datatype=image-downloads contents, and only the latest
versions of each content available as disk image (disk.img or
disk1.img).

Add a simple test, using the "released" images from the CirrOS project.
2015-09-08 09:51:49 +02:00