Compare commits

...

801 Commits

Author SHA1 Message Date
Richard W.M. Jones
c008dd15a7 Version 1.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. 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
Richard W.M. Jones
fb1e9267fe mllib, customize: Don't add -g option to ocamlmklib command line.
ocamlmklib -g does not work in OCaml 4.01.0.  It does work (and is
desirable) in OCaml 4.02.2.  However since we would like to support
back to OCaml 3.11, we cannot use it.
2016-07-20 12:24:10 +01:00
Pino Toscano
08a7c5c47b daemon: mkfs: allow setting labels for f2fs filesystems
Pass -L $LABEL to set the label of a f2fs filesystem when creating it.
2016-07-20 10:17:04 +02:00
Pino Toscano
52d4e566cc appliance: add f2fs-tools to the appliance
Helper tools for f2fs filesystems.
2016-07-20 10:17:04 +02:00
Richard W.M. Jones
8d518c37cd customize: Fix the test.
In libguestfs 1.33.43 we managed to release a completely
non-functional virt-customize binary (it ran without error but did
nothing at all, whatever command line arguments you gave it).

Improve the test so this cannot happen again.
2016-07-19 19:01:54 +01:00
Pino Toscano
326f37d547 tests: check documented tool options also for inspector and p2v
This includes the additional tests, and the few needed fixes.

Followup of commit 08e27451a6.
2016-07-19 15:21:27 +02:00
Richard W.M. Jones
093f1ee546 Version 1.33.44. 2016-07-19 14:05:24 +01:00
Richard W.M. Jones
08e27451a6 tests: Add script to check documented tool options match actual options.
podcheck.pl is run as part of the tests to perform various checks on
the documentation and the tool.

Currently we check only that the documented options matches the
options that the tool implements and vice versa.  This commit would
also allow us (in future) to check --help, --long-options,
--short-options, --version output.

This commit includes scripts to run the tests and various fixes to the
manual pages to ensure that the tests pass.
2016-07-19 13:06:14 +01:00
Richard W.M. Jones
1fa3bf14e5 builder: Fix rhel-ppc64le guestroot to match reality. 2016-07-19 13:06:14 +01:00
Richard W.M. Jones
8886f2951d fish, format, fuse: Remove bogus short options.
For guestfish, guestmount, remove '?' from short options.  Currently
those tools don't process -?, so I believe these are erroneous:

  $ guestfish -\?
  Try `guestfish --help' for more information.

For virt-format, the -c, -d and -q options are removed.  These options
just give errors because they appear in the short options list but not
in the case statement.
2016-07-19 12:32:09 +01:00
Richard W.M. Jones
d03e8f461e builder: Fix URL for RHEL 7.2 ppc64le images. 2016-07-19 12:32:08 +01:00
Richard W.M. Jones
faf41e7fbb mllib: tests: Add tests to EXTRA_DIST.
Fixes commit 41a1b8a5ca.
2016-07-18 18:50:02 +01:00
Pino Toscano
34cdb1145e builder: improve the handling of list formats
Store them directly in List_entries, an adding helper function to
convert from string.

Also use Getopt.Symbol for them, so there is no need to manually reject
invalid formats.
2016-07-18 18:21:41 +02:00
Pino Toscano
99797a3d2f mllib: Getopt: add Getopt.Symbol
Introduce a new type of option to allow a value out of a fixed choice,
much like Arg.Symbol.
2016-07-18 18:20:57 +02:00
Richard W.M. Jones
41a1b8a5ca mllib: tests: Add tests of the new Getopt module. 2016-07-18 17:05:42 +01:00
Richard W.M. Jones
ba2cf9a2eb mllib: Use L"..." and S '...' for long and short options.
There is also an M"..." variant which acts the same way as
L but handles the annoying virt-v2v two letter options.
2016-07-18 17:01:22 +01:00
Richard W.M. Jones
4ac1744db4 mllib: getopt: Further fix int parsing.
Don't allow suffixes on integers, and fix the bounds to match the
definitions of Min_long and Max_long in <caml/mlvalues.h>.

Fixes commit 66b54bfefe.
2016-07-18 16:50:18 +01:00
Richard W.M. Jones
bef2d2f30e rescue: Implement virt-rescue -w option.
Documented, but never implemented.
2016-07-18 16:50:18 +01:00
Richard W.M. Jones
7352071dbf diff: Implement virt-diff --long-options.
The code was only partially implemented so the option did
not function.
2016-07-18 16:01:05 +01:00
Pino Toscano
b7e7fe396d mllib: Getopt: point to man page as additional help
On error, point also to the man page of the current tool in addition to
'$TOOL --help'.
2016-07-18 15:35:25 +02:00
Richard W.M. Jones
c2fda2c1f2 build: Factor out definition of BEST and OCAMLLINKFLAGS.
No change, just refactoring.
2016-07-18 14:11:22 +01:00
Richard W.M. Jones
2c6bfccb06 build: Fix dependencies on mllib and customize.
Binaries should be rebuilt if mllib.cma/mllib.cmxa or
customize.cma/customize.cmxa change.

Fixes commit 1e2877c6f4.
2016-07-18 14:10:28 +01:00
Richard W.M. Jones
fde0b73597 customize: Build virt-customize properly.
Fixes commit 6a0fe553b9.
2016-07-18 13:54:23 +01:00
Pino Toscano
66b54bfefe mllib: Getopt: fix integer parsing
Since we are using gnulib already, make use of xstrtol to parse the
integer arguments to avoid extra suffixes, etc.

Fixes commit 0f7bf8f714.
2016-07-18 10:58:14 +02:00
Richard W.M. Jones
4920ff57c9 Version 1.33.43. 2016-07-14 15:44:03 +01:00
Richard W.M. Jones
3bf9420f94 builder: Add new centos-aarch64.sh script to EXTRA_DIST.
Fixes commit c168638ae7.
2016-07-14 15:40:42 +01:00
Richard W.M. Jones
6a0fe553b9 customize: Build a customize.cma/customize.cmxa library.
Instead of linking with individual objects, which is very tedious,
build a proper library and link virt-builder, virt-customize and
virt-sysprep to it.

This makes the binaries a tiny bit smaller because .cmxa/.a files
allow unused code to be removed by the linker, whereas explicitly
linking .cmx/.o files does not.
2016-07-14 15:40:42 +01:00
Richard W.M. Jones
1e2877c6f4 mllib: Build a mllib.cma/mllib.cmxa library.
Instead of linking with individual objects, which is very tedious,
build a proper library and link the other tools with it.

This doesn't make the resulting binaries any larger.
2016-07-14 15:28:10 +01:00
Richard W.M. Jones
fc11490484 v2v: linux: Use new SELinux_relabel module to relabel Linux guests. 2016-07-14 15:28:10 +01:00
Richard W.M. Jones
35bac3a650 lib: Deprecate old SELinux APIs, rewrite SELinux documentation (RHBZ#1152825).
Also turns the --selinux option of guestfish, guestmount and
virt-rescue into a no-op -- it didn't work before so this is
effectively no change.
2016-07-14 15:28:10 +01:00
Richard W.M. Jones
b6e92b1100 builder: Use virt-sysprep --selinux-relabel when preparing templates.
Don't need to be clever now.
2016-07-14 15:28:10 +01:00
Richard W.M. Jones
f3c69fe60b customize: Add module for doing SELinux relabel of filesystem (RHBZ#554829, RHBZ#983969, RHBZ#1089100).
This implements the --selinux-relabel option for virt-customize,
virt-builder and virt-sysprep.  There is no need to autorelabel
functionality now.

Thanks: Stephen Smalley
2016-07-14 15:28:10 +01:00
Richard W.M. Jones
6ec75f8cfe tests: Add a test of the setfiles API. 2016-07-14 15:28:10 +01:00
Richard W.M. Jones
9d205f1c28 New API: selinux_relabel - SELinux relabel parts of the filesystem. 2016-07-14 15:28:10 +01:00
Pino Toscano
fd60be9509 appliance: touch /etc/fstab when enabling the network (RHBZ#1224795)
Sadly, the dhclient-script shipped as part of isc-dhcp-client in Ubuntu
unconditionally reads from /etc/fstab without checking for its
existence.  Since no package holds /etc/fstab, this file will not exist
in the appliance, cause dhclient to fail (actually keep looping calling
the failing dhclient-script) when the network is requested.

As a workaround, touch /etc/fstab just before enabling the network: if
that file exists nothing changes, while an empty file will be available
in the other case, making at least dhclient-script in Ubuntu working.
2016-07-14 14:09:18 +02:00
Richard W.M. Jones
eb22e2d36e v2v: Move augeas_debug_errors (renamed debug_augeas_errors) to common code.
Since the function uses the StringMap module, I also had to
move this to mllib.

The function is renamed and the 'if verbose ()' part is moved into the
function, but apart from that, it's all just code motion.
2016-07-14 11:40:22 +01:00
Pino Toscano
412dedd029 po: fix markups in Ukrainian translation
- remove extra \n at end of msgstr (not present in its msgstr)
- fix printf format specifier
2016-07-14 11:02:36 +02:00
Pino Toscano
7a404b1110 mllib: Getopt: support hidden options
Add a dummy description value to mark an option as "hidden", so it will
not be shown in the help text.

Mark few options as hidden:
- common: --short-options, --long-options, --debug-gc
- virt-sysprep: --dump-pod, --dump-pod-options

Since --debug-gc is now really considered internal, it is no more
documented.
2016-07-14 10:58:56 +02:00
Pino Toscano
0f7bf8f714 OCaml tools: add and use a Getopt module
Add a new Getopt module to mllib, to parse command line arguments with
handlers close to the ones used with Arg, but using getopt(3) (actually
getopt_long_only) to do the real parsing.  This allow us to provide
options for OCaml tools with a syntax similar to the C tools, and use
the additional features getopt offers and Arg does not.
Getopt now handles every part of the command line handling, including
the output of short & long options.

Do a single-step conversion of Common_utils and all the OCaml tools to
the syntax of Getopt.

Move a couple of utility functions from Common_utils to Getopt, since
they fit better there (and Common_utils cannot be used in Getopt, as
the former already uses the latter).

As side-change due to the conversion, extra arguments for sysprep
operation can have more keys for the same argument.
2016-07-13 18:43:32 +02:00
Pino Toscano
cbf4bbf266 i18n: fix markups in Japanese translation
Avoid extra spaces in L<>, they cause the POD to be invalid.
2016-07-13 18:15:26 +02:00
Richard W.M. Jones
c168638ae7 builder: Add CentOS aarch64 image. 2016-07-13 12:59:52 +01:00
Richard W.M. Jones
6dc3a59e73 Upload and download files to Zanata. 2016-07-12 21:43:31 +01:00
Richard W.M. Jones
a468e8b92f p2v: Set LD_LIBRARY_PATH for "remote" virt-v2v process.
In previous commit c5f12e47e4 we changed
the PATH environment variable to run the locally built virt-v2v, not
the system-installed virt-v2v.

However this meant that we were running the locally built virt-v2v
against the system-installed libguestfs.so.0.  We also need to set
LD_LIBRARY_PATH.

Fixes commit c5f12e47e4.
2016-07-12 14:48:11 +01:00
Tomáš Golembiovský
e93d4ea320 v2v: Add support for Win2016 virtio drivers
Support virtio drivers for Windows Server 2016 once they are available.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-07-12 08:25:29 +01:00
Richard W.M. Jones
2c7f8e9c5f utils: Clarify why some uses of gnulib are OK and others not OK. 2016-07-11 19:11:01 +01:00
Richard W.M. Jones
56eb5f36f4 Revert "utils: Allow use of gnulib in this file."
This reverts commit 975eafe4ba.
2016-07-11 19:08:41 +01:00
Richard W.M. Jones
d272cee838 python: Don't generate calls with non-existent C optargs structures.
In the case where we are building a Python dist (which can be
distributed separately), we generated calls to non-existent optargs
structures if an API was once no-optargs but had optargs added.  A
typical error was this (library: 1.32.5, Python sdist: 1.33.42):

    guestfs-py.c: In function ‘guestfs_int_py_glob_expand’:
    guestfs-py.c:9648:40: error: storage size of ‘optargs_s’ isn’t known
       struct guestfs_glob_expand_opts_argv optargs_s;

This is a simple solution to this, although it has the possible
disadvantage that such functions will not be bound at all.
2016-07-11 18:33:05 +01:00
Richard W.M. Jones
1f650932e3 python: Add documentation to guestfs-python about using pip & virtualenvs. 2016-07-11 15:47:51 +01:00
Richard W.M. Jones
c56c6e9010 python: Fix python sdist.
Since commit 83e92b4a97, utils.c
includes "ignore-value.h".  We copy utils.c into the python sdist
tarball, but it didn't not compile because of the missing header file.
Therefore we need to copy the header in too.

Fixes commit 83e92b4a97.
2016-07-11 15:46:23 +01:00
Richard W.M. Jones
4140766460 v2v: Document ports, firewall and proxy settings used by vCenter. 2016-07-11 13:39:23 +01:00
Richard W.M. Jones
711c4c923d Version 1.33.42. 2016-07-09 09:36:58 +01:00
Maxim Perevedentsev
4e0dbf94e7 sysprep: fix btrfs subvolume processing in fs-uuids
guestfs_set_uuid wants device as argument.
Moreover, btrfstune -U is unable to set uuid for subvolumes,
only unmounted partitions are supported.

Here we skip btrfs subvolumes.
2016-07-08 13:21:42 +01:00
Maxim Perevedentsev
f90185dfdf lvm: modify guestfs_is_lv to take mountable
Calling guestfs_is_lv on btrfs subvolume throws an error.
Here we workaround it by taking Mountable instead of Device
and returning 'false' for non-device mountables.
2016-07-08 13:21:42 +01:00
Maxim Perevedentsev
d6bba9bc42 mllib: add checking for btrfs subvolume
This is needed to skip btrfs subvolumes from output
of list_filesystems where device is needed.
2016-07-08 13:21:42 +01:00
Matteo Cafasso
abf85b050e filesystem_walk: more information into tsk_dirent
Access, modification, last status change and creation time in
Unix format as for statns.

Number of links pointing to a given entry.

If the entry is a symbolic link, report the its target path.

A new flag (DIRENT_COMPRESSED 0x04) indicating whether the file is
compressed using native filesystem compression support.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-07-08 12:08:17 +02:00
Richard W.M. Jones
123dc018b8 mllib: Rename unshift -> push_front, push -> push_back etc.
The C++ function names are more regular.

Updates commit 1c57c71d46.
2016-07-08 09:56:47 +01:00
Richard W.M. Jones
1a3e986b61 builder: Add Fedora 24 (aarch64) image. 2016-07-07 20:36:42 +01:00
Richard W.M. Jones
7d99c2eb84 builder: downloader: More tweaks to curl code.
No functional change.
2016-07-07 18:22:09 +01:00
Richard W.M. Jones
560156d899 v2v: Use imperative list functions to simplify DOM building code. 2016-07-07 18:13:07 +01:00
Richard W.M. Jones
6a3416361b v2v: Don't open DOM module in output_rhev and output_vdsm.
I think this is left over from before we moved the OVF code
out to its own module.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
442092a305 Replace 'xs := x :: !xs' with 'unshift x xs'.
In one case, I used prepend instead.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
e84382e9f8 builder, v2v: Use imperative list functions to simplify curl arg code.
No functional change in this commit.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
1c57c71d46 mllib: Add some imperative list manipulation functions.
This adds imperative list manipulation functions inspired by Perl.
The functions are passed list refs which get updated in place.

This allows us to replace some awkward pure functional code like:

  let xs = ys in
  let xs = if foo then xs @ zs else xs in

with:

  let xs = ref ys in
  if foo then append xs zs;
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
906c05c70f builder: Use the new Curl module for passing parameters to curl.
These are now passed using a curl configuration file, which is a
little bit safer than using command lines.  virt-builder doesn't need
to pass usernames and passwords to curl, but if it ever does in future
this will be a lot safer.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
20509df94e curl: Change the API to use an abstract data type.
Change the Curl module to use an ADT to store the name of the curl
binary and the arguments.

The callers in virt-v2v are changed accordingly.

This also adds a (currently unused) ?proxy argument to allow callers
to override the proxy.  It also adds some safety arguments implicitly.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
10e096c063 v2v: Move Curl wrapper to mllib.
Just code motion, no change.
2016-07-07 18:13:07 +01:00
Richard W.M. Jones
b35819d990 v2v: changeuid: Improve error messages. 2016-07-07 18:13:07 +01:00
Pino Toscano
9fa8e07465 daemon: fix cleanup of stringsbuf usages
Declare most of the stringsbuf as CLEANUP_FREE_STRINGSBUF, so they are
freed completely on stack unwind: use take_stringsbuf() in return
places to take away from the stringsbuf its content, and remove all the
manual calls to free_stringslen (no more needed now).
This requires to not use free_stringslen anymore on failure in the
helper functions of stringsbuf, which now leave the content as-is (might
be still useful even on error).

This allows us to simplify the memory management of stringsbuf's, which
are not properly fully freed, fixing memory leaks in some error paths
(which were not calling free_stringslen).
2016-07-07 16:28:18 +02:00
Pino Toscano
6a06b87559 daemon: free the string on stringsbuf add failure
If add_string_nodup fails free the passed string instead of leaking it,
as that string would have been owned by the stringbuf.

Adapt few places to this behaviour.
2016-07-07 16:27:36 +02:00
Richard W.M. Jones
d061b67410 Version 1.33.41. 2016-07-06 14:57:06 +01:00
Richard W.M. Jones
70faafddba v2v: Fix documentation, [--in-place] -> I<--in-place>.
Fixes commit 9221ef6f79.
2016-07-06 13:05:05 +01:00
Richard W.M. Jones
9cf220e73e inspection: Find icon in Windows 7 64 bit guests (RHBZ#1352761).
We have to download the old 32 bit explorer.exe in order to find the
icons as the 64 bit version doesn't contain any icons (where are they?).
Thus prefer the 32 bit (WoW64 subsystem) directory if found.

Fixes commit 7f16c346bb.

Thanks: Xiaoyun Hu
2016-07-06 13:05:05 +01:00
Richard W.M. Jones
4e806c4bd2 inspection: Find Ubuntu logo from an alternate location (RHBZ#1352761).
The current location doesn't exist unless you've installed GNOME,
which is not so common on Ubuntu.  Unfortunately I couldn't find any
other location containing a clean, high quality logo.

This adds another low quality icon source, and also prevents any icon
being returned if the highquality flag was set (note this prevents
virt-manager from displaying an icon, but there's nothing we can do
about that, and it's no worse than the current situation).

Updates commit 1d0683964f.

Thanks: Xiaoyun Hu
2016-07-05 14:01:33 +01:00
Richard W.M. Jones
d6744dac60 p2v: Remove p2v.debug option from test command lines.
Fixes commit 0c04919f50.
2016-07-02 10:16:55 +01:00
Richard W.M. Jones
0c04919f50 p2v: Remove the Enable debugging option, -v, p2v.debug.
This is now enabled by default and cannot be changed/disabled by the
user.  The output is saved into /tmp/.../virt-v2v-conversion-log.txt
on the conversion server.
2016-07-02 10:01:09 +01:00
Pino Toscano
88be0a237f v2v: fix priority of match in configure_kernel_modules
This makes sure that in the internal configure_kernel_modules function,
for virtio or SCSI block types:
a) the warnings about leftover Xen modules are printed
b) the changes in Augeas are saved

Fixes commit ee02191483.
2016-07-01 18:13:01 +02:00
Pino Toscano
d4dfa47158 v2v: fix and implify the internal Convert_linux:discover_modpath
First check for the existence of the directory /etc/modprobe.d, in case
using a file under it; this also skips all the other checks, since they
are not needed at all.  Also /etc/modprobe.d exists on recent Linux
versions, so let's give priority to the more common methods.
When /etc/modprobe.d does not exist, check for the file to edit using a
single list of possible files, now in order of priority, where the first
find is used without checking further for the rest.

Also, make sure all the returned paths are absolute: they are used in
Augeas paths later on, so relative paths will not do anything useful.
2016-07-01 18:13:01 +02:00
Pino Toscano
026992d58d docs: fix link to csvtool
Refer to the new home of the OCaml csv module.

Thanks to: Yehuda Zimmerman.
2016-07-01 15:49:17 +02:00
Richard W.M. Jones
30b728bc3b Version 1.33.40. 2016-07-01 12:22:05 +01:00
Richard W.M. Jones
87131d8681 p2v: Send ^C to remote end to cancel the conversion.
We are now able to cancel the conversion instantly by sending ^C to
the remote virt-v2v process.

Also, this reverts:
"p2v: Poll to make Cancel Conversion button more responsive."
(commit 6da4941db7)
2016-06-30 14:38:20 +01:00
Richard W.M. Jones
fa6402a0f8 p2v: ssh: Set cooked mode on the ssh session which runs virt-v2v. 2016-06-30 14:38:20 +01:00
Richard W.M. Jones
6d9bac80b2 p2v: Use 'scp' to copy the files to remote debugging directory.
Previously we copied / creates files in the remote dir by running
complex shell commands like:

  cat > file <<'EOF'
    ## the file was copied in here
  EOF

This was a little hairy, but in particular it doesn't allow us to set
the ssh session to cooked mode (so we can send ^C to cancel a
conversion).

A cleaner way to do it is to use 'scp' to copy the files over.
2016-06-30 14:38:20 +01:00
Richard W.M. Jones
c2fab43dd6 p2v: Set an SSH error message if mexp_spawnv fails. 2016-06-30 13:53:31 +01:00
Richard W.M. Jones
9445a4da17 p2v: miniexpect: Add mexp_send_interrupt, mexp_spawnvf, mexp_spawnlf and various flags. 2016-06-29 21:21:40 +01:00
Richard W.M. Jones
3390df44d3 miniexpect: Set signals to defaults and close other file descriptors after forking. 2016-06-29 15:22:29 +01:00
Richard W.M. Jones
b15b6e69e3 p2v: Colourize kernel-conversion status messages from virt-p2v.
The messages that come "through" from virt-v2v are already colourized.
However the other messages are not.  This colourizes the ones
generated during kernel-mode conversions.

Note that because of the way journal/syslog works we have to write the
ansi_restore before the end of line, thus code like this:

 ansi_magenta (stdout);
 printf ("%s: %s", guestfs_int_program_name, data);
 ansi_restore (stdout);
 putchar ('\n');

This also adds a "Conversion finished successfully" message (in green).

Thanks: Ming Xie
2016-06-29 13:00:14 +01:00
Richard W.M. Jones
d2abfc7b48 utils: Move ansi_* functions to header guestfs-internal-frontend.h.
This is just code motion.
2016-06-29 12:49:46 +01:00
Richard W.M. Jones
3ac0aa8232 mllib: Add powerpc64 and powerpc64le to normalize_arch (RHBZ#1264835).
Add powerpc64 (ppc64) and powerpc64le (ppc64le) cases to the
normalize_arch function.  Also remove a few duplicate cases which are
already caught in the catch-all case at the end of the match.
2016-06-29 10:09:27 +01:00
Matteo Cafasso
2d65129e7e Reserve entries to tsk_dirent struct
Already implemented entries.

tsk_inode
tsk_type
tsk_size
tsk_name
tsk_flags

Easy ones to add.

tsk_atime_sec
tsk_atime_nsec
tsk_mtime_sec
tsk_mtime_nsec
tsk_ctime_sec
tsk_ctime_nsec
tsk_blksize
tsk_blocks

Further ideas.

tsk_nlink
tsk_link_name

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-28 22:09:36 +01:00
Richard W.M. Jones
b221863f22 p2v: Add more utilities to the virt-p2v ISO.
- iscsi-initiator-utils (open-iscsi), as a partial fix for RHBZ#1337052

- vi (Vim), to use as an editor inside the XTerm window.
2016-06-28 17:27:52 +01:00
Richard W.M. Jones
13307325e8 p2v: Remove trailing \n from fixed disks device box.
Fixes commit 6aba5a4944.
2016-06-28 13:38:34 +01:00
Richard W.M. Jones
cc38d62fdf p2v: Ensure messages are flushed through to the journal immediately (RHBZ#1229386).
In kernel conversion mode, we must ensure messages are flushed to the
journal as soon as they are received from virt-v2v, otherwise (now
that debugging is not the default) we won't see any messages at all
until the last moment.

Thanks: Ming Xie
2016-06-28 12:29:29 +01:00
Richard W.M. Jones
5f248dcd39 p2v: Add 'less' package to the ISO.
When running the xterm it is very useful to be able to do:

  dmesg | less
2016-06-27 15:42:30 +01:00
Richard W.M. Jones
2783f695ff p2v: Add --install option to virt-p2v-make-disk, virt-p2v-make-kickstart.
This allows you to install extra packages in the disk/ISO.  The
implementation of this option in virt-p2v-make-disk was particularly
simple and followed naturally from the previous commit.
2016-06-27 11:41:19 +01:00
Richard W.M. Jones
07137ea565 p2v: virt-p2v-make-disk passes through --no-warn-if-partition to virt-builder.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1342337#c4

Thanks: Junqin Zhou
2016-06-27 11:41:19 +01:00
Pino Toscano
de5c00eebf automake2junit.ml: sanitize logs, make it more conformant
- sanitize the logs, removing terminal color codes and carriage returns
- add an empty "properties" node
- put the log for skipped tests as "message" attribute, hoping it is
  read from there
- do not blacklist the log of test-virt-rescue.pl, which should not
  cause issues now
2016-06-27 11:52:35 +02:00
Richard W.M. Jones
0b836c40f2 p2v: Fix timeout error when connecting to unresponsive ssh server (RHBZ#1350363).
If an ssh server is completely unresponsive (ie. it doesn't even send
back ICMP errors), then eventually ssh times out after ConnectTimeout
seconds [ConnectTimeout is an ssh option].

Unfortunately the miniexpect timeout (default 60 seconds) was less
than ConnectTimeout so we never saw the ssh error.  Instead we would
see the internal error:

  remote server closed the connection unexpectedly,
  waiting for: password prompt

This commit sets the ssh ConnectTimeout to an explicit value, and sets
the miniexpect timeout to be 20 seconds larger than ConnectTimeout, so
that in most cases we will see the ssh error message before miniexpect
times out.

Thanks: Ming Xie for finding and diagnosing the problem
2016-06-27 10:34:10 +01:00
Richard W.M. Jones
40448d6d0d p2v: Make the conversion dialog slightly higher.
Otherwise the information pane is smaller than its content.
2016-06-24 22:28:40 +01:00
Richard W.M. Jones
9270a27650 p2v: Display serial number of fixed disks (RHBZ#855058).
Use "lsblk -o serial" to get the serial number of each fixed disk, and
if it is available display that in the GUI.
2016-06-24 15:30:34 +01:00
Richard W.M. Jones
6aba5a4944 p2v: Combine size & model columns into the device column.
In the GUI disks block, instead of using separate "Size" and "Model"
columns, combine that information into a markup column under "Device".

To make the GUI look consistent I also had to change the removables
"Device" column to be a markup column and embolden the device name
there too.
2016-06-24 15:30:33 +01:00
Richard W.M. Jones
68ff3ffd1d p2v: Refactor into get_blockdev_size and get_blockdev_model functions.
This is just refactoring, but it reveals and fixes a bug too.  The
size_gb field was left as NULL when the --test-disk option was used.
Apparently passing NULL to gtk_list_store_set is fine, but just in
case I replaced it with "".
2016-06-24 15:30:33 +01:00
Richard W.M. Jones
5ea62c57c4 Revert "p2v: add -x option to nm-online"
This reverts commit f51c0bc837.
2016-06-24 10:51:22 +01:00
Richard W.M. Jones
95448111d2 Version 1.33.39. 2016-06-23 23:10:07 +01:00
Richard W.M. Jones
82b74ed0bd v2v: windows: Fix priority of match statement which stopped Xen/Parallels code from being uninstalled.
Fixes commit c466d4cb92.
2016-06-23 14:51:58 +01:00
Richard W.M. Jones
7c52d86de9 virt tools: Use Sys.file_exists instead of clumsy open_in/close_in hack.
No functional change.

Fixes commit c466d4cb92.
2016-06-23 14:51:48 +01:00
Richard W.M. Jones
8f8a651e59 p2v: ssh: Improve consistency of error messages. 2016-06-23 14:28:44 +01:00
Richard W.M. Jones
323c3e20a4 p2v: Make the sudo error message actionable.
Updates commit 5b6a8e0862.
2016-06-23 13:52:46 +01:00
Richard W.M. Jones
9221ef6f79 v2v: Refuse to convert if < 1GB of free space in temporary directory (RHBZ#1316479).
The error you would see is:

  virt-v2v: error: insufficient free space in the conversion server temporary
  directory /var/tmp (853.8M).

  Either free up space in that directory, or set the LIBGUESTFS_CACHEDIR
  environment variable to point to another directory with more than 1GB of
  free space.

  See also the virt-v2v(1) manual, section "Minimum free space check in the
  host".

Also adds some documentation.

Thanks: Ming Xie and Xiaodai Wang
2016-06-23 13:45:22 +01:00
Richard W.M. Jones
d8a465a14c v2v: Rename check_free_space -> check_guest_free_space. 2016-06-23 13:28:49 +01:00
Richard W.M. Jones
a7fb3d601a v2v: Move calculation of overlay directory to common code.
There is a tiny functional change in this patch, since overlay_dir is
now always evaluated once (eg. even in --inplace mode), whereas
previously it was evaluated twice but only in copying mode.
2016-06-23 13:28:48 +01:00
Richard W.M. Jones
24130d7872 sparsify: Move statvfs wrapper function to mllib.
We wish to use this function in virt-v2v too, so move it to the common
directory.

No functional change.
2016-06-23 13:28:48 +01:00
Richard W.M. Jones
5e794b8607 p2v: Set LANG=C in the remote shell so we can match on error messages.
Since commit 5b6a8e0862 we are now
matching on error messages, and therefore we must set LANG=C.
2016-06-23 11:34:00 +01:00
Richard W.M. Jones
d41cf142e1 p2v: Force bash as the remote shell.
As described in the comment, this solves a number of problems with
non-standard remote configurations.

I tested this with:

 - tcsh
 - zsh
 - ksh

and all behaved correctly.
2016-06-23 11:33:44 +01:00
Pino Toscano
5b6a8e0862 p2v: improve error message for sudo with password
Print a better error message when the non-root user on the conversion
server requires a password to use sudo, and p2v is told to use sudo.

See also RHZ#1340809.
2016-06-23 11:07:18 +02:00
Richard W.M. Jones
32cc27bb61 generator: filesystem_walk APIs added in 1.33.39 (not .37).
Updates commit 3de8abac4a and
commit 19e7a52f8f.
2016-06-23 08:30:48 +01:00
Matteo Cafasso
19e7a52f8f New API: filesystem_walk
Library's counterpart of the daemon's internal_filesystem_walk command.

It writes the daemon's command output on a temporary file and parses it,
deserialising the XDR formatted tsk_dirent structs.

It returns to the caller the list of tsk_dirent structs generated by the
internal_filesystem_walk command.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
7d8fbde4b2 lib: Added filesystem_walk command tests
The tests check whether the filesystem_walk command is able to retrieve
information regarding both existing and deleted files.

A NTFS image is used as Ext3+ filesystems deletion is more aggressive
in terms of metadata removal.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
3de8abac4a New API: internal_filesystem_walk
- generator: Added tsk_dirent struct

The tsk_dirent struct contains the information gathered via TSK APIs.

The struct contains the following fields:
 * tsk_inode: inode of a file
 * tsk_type: type of file such as for dirwalk command
 * tsk_size: file size in bytes
 * tsk_name: path relative to its disk partition
 * tsk_flags: bitfield containing extra information
 * tsk_spare[1-5]: extra space for future usage

 - configure: Added libtsk compile-time check

Ensure libtsk is available at compile time.
If not, daemon routines depending on it won't be available.

 - API: internal_filesystem_walk

The internal_filesystem_walk command walks through the FS structures
of a disk partition and returns all the files or directories
which could be found.

The command is able to retrieve information regarding deleted
or unaccessible files where other commands such as stat or find
would fail.

The gathered list of tsk_dirent structs is serialised into XDR format
and written to a file by the appliance.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:43:51 +01:00
Matteo Cafasso
90e623d4c7 Code cleanup in daemon/sleuthkit.c
Adhere to coding standards.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:41:19 +01:00
Matteo Cafasso
434f617bdd Improve download_inode documentation string.
The download_inode does not require the disk to be mounted
in order to work.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-06-22 18:40:55 +01:00
Richard W.M. Jones
0421c5afa3 v2v: Add a regression test for floppy assignment (RHBZ#1309706). 2016-06-22 18:25:36 +01:00
Richard W.M. Jones
b9613acb94 v2v: Fix conversion of floppy removable devices (RHBZ#1309706).
The previous code treated floppy disks and CD-ROMs as the same kind of
thing, resulting in malformed libvirt XML.  You would see the
following error when importing a guest into libvirt:

  error: Failed to define domain from /tmp/v2vlibvirt063486.xml
  error: internal error: Invalid floppy device name: hdb

because we incorrectly generated this bogus libvirt XML fragment:

  <disk device='floppy' type='file'>
    <driver name='qemu' type='raw'/>
    <target dev='hdb' bus='ide'/>
  </disk>

This commit models floppy devices as a distinct type, occupying their
own bus ("/dev/fdX").  When writing to libvirt, we generate correct
XML fragments, looking like this:

  <disk device='floppy' type='file'>
    <driver name='qemu' type='raw'/>
    <target dev='fda'/>
  </disk>

Miscellaneous other changes were required in the code.  There is also
a regression test (see following commit).

Note this ignores floppy disks in '-o qemu' mode.
2016-06-22 18:25:36 +01:00
Richard W.M. Jones
044de389e7 builder: Add Fedora 24 images for x86-64, i686, armv7l.
aarch64 image isn't buildable at the moment because of
Anaconda bug RHBZ#1348980.

ppc64 & ppc64le images are not buildable because of delays updating
the Fedora mirrors.
2016-06-22 18:25:36 +01:00
Richard W.M. Jones
94e1504146 v2v: OVF: Add <BootOrder/> to the first drive.
This adds <BootOrder>1</BootOrder> to the first drive, which is
necessary to make the drive bootable (or would be necessary, if oVirt
hadn't implemented their own workaround for the OVF we were previously
generating).

https://bugzilla.redhat.com/show_bug.cgi?id=1308535#c11

This is not a full solution to the problem.  Really we should be
copying the boot order over from the source hypervisor, but that
requires extensions to libvirt as discussed here:

https://bugzilla.redhat.com/show_bug.cgi?id=1308535#c7

Thanks: Shmuel Melamud
2016-06-22 15:46:56 +01:00
Maxim Perevedentsev
6521be3aa7 ext: change e2fsck retcode processing during resize
e2fsck returns 1 in case of "file system errors corrected".
We treat it as success in normal e2fsck, but fail if e2fsck
is run by resize2fs.

Change 'manual' execution of e2fsck to dedicated function call.
2016-06-22 15:18:19 +01:00
Cédric Bosdonnat
62d23aa4f9 p2v: use yast2 lan on SUSE distros rather than NM
NetworkManager isn't provided on SLES. As yast2 lan is available on all
openSUSE / SLE distro, use it instead.
2016-06-22 13:26:13 +01:00
Richard W.M. Jones
e4e197bb86 builder: Use newly open sourced edk2 from Fedora, replacing kraxel's builds. 2016-06-22 12:47:20 +01:00
Richard W.M. Jones
27b3b2cf7d builder: Use a different mirror when building armv7l image. 2016-06-22 12:41:57 +01:00
Cédric Bosdonnat
f51c0bc837 p2v: add -x option to nm-online
On distros not running NetworkManager, use the nm-online -x parameter
to exit quickly. The network connection will be checked just after
anyway when attempting to connect to the conversion server using ssh.
2016-06-22 11:03:38 +01:00
Cédric Bosdonnat
9c0f547b02 p2v: add virt-p2v-make-kiwi to generate kiwi config
Kiwi is the tool used by openSUSE / SLES to generate many sort of
disk images. Add a virt-p2v-make-kiwi tool and his documentation to
geneate the p2v appliance kiwi configuration.
2016-06-22 11:02:44 +01:00
Cédric Bosdonnat
9507c79945 p2v: fix dependencies for SLES / openSUSE
Use the common denominator for SLES and openSUSE in the dependencies.
For example most of NetworkManager pieces and metacity aren't provided
on SLES.

ifconfig is in the net-tools-deprecated package in openSUSE Factory,
which means after openSUSE Leap 42.2. Older versions have it in the
net-tools package. Adding this complexity only to add ifconfig because
sysadmins prefer it isn't too good:  iproute2 is doing the job.
2016-06-22 10:58:45 +01:00
Richard W.M. Jones
10cbf35cbd p2v: Use a more specific password prompt regexp.
The password prompt is actually generated by the openssh client which
is under our control, so we can regexp match on the specific prompt
printed by openssh.  This also avoids mistaking any server-side
issue.net message for a password prompt (eg. if the server prints a
message like "all users must change their passwords today!")  which
would have prevented virt-p2v from logging in.
2016-06-22 10:53:37 +01:00
Richard W.M. Jones
c44ff0b789 p2v: Improve the error message when login fails (RHBZ#1348900).
This can fail because the username is wrong.  Also don't unnecessarily
reveal irrelevant implementation details in the error message, just
say the login failed.

Thanks: Juquin Zhou
2016-06-22 10:53:27 +01:00
Richard W.M. Jones
572b416468 Revert "aarch64: launch: libvirt: As a workaround, pass -cpu parameter to qemu."
Since libvirt bug https://bugzilla.redhat.com/1184411 is now fixed, we
don't need this workaround any longer.

This reverts commit 7e4b7a346a.
2016-06-21 14:20:20 +01:00
Richard W.M. Jones
c87eab35c0 p2v: Gtk 3 workaround for RHEL 7.
New enough to complain about gtk_widget_modify_font, not new enough to
have gtk_style_context.

Fixes commit ca6fea7616.
2016-06-21 14:11:57 +01:00
Richard W.M. Jones
b5725ef856 docs: internals: Fix cross-references to guestfs(3) man page. 2016-06-20 15:11:46 +01:00
Richard W.M. Jones
6da4941db7 p2v: Poll to make Cancel Conversion button more responsive.
Previously cancelling the conversion only set a flag, which was
checked when the run dialog displayed new output from virt-v2v.  When
virt-v2v was showing hundreds of debugging messages, this wasn't a
problem, but now that we are hiding those messages, cancelling the
conversion might mean a wait of seconds or minutes.

By polling (albeit infrequently) we can make the cancel button more
responsive.
2016-06-20 15:11:46 +01:00
Richard W.M. Jones
55a0ab845d p2v: Don't display libvirt XML and wrapper script on stderr.
Confusing for end users, and not necessary for debugging since those
files are saved on the conversion server.
2016-06-20 15:11:46 +01:00
Richard W.M. Jones
6f5abc9539 p2v: Display up to 50 lines of the virt-v2v conversion log on failure.
For some failures, 30 lines was not sufficient and only part of the
error was shown.  Increase the number of lines shown to 50.

This also colourizes the failure message, and prominently displays the
location of the full log.  The following message is now shown:

  *** virt-v2v command failed ***

  The full log is available on the conversion server in:
      /tmp/virt-p2v-20160620-sga9rhk7/virt-v2v-conversion-log.txt
  Only the last 50 lines are shown below.

  [followed by up to 50 lines of log]

Updates and fixes commit 7447fe2478.
2016-06-20 15:11:46 +01:00
Pino Toscano
44483e7eb3 inspect: recognize older PLD Linux versions
PLD Linux got /etc/os-release only in the recent 3.0 release; since
older versions have only /etc/pld-release, check for it to identify
the guest and get its version.
2016-06-20 14:22:16 +02:00
Richard W.M. Jones
6db1043342 Version 1.33.38. 2016-06-18 22:40:55 +01:00
Richard W.M. Jones
257f2cc6b4 p2v: Use absolute path in test.
Fixed because of change in commit 7447fe2478.
2016-06-18 21:47:21 +01:00
Richard W.M. Jones
ca6fea7616 p2v: Use a monospace font for the run dialog. 2016-06-18 21:16:54 +01:00
Richard W.M. Jones
7301c51da3 p2v: Add DejaVu Sans and Monospace fonts to the ISO.
Improves the general look of virt-p2v.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
7447fe2478 p2v: Don't display debugging messages in the run dialog.
Previously we displayed the complete output of virt-v2v in the run
dialog.  This output included all the debugging messages, and was very
long and confusing for users (especially we had false bug reports
about "errors" appearing in the debug output).

Only display stdout in the run dialog.  However make sure everything
(stdout and stderr) is still logged to the conversion log.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
514893b68b p2v: Use a wrapper script instead of long virt-v2v command lne.
Instead of constructing and directly executing a long virt-v2v command
line, build a wrapper script with the same command line and send it to
the remote server (stored in /<remote_dir>/virt-v2v-wrapper.sh).

This will make it a bit easier to construct more complex virt-v2v
wrappers.

Note this commit on its own is a simple refactoring and does not
change any functionality.
2016-06-18 21:16:54 +01:00
Richard W.M. Jones
5e8f820494 p2v: Use virt-v2v --colours option, support colour in the run dialog (RHBZ#1314244). 2016-06-18 21:16:52 +01:00
Richard W.M. Jones
b000d6bc68 virt tools: Add common --colours option.
This option (alternately spelled: --color, --colour, --colors, or
--colours) enables ANSI colour sequences output even if that would be
disabled becaues the output is not a TTY.
2016-06-18 21:15:59 +01:00
Richard W.M. Jones
5b131356e2 virt tools: Warnings are not errors, send them to stdout. 2016-06-18 21:15:59 +01:00
Richard W.M. Jones
bda1224b2b p2v: Fix size of run dialog window in Gtk 3.
Setting the size on the surrounding scrolled window works better.
2016-06-18 21:15:57 +01:00
Richard W.M. Jones
377bd8f921 p2v: Fix the rule for rebuilding windows.img.
Fixes commit 53ec66c7e2.
2016-06-18 19:56:38 +01:00
Richard W.M. Jones
fc292631da v2v: Be careful to send all debug messages to stderr.
The debug() function is already sending these to stderr, but in a few
places we were using printf.  Change those to eprintf, except for one
informational message which should have been using info().
2016-06-18 14:46:43 +01:00
Richard W.M. Jones
c5f12e47e4 p2v: Fix slow test so it runs our locally built virt-v2v.
The virt-p2v slow test tested the local virt-p2v.  However it ran
against the installed virt-v2v (and in fact would have failed if
virt-v2v was not installed).

This commit sets the environment up to run the locally built virt-v2v.

This is unfortunately quite a lot more complex than it should be.
There is no simple "set this environment variable" option in
sshd_config.
2016-06-18 11:47:13 +01:00
Richard W.M. Jones
87addfb440 p2v: test-virt-p2v-pxe.sshd_config is generated by awk, not configure. 2016-06-18 11:47:13 +01:00
Richard W.M. Jones
4f4f0f1fe9 p2v: Add a dialog confirming the user really means to cancel (RHBZ#1340464).
Thanks: Kean Li
2016-06-18 09:19:10 +01:00
Richard W.M. Jones
072cf26dc3 p2v: Disable the sudo button when the username is root. 2016-06-17 22:24:45 +01:00
Richard W.M. Jones
b0d2d697e0 p2v: Don't allow password & SSH identity URL fields to both be non-empty.
It makes no sense.  By setting one field to non-sensitive when the
other field is populated, we can avoid this happening, and also make
tabbing between the fields simpler.

As a consequence of making this change, I also got rid of the now
unnecessary explanatory text telling you to leave one field blank.
2016-06-17 21:36:31 +01:00
Richard W.M. Jones
e6a173d5d4 p2v: Hide the spinner in more cases when it is not running (RHBZ#1341564).
In particular if you hit the 'Test Connection' button when the server
name field was empty, you would still see a stopped spinner.

This updates commit 036a11f379.
2016-06-17 21:15:47 +01:00
Richard W.M. Jones
b92fe7a666 Version 1.33.37. 2016-06-17 15:13:49 +01:00
Richard W.M. Jones
02f648f656 p2v: Add various disk utilities to the virt-p2v ISO (RHBZ#855058). 2016-06-17 14:25:25 +01:00
Richard W.M. Jones
bb053d067d p2v: Fix 'run-virt-p2v-in-a-vm' so it boots the USB disk automatically.
Thanks: Stefan Hajnoczi for working out the right qemu incantation.
2016-06-17 13:24:22 +01:00
Richard W.M. Jones
762f24c1f3 p2v: In non-GUI mode, make sure the progress of virt-p2v is visible (RHBZ#1229386).
By changing the logging mode of the p2v.service unit, we can make sure
that the progress of virt-p2v is visible in non-GUI mode at the
console.

Since the output is now always shown on the console, there's no need
to print the journalctl command for following that output when the
user logs in.
2016-06-17 13:15:27 +01:00
Richard W.M. Jones
3c7c63e1dc p2v: Don't run X in non-GUI mode.
Even in non-GUI mode we were starting up the X server in the virt-p2v
ISO.  This is a waste of time and resources, so don't do it.
2016-06-17 13:15:17 +01:00
Richard W.M. Jones
784d8bd894 p2v: Tidy up long line in Makefile.am.
Just a whitespace change.
2016-06-17 13:15:17 +01:00
Richard W.M. Jones
e5fcda8a5a p2v: test-virt-p2v-pxe: Fix dependencies for rebuilding the image.
Not all dependencies were included, so some file changes (eg. to
launch-virt-p2v) would not rebuild the test image.
2016-06-17 12:25:51 +01:00
Richard W.M. Jones
896e1e191a p2v: Add run-virt-p2v-non-gui-conversion target.
This simulates doing a non-GUI conversion with virt-p2v being
downloaded over PXE.  Conveniently we already had a test that was
doing this, and this rule just runs the same test.
2016-06-17 12:15:20 +01:00
Richard W.M. Jones
8717a11012 p2v: ssh: Print ssh error if user gives invalid conversion server (RHBZ#1167916).
Instead of throwing away the ssh error and printing the generic
message "unexpected end of file waiting for password prompt", we
capture the ssh error and print it.  The user will see the ssh
diagnostic, eg. "No route to host".
2016-06-16 21:23:48 +01:00
Richard W.M. Jones
3dd3bba778 p2v: ssh: Don't send wrong password more than once (RHBZ#1227599).
For some reason I don't quite understand, in
commit fd82bb12fd if it got the password
prompt unexpectedly a second time then it would send the password
again, continually until ssh closed the connection because of too many
retries.

This obviously makes no sense.  If we get the password prompt back,
then we must have sent an incorrect password so abort the connection
and report the error at once.
2016-06-16 21:18:54 +01:00
Richard W.M. Jones
172b38014b ocaml: Use -safe-string option in OCaml >= 4.02.
In a follow up to the previous commit, enable the -safe-string option
when we detect the version of the compiler which supports this option.
2016-06-16 15:22:04 +01:00
Richard W.M. Jones
6e79a3c84d Convert source so it can be compiled with OCaml '-safe-string' option.
OCaml 4.02 introduced the 'bytes' type, a mutable string intended to
replace the existing 'string' type for those cases where the byte
array can be mutated.  In future the 'string' type will become
immutable.  This is not the default now, but it can be forced using
the '-safe-string' compile option.

This commit changes the code so that it could be compiled using
'-safe-string' (but does not actually make that change).

If we detect OCaml < 4.02, we create a dummy 'Bytes' compatibility
module ((nearly) an alias for the 'String' module).  The only
significant difference from upstream OCaml is that you must write the
'bytes' type as 'Bytes.t' in interfaces, apart from that everything
else should work.
2016-06-16 15:22:04 +01:00
Richard W.M. Jones
66856b6ba0 generator: Use common OCaml rules for building the generator too.
Updates commit a3cb12ab2c.
2016-06-16 15:22:04 +01:00
Andrea Bolognani
a2d0511904 builder: Fix description for --long option 2016-06-16 15:22:04 +01:00
Cédric Bosdonnat
cf137ef306 filesystems: don't try to get the size of btrfs subvolume
virt-filesystem -l tries to get the size of btrfs subvolumes, which
results in an error. Teach it to skip the subvolumes.
2016-06-15 17:52:48 +01:00
Richard W.M. Jones
2ecdc46114 mllib: Use Unix.F_OK instead of plain F_OK.
Removes this warning:

  File "common_utils.ml", line 826, characters 24-28:
  Warning 40: F_OK was selected from type Unix.access_permission.
  It is not visible in the current scope, and will not
  be selected if the type becomes unknown.
2016-06-14 18:55:31 +01:00
Richard W.M. Jones
bbb83aeccc generator: Remove unnecessary 'chars' function.
String.make can be used instead, and that function has been around
since at least RHEL 6 era OCaml.
2016-06-14 17:00:26 +01:00
Richard W.M. Jones
a88418621d v2v: OVF: Add new <Origin/> values for virt-p2v and HyperV.
See proposed change to oVirt: https://gerrit.ovirt.org/#/c/59147/
and RHBZ#1342398.

This enhances commit 9467777fdf.

Thanks: Shahar Havivi
2016-06-14 16:40:06 +01:00
Richard W.M. Jones
c9bfe1ee9b v2v: OVF: Add a comment about what happens for unknown <Origin/>. 2016-06-14 13:13:23 +01:00
Richard W.M. Jones
669e25049e sysprep: Add --network to enable the network (RHBZ#1345813).
In commit ae6f726ecc we started to use
the virt-customize code to replace various virt-sysprep operations.
This had the effect of adding many more possible operations to
virt-sysprep, but some of them (specifically --install) did not work
unless the appliance network is enabled.  It was not enabled in
virt-sysprep, so these operations never worked.

This change does NOT enable the network by default.  However it adds a
--network flag which may be used in conjunction with --install etc to
make those commands work.

In addition we now emit a warning for certain customize operations if
they fail and if the network is not enabled.  It will print:

  [   4.5] Installing packages: tcpdump
  Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
  Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was

  virt-sysprep: warning: the command may have failed because the network is
  disabled.  Try either removing '--no-network' or adding '--network' on the
  command line.

  virt-sysprep: error: yum -y install 'tcpdump': command exited with an error

(If the network is already enabled, or if the command is successful,
then the warning is not printed.)

Thanks: Xianghua Chen
2016-06-13 15:39:34 +01:00
Richard W.M. Jones
0b5c6174b8 customize: Give an error if --truncate-recursive path does not exist (RHBZ#1345809).
You will now see an error such as:

$ virt-customize -a centos-6.img --truncate-recursive /home/foo
[   0.0] Examining the guest ...
[  16.5] Setting a random seed
[  16.5] Recursively truncating: /home/foo
virt-customize: error: libguestfs error: find0: /home/foo: No such file or
directory

Thanks: Xianghua Chen
2016-06-13 15:17:46 +01:00
Richard W.M. Jones
07c34fa65f customize: Use C<> around parameter name in documentation.
Fixes commit a084758e83
and commit 7e8ed7cb21.
2016-06-13 15:17:46 +01:00
Richard W.M. Jones
e6adcae770 Version 1.33.36. 2016-06-13 10:46:31 +01:00
Richard W.M. Jones
dba54ec0a2 v2v: Fix get_firmware_bootable_device.
Commit 82df768514 breaks the regression
test for RHBZ#1232192 because g#part_list can return an error when
called on a completely blank disk.

By rewriting and simplifying the code using higher-order functions we
can avoid the need for the double-nested imperative loop and calling
g#part_list at all.

Fixes commit 82df768514.
2016-06-13 10:21:14 +01:00
Richard W.M. Jones
08f82f2e3d v2v: Allocate extra RAM to the appliance during conversion.
The 'semodule' command, called by the guest tools uninstaller, will
run out of memory with the default of 500MB
(https://bugzilla.redhat.com/426775).

Allocate a large amount of RAM, that will be at least 800MB, but scale
correspondingly on other architectures like ppc64 that have larger
memory requirements.

Thanks: Pavel Butsykin
2016-06-13 09:03:13 +01:00
Richard W.M. Jones
736cc8f8a9 mllib: Document open_guestfs identifier parameter.
Just a documentation fix.
2016-06-13 08:55:02 +01:00
Richard W.M. Jones
a3cb12ab2c ocaml: Move identical rules for building OCaml objects to common file. 2016-06-13 08:51:46 +01:00
Richard W.M. Jones
0321797c7a v2v: XML: Fold some over-long lines of code.
Just whitespace, no functional changes.
2016-06-12 22:08:09 +01:00
Richard W.M. Jones
ec63594b67 v2v: XML: Rename internal types.
This is a mostly mechanical renaming of the internal pointer types
used in the libxml2 bindings.  Also I have added a longer comment to
make the system clearer.
2016-06-12 22:08:03 +01:00
Pavel Butsykin
22190afce9 v2v: remove the 'graphicsmodedisabled' entry in ESP BCD
Guest tools for Windows in Parallels / Virtuozzo Server 6 contain a
paravirtualized video driver, which wants to take full control of the video
mode. To avoid excessive video mode switches in UEFI VMs it executes
"bcdedit /set {current} graphicsmodedisabled true".

When such a VM is imported into a QEMU/KVM-based hypervisor, the
standard video drivers in Windows do not set the video mode as they
expect it to have already been configured by the bootloader.  As a result,
the VM runs with black screen.

So patch the BCD store (which is a Windows registry hive with a special
structure, located on the EFI system partition) to clear this setting.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
2016-06-12 18:24:45 +01:00
Pavel Butsykin
82df768514 v2v: fill the list of the EFI system partitions
Store the list of EFI system partitions on the inspect object in order  to be
able to tune their contents later in the process.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
2016-06-12 18:24:45 +01:00
Richard W.M. Jones
3719d75098 docs: hacking: Small updates to virt-p2v code documentation.
Use Unicode box-drawing characters instead of ASCII art.

Reference virt-p2v manual for how virt-p2v works.
2016-06-12 18:24:45 +01:00
Richard W.M. Jones
09eeb04578 docs: hacking: Document how OCaml programs are compiled and linked. 2016-06-12 18:24:45 +01:00
Richard W.M. Jones
b8f1ea3fff v2v: DOM: Make 'doc' and 'element' types distinct.
No functional change, just enforces the distinct type for callers.
2016-06-12 18:24:45 +01:00
Pavel Butsykin
4d09ce2251 v2v: linux: uninstall Parallels tools
Guest tools for Linux in Parallels / Virtuozzo Server 6 come with a script
that can be used to uninstall them.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
2016-06-11 21:36:11 +01:00
Richard W.M. Jones
4df28a433a v2v: Whitespace change in DOM. 2016-06-10 22:24:38 +01:00
Richard W.M. Jones
9467777fdf v2v: OVF: Set <Origin/> field correctly based on source hypervisor.
https://bugzilla.redhat.com/show_bug.cgi?id=1342398#c6
2016-06-10 22:16:08 +01:00
Richard W.M. Jones
4ed70d558a ruby: tests: Give each test class and method a unique name.
'tc_410_close_event.rb' was not being run.  You could prove this by
simply inserting "exit 1" into that test.

The reason is unclear, but by renaming every class and method in the
tests to be unique, this ensures the tests are run.
2016-06-10 14:25:38 +01:00
Richard W.M. Jones
4d6899ee91 ruby: Print exceptions thrown by event callbacks. 2016-06-10 14:25:38 +01:00
Pino Toscano
35fa141522 get-kernel: use "auto" as real autodetection marker (RHBZ#1341984) 2016-06-08 16:12:49 +02:00
Richard W.M. Jones
0e0a350c02 p2v: Print full curl error when failing to fetch SSH identify URL (RHBZ#1343423). 2016-06-07 14:50:47 +01:00
Richard W.M. Jones
3064c85372 p2v: Add note about 403 Forbidden errors when serving id_rsa file (RHBZ#1343414). 2016-06-07 14:32:26 +01:00
Richard W.M. Jones
6425a8824b customize: Add --uninstall operation (RHBZ#1343375). 2016-06-07 12:19:24 +01:00
Richard W.M. Jones
a3ca5182d4 docs: hacking: Describe which order to look at directories.
When browsing the source code.
2016-06-06 15:50:27 +01:00
Roman Kagan
613a7e0884 v2v:windows: prevent Parallels drivers from loading at boot
Parallels proprietary hypervisor uses RDPMC as the hypercall
instruction.  As this instruction is supported since early P6 family,
the drivers didn't even bother to check for the presence of the
corresponding feature in CPUID.

In QEMU/KVM, however, this instruction triggers #GP unless the VM is run
with PMU (performance monitoring unit) enabled, which is often not the
case (due to its impact on perfromance and migratability).

So, to prevent crashes upon conversion, stop respective drivers from
loading by disabling the corresponding services.  Note that the services
are being disabled ("Start" value set to 4) rather than their node
removed, to avoid confusing the uninstaller which is scheduled to run
from a firstboot script.

In addition, prl_strg (storage filter driver) is unlinked from the
storage subsystem following the DelReg directive from its .inf file,
otherwise Windows crashes with BSOD 0x7b due to missing dependency of
the storage subsystem.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2016-06-06 15:21:26 +03:00
Richard W.M. Jones
ba5767d69e Version 1.33.35. 2016-06-06 11:50:15 +01:00
Roman Kagan
4c24531d90 v2v: copy all driver files into guest
Some virtio-win drivers contain more files than just *.{cat,inf,sys}.
They are filtered out currently, which prevents the drivers from being
installed by PnP.

Stop filtering driver files by extension, and copy all of them instead.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2016-06-04 17:13:51 +03:00
Richard W.M. Jones
3a231afcfa p2v: Add more authors who have worked on virt-v2v and virt-p2v.
Use this command as a starting point:

  git shortlog -s -- p2v v2v | awk -F'\t' '{print $2}' | sort -f

However note the above will include people who made only incidental
code changes, and also misses out QA team members, so the actual list
still has to be curated by hand.
2016-06-04 14:47:28 +01:00
Richard W.M. Jones
5bc56f4c6b docs: performance: Mention optimizations added in libguestfs 1.33, qemu 2.7 2016-06-04 14:41:45 +01:00
Richard W.M. Jones
2e5542a65e docs: hacking: It's the 'docs' subdirectory, not 'doc'. 2016-06-04 14:34:34 +01:00
Richard W.M. Jones
5f118f1dd2 docs: hacking: Move subdirectories list higher up in the file.
It's better to have this overview of how the code is arranged before
any details about modifying the code, since most people will be
reading code before writing.
2016-06-04 14:34:29 +01:00
Richard W.M. Jones
5d9db47033 docs: building: Document ./configure options. 2016-06-04 14:34:25 +01:00
Richard W.M. Jones
fe84ce8521 docs: building: Add a warning about running tests as root.
It's a really bad idea, don't do it.
2016-06-04 14:34:21 +01:00
Richard W.M. Jones
0e469badff docs: building: Fix link to RHEL sources.
These are now stored at centos.org, not at ftp.redhat.com.
2016-06-04 14:34:12 +01:00
Richard W.M. Jones
2eb1d849f2 docs: Remove imaginary '--enable-gcc-warnings' flag.
It doesn't actually exist.  Not sure if it did in some earlier
version, but it doesn't exist now.
2016-06-04 14:24:16 +01:00
Roman Kagan
9d920732a3 v2v: recognize Virtuozzo tools as Parallels tools
Recent updates of Virtuozzo Server 6 (fka Parallels Cloud Server 6) have
"Virtuozzo tools" instead of "Parallels tools" as their display name in
the corresponding Uninstall registry key.

Recognize those, too, and schedule their uninstallation on first boot.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2016-06-04 14:49:03 +03:00
Richard W.M. Jones
69e5410e62 fish: rc: Rewrite file descriptor send/receive.
On Linux 4.7.0 the old code was giving -EINVAL errors.  This rewrites
the code based on online sources, and it works on at least RHEL 7,
Linux 4.4 and 4.7.  Also checked with valgrind.
2016-06-03 21:47:04 +01:00
Richard W.M. Jones
8417eb4587 fish: rc: Fail hard if recvmsg doesn't receive a file descriptor.
Also some code reformatting.
2016-06-03 21:03:03 +01:00
Richard W.M. Jones
b2cc087e8f Version 1.33.34. 2016-06-03 14:52:18 +01:00
Richard W.M. Jones
c97ca67a5c mllib: Fix other places where Dev_t module must be linked to Common_utils.
Fixes commit df7a33768e.
2016-06-03 14:34:05 +01:00
Richard W.M. Jones
a7c4061a2e Version 1.33.33. 2016-06-03 13:05:08 +01:00
Richard W.M. Jones
f0a7c68146 v2v: Don't distribute binary v2v_unit_tests in EXTRA_DIST.
Because EXTRA_DIST included $(TESTS) this ended up distributing the
binary file v2v_unit_tests.

Unfortunately to fix this we need to list all the test scripts and
data files explicitly a second time, but there we are.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
9f3b6aa6e2 p2v: Place conversion server name and port side by side.
Just a small rearrangement of the UI.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
bf434bdb35 p2v: Add "XTerm" button which launches a terminal window. 2016-06-03 13:05:07 +01:00
Richard W.M. Jones
60d4b7f544 p2v: Add ifconfig to the ISO (RHBZ#1342447).
Suggested by Ming Xie.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
57dbad4bba p2v: Rename internal Makefile rule 'run-virt-p2v' -> 'run-virt-p2v-in-a-vm'.
Now there are two rules for running virt-p2v:

  make -C p2v run-virt-p2v-directly

  make -C p2v run-virt-p2v-in-a-vm

Updates commit f8cfdf274f.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
1507913168 p2v: Fix docs for new hot key to use when testing virt-p2v in a VM.
The QEMU hot key for choosing the boot disk has changed in qemu 2.6.0
so update the documentation to reflect this.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
57abf86676 p2v: Make run-virt-p2v rule depend on $(PHYSICAL_MACHINE).
Fixes commit f8cfdf274f.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
523a65b65f p2v: Pass special --iso flag when running in the ISO environment.
If this flag is not set (ie. we are doing local testing) then we
disable some dangerous features.  Currently this is just the "Reboot"
button, but may include other features in future.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
b2bd2beeb6 p2v: Allow virt-p2v to be built with Gtk 2 or 3.
Currently virt-p2v requires Gtk 2.  This commit changes virt-p2v so it
can be built with either Gtk 2 or 3.

By careful use of macros, this code should compile on both recent
Gtk 2 and Gtk 3.

With no other options, ./configure will now prefer Gtk 3 if it finds
it, or fall back to Gtk 2.  But you can control this by setting
'./configure --with-gtk=2|3|check|no' where the options mean:

  * --with-gtk=2 - Only test for Gtk 2
  * --with-gtk=3 - Only test for Gtk 3
  * --with-gtk=check - Check for Gtk 3 then Gtk 2 (default)
  * --with-gtk=no - Don't build virt-p2v

In the ./configure output you will see something like this:

  checking for --with-gtk option... 2
  checking for GTK... yes
  checking if we can build virt-p2v... yes, with Gtk 2
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
b5ea940d52 p2v: Remove GDK thread synchronization.
Gtk 3 deprecates the GDK thread synchronization locks (functions such
as gdk_threads_enter/gdk_threads_leave), and requires that you issue
all Gtk calls in the main thread.  To do this you have to restructure
any code that calls Gtk from other threads so it is wrapped in an idle
task, and so is run from the main thread.

This commit transforms the code in this way.

I found through experimentation that libxcb crashes noisily if you
issue any X11 calls (and hence any significant Gtk calls) when the GDK
thread sychronization initializer has been removed, so if there are
any remaining calls that are missed by this patch we should find out
about them quickly.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
53ec66c7e2 p2v: Add --test-disk option for testing conversions.
Use, for example:

  ./run virt-p2v --test-disk=$(pwd)/test-data/phony-guests/windows.img

to test conversions using a file of test data instead of the real host
/dev/sda.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
7274f11ad4 builder: Warn if --output is a host partition (RHBZ#1342337).
But allow the warning to be turned off using --no-warn-if-partition.

Ming Xie tried to create a bootable USB key using
'virt-p2v-make-disk -o /dev/sdX1'.  That works, but doesn't create a
bootable key because it puts everything into the first partition.

Emit a warning if someone tries to do this to try to prevent user
error:

  virt-builder: warning: output device (/dev/sdb1) is a partition.  If you
  are writing to a USB key or external drive then you probably need to write
  to the whole device, not to a partition.  If this warning is wrong then you
  can disable it with --no-warn-if-partition
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
df7a33768e mllib: Add Common_utils.is_partition function.
Returns true if the device is a host partition.

The only tedious bit of this patch is that now Common_utils depends on
Dev_t so we have to add extra objects every time something links with
Common_utils.
2016-06-03 13:05:07 +01:00
Richard W.M. Jones
dd2ce98d24 mllib: Add bindings for makedev(3), major(3) and minor(3). 2016-06-03 13:05:07 +01:00
Richard W.M. Jones
6358633bf2 p2v: Add --verbose option to virt-p2v-make-{disk,kickstart}.
For virt-p2v-make-kickstart this doesn't do very much.  But for
virt-p2v-make-disk it enables verbose mode in virt-builder which is
extremely useful for debugging problems.

Thanks: Ming Xie.
2016-06-02 14:16:38 +01:00
Richard W.M. Jones
036a11f379 p2v: Hide the spinner when it is not running (RHBZ#1341564).
Thanks: keanli
2016-06-01 12:05:32 +01:00
Richard W.M. Jones
2b67073432 p2v: Add missing ethtool dependency.
virt-p2v runs `ethtool --identify' command, but since the command was
not included in the ISO the command always failed.

Thanks: Ming Xie.
2016-06-01 11:54:03 +01:00
Pino Toscano
603f4f1c23 p2v: require a non-interative sudo (RHBZ#1340809)
Run sudo with -n (non-interactive), so it will fail right away when not
configured to not require a password.  This will avoid the connection to
time out.
2016-05-31 12:36:22 +02:00
Richard W.M. Jones
3e437d1671 p2v: Rebuild the virt-p2v disk image if dependencies.m4 changes.
Fixes commit f8cfdf274f.
2016-05-30 17:42:23 +01:00
Richard W.M. Jones
d3b2a5bbd2 p2v: Add xterm to the virt-p2v ISO.
You can run `xterm -display :0' at the virtual console in order to get
a shell in the graphical environment.

This is useful for debugging and doesn't have much overhead unlike
other terminals.
2016-05-30 17:42:23 +01:00
Richard W.M. Jones
af4502c95f p2v: Preserve and display the full version of p2v and v2v.
Fetch the full version from the remote virt-v2v, including the
--with-extra field, since that tells us which distro virt-v2v was
compiled for which is useful information.

Display this information in all debug output and dialogs.
2016-05-28 15:54:24 +01:00
Richard W.M. Jones
adef54ad1a p2v: Translate comments in About dialog.
Also make the translatable string more accurate.
2016-05-28 15:53:56 +01:00
Richard W.M. Jones
ffc53c318e p2v: More internal documentation. 2016-05-28 15:26:27 +01:00
Richard W.M. Jones
3c3472f3e5 p2v: Add Ming Xie (from QA team) to authors page. 2016-05-28 15:09:31 +01:00
Richard W.M. Jones
c20b06dc08 p2v/gui.c: Add internal documentation.
No functional change.
2016-05-28 14:34:58 +01:00
Richard W.M. Jones
a90343f1e9 p2v: Fix alignment issues in treeviews on right of conversion dialog (RHBZ#1340407).
Multiple cell alignment issues in the treeviews on the right of the
conversion dialog.  This particularly showed up when you had multiple
heterogeneous disks or network cards because the description cells did
not align nicely.

Thanks: Ming Xie.
2016-05-27 13:21:00 +01:00
Richard W.M. Jones
4bbdb85822 p2v: Update 'make run-virt-p2v' rule.
Use KVM, fallback to TCG.

Add more network devices so we can test the layout of that
dialog box.

Move the documentation into guestfs-hacking(1).

Updates commit f8cfdf274f.
2016-05-27 13:05:32 +01:00
Richard W.M. Jones
cb803ef37e Version 1.33.32. 2016-05-27 09:53:54 +01:00
Richard W.M. Jones
f8cfdf274f p2v: Add a 'make run-virt-p2v' rule which boots virt-p2v in a VM.
A convenience method instead of having to work out the right
qemu command line each time.
2016-05-26 19:04:34 +01:00
Richard W.M. Jones
25ffcc7d43 p2v: Disable SELinux in virt-p2v-make-disk.
The kickstart version of virt-p2v has SELinux disabled, so this is at
least consistent.  Mainly it avoids the very long relabel when the
disk boots first time.
2016-05-26 19:00:38 +01:00
Richard W.M. Jones
10b3065b89 p2v: Consolidate EXTRA_DIST and CLEANFILES into single lists.
No functional change.
2016-05-26 19:00:38 +01:00
Pino Toscano
0e1f12f2e1 osinfo: use guestfs_int_version_from_x_y to parse the os version
Make use of the common version code, and avoid a separate regexp.
2016-05-26 17:51:09 +02:00
Pino Toscano
03ce1a4e0c lib: qemu: use guestfs_int_version_from_x_y for qemu version parsing
Make use of the common version code, and avoid a separate regexp.
2016-05-26 17:51:09 +02:00
Richard W.M. Jones
7023f20830 aarch64: launch: Only pass gic-version=host when KVM is likely to be enabled.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=1339977
2016-05-26 16:30:49 +01:00
Pino Toscano
ea41945e88 customize: random_seed: avoid one file checking for existing files
When the random-seed file is found, then avoid checking its existance
again.
2016-05-26 15:15:40 +02:00
Pino Toscano
0f4dfa8282 dib: pass envvars also to extra-data.d scripts
Inject the variables passed via --envvars also when running extra-data.d
scripts.  This removes the need to exporting them before running
virt-dib.
2016-05-26 15:15:39 +02:00
Richard W.M. Jones
6cc640b558 Version 1.33.31. 2016-05-26 12:55:32 +01:00
Richard W.M. Jones
e516b85bd7 v2v: Add test-v2v-i-ova-subfolders test files to EXTRA_DIST.
Fixes commit 9de9300e8b.
2016-05-26 12:54:08 +01:00
Richard W.M. Jones
55e5150106 todo: Use query-qmp-schema. 2016-05-26 11:36:20 +01:00
Richard W.M. Jones
0c49869366 Revert "utils/boot-analysis: Make seabios optional in timeline."
The loss of SeaBIOS messages was actually caused by a bug in my code,
not a change in the boot process.

This reverts commit 6fa24e768a.
2016-05-25 13:42:21 +01:00
Richard W.M. Jones
6fa24e768a utils/boot-analysis: Make seabios optional in timeline. 2016-05-24 22:05:42 +01:00
Pino Toscano
9928296c1c inspect: get icon of ALT Linux guests
The icon is part of a documentation package, although it's the best hit
so far...
2016-05-24 18:49:53 +02:00
Pino Toscano
77ad2e1f18 customize: add support for the xbps package manager 2016-05-24 18:14:38 +02:00
Pino Toscano
5d1dfe89cd inspect: support the xbps package manager and its format
Associate the Void Linux distribution with it.
2016-05-24 17:54:47 +02:00
Pino Toscano
0251c0fcaa inspect: recognize the Void Linux distribution
Since Void Linux provides only an /etc/os-release with no VERSION_ID
field, then special-case it to avoid that the os-release parsing ignore
it.

This provides basic distro identification, and icon.
2016-05-24 17:54:47 +02:00
Pino Toscano
c0534db2cb inspect: allow single-number version in DISTRIB_RELEASE of lsb-release
When parsing lsb-release, allow a version number in the format "X" other
than "X.Y" for the DISTRIB_RELEASE key.

This fixes version parsing in Mageia 4 guests.
2016-05-24 15:32:43 +02:00
Pino Toscano
c605765c95 mllib: add a new run_command helper
Add a simple helper to run a command from a sequence of arguments,
without using a shell: this should help reducing the amount of quoting
ineeded, since arguments are passed straight as such.

Make use of it in the places currently using shell_command, and which
don't assume they can run anything (so no shell redirections, `env`,
etc).
2016-05-24 11:26:48 +02:00
Pino Toscano
d58b2437e4 mllib: move stringify_args from dib
Move the make_dib_args helper function to Common_utils as
stringify_args, so it can be used also within Common_utils itself.

This is mostly code motion.
2016-05-24 11:16:11 +02:00
Pino Toscano
f06b7dbe45 v2v: use common debug function where possible
Followup of commit 063af7f987.
2016-05-24 11:10:50 +02:00
Pino Toscano
a52ee88f88 mllib: add an helper shell_command
Add a simple shell_command, which is mostly a wrapper around
Sys.command but with logging of the command run.
2016-05-24 11:10:42 +02:00
Pino Toscano
3dad36dab2 mllib: make external_command echo the command executed
Add an optional parameter to disable this behaviour, so the Curl module
in v2v won't print user-sensible data (like passwords).
2016-05-24 11:10:15 +02:00
Cédric Bosdonnat
9de9300e8b v2v: handle subfolders in ova files
Some ova files like those produced by SUSE Studio have their ovf, mf
and other files inside a folder rather than at the root of the
tarball. Consider the paths relative to the ovf and mf files to cover
this case too.
2016-05-24 09:19:48 +01:00
Cédric Bosdonnat
c466d4cb92 v2v: add support for SUSE VMDP drivers
To add this support, two things are needed:
 * make the existing code searches for either the viostor
   or the SUSE VMDP (Virtual Machine Driver Pack) files.

 * add a firstboot script setting up VMDP.

Note that 2 firstboot scripts are intentionally added for the VMDP
setup. This is due to windows potentially rebooting after loading the
virtio block driver. It may happen that this reboot interrupts the VMDP
setup in the firstboot script, we thus make sure the setup is run a
second time in case it needs to finish the previous run.
2016-05-24 09:19:48 +01:00
Cédric Bosdonnat
07f7bfa608 customize: fix windows firstboot script
Sync the windows firstboot script with its linux brother. Also change
the main redirection to append to the log rather than overwriting it.
With this change, the firstboot script will resist reboots in the
executed scripts.
2016-05-24 09:19:48 +01:00
Pino Toscano
0a4aac0d08 appliance: add kpartx to the dib packages
Newer diskimage-builder versions run kpartx in root.d elements.
2016-05-23 18:20:43 +02:00
Richard W.M. Jones
50e1ae5aa0 Version 1.33.30. 2016-05-23 12:02:52 +01:00
Richard W.M. Jones
d5cd752e25 v2v: Fix unit tests for new UEFI paths.
Fixes commit f755918fb5.
2016-05-23 12:00:28 +01:00
Richard W.M. Jones
063af7f987 ocaml tools: Use a common debug function.
Add a common debug function for printing debugging messages.  It only
emits the debug message when the verbose (-v) flag is used on the
command line.

It sends the output to stderr, which is flushed immediately after the
message is printed (to help with debugging unexpected crashes).  There
are good arguments for sending the debug to either stdout or stderr,
and almost all existing debug messages replaced by this change went to
stdout.  However using stderr is consistent with libguestfs's own
debug messages which also go to stderr.

I only made simple changes to code of the form 'if verbose () then
printf ...'.  There are more places which could be changed in future.
In a few places I removed gettext calls since we probably should not
translate debug messages.
2016-05-23 10:30:56 +01:00
Richard W.M. Jones
87c18474b5 customize: Turn print into warning.
It is still only emitted if we are debugging in order not to cause
unnecessary alarm.  Note this code needs a better long term fix, this
is still a hack.
2016-05-23 10:30:56 +01:00
Richard W.M. Jones
1f09537a9c umask: Use /proc/self/status instead of unnecessary path computation.
Fixes commit 2feeeb8fb4.

Thanks: Roman Kagan.
2016-05-23 10:30:52 +01:00
Richard W.M. Jones
f755918fb5 uefi: Add new locations for UEFI files on Fedora (RHBZ#1338083).
Now that UEFI is fully open source the UEFI firmware can be included
in Fedora.  However the location is slightly different from the
location that was used by kraxel's out of distro firmware.  This
commit searches for UEFI files in the new location, falling back to
the old location (until the end of this year when we will drop it
entirely).

Thanks: Cole Robinson, Gerd Hoffmann (kraxel) & Microsoft for
relicensing the FAT code.
2016-05-23 10:12:04 +01:00
Richard W.M. Jones
1d79964bf7 utils: Move UEFI firmware lists to src/uefi.c.
Just code motion, no functional change.
2016-05-23 10:12:04 +01:00
Richard W.M. Jones
607b2b9b0c v2v: Remove unused and unimplemented Linux.install function.
This function did 'assert false' and was also never called
from anywhere else.  Delete it.
2016-05-23 09:59:21 +01:00
Richard W.M. Jones
2feeeb8fb4 umask: Use /proc/<PID>/status to read umask in Linux >= 4.7.
Since Linux 4.7, the process umask is available in /proc/<pid>/status.
See:
3e42979e65

Use this value if available, else fall back to the existing codepath
for Linux <= 4.6 and other Unix.
2016-05-23 09:59:21 +01:00
Richard W.M. Jones
7855f15ad9 v2v: windows: Minor documentation fixes.
Fixes commit 19f3689e5d
and commit ee02191483.
2016-05-21 15:40:56 +01:00
Richard W.M. Jones
a11dd820c7 src/version.c: Move internal documentation before includes.
The internal documentation generator only works if the file
description comment appears before the first #include line.

Fixes commit f277087d2a.
2016-05-20 21:03:49 +01:00
Pino Toscano
23ebc3d9eb tests: disable UUID change on ext journal_dev
Newer versions of e2fsprogs refuse modifying journal devices, causing
the test #1 of get_e2uuid to fail with:

  libguestfs: error: set_e2uuid: Cannot modify a journal device.

Since the test case just needs to verify get_e2uuid runs without
failing, run it without expecting a certain UUID set earlier.

Followup of commit da4812ab6b.
2016-05-20 13:27:40 +02:00
Pino Toscano
ff0a622a6f tests: fix --format in virt-customize
Only in very recent OCaml versions (or in Fedora) the Arg module
supports the --foo=bar syntax for options with arguments.  Do not
require it yet.

Fixes commit 64bb9edd52.
2016-05-20 13:21:15 +02:00
Cédric Bosdonnat
536ef6f34a customize: change windows firstboot path
Rename the C:\Program Files\Red Hat\Firstboot folder into the more vendor
independent C:\Program Files\Guestfs\Firstboot.
2016-05-20 10:48:50 +01:00
Cédric Bosdonnat
75fe93ea74 v2v: improve initrd search
To make sure we can also find the initrd on openSUSE and SLES, we need two improvements:
 * the initrd filename may not end with '.img'
 * don't use the version + release from the RPM data, rather from the
   /lib/modules/<version>/ path as we need to find it out anyway.
2016-05-20 10:39:58 +01:00
Cédric Bosdonnat
e9082ea4d9 v2v: rename RHEL 5 Xen input section into Xen in man
In virt-v2v man page the documentation on how to use RHEL 5 Xen as
input is generic enough to fit other Xen versions.
2016-05-20 10:39:58 +01:00
Cédric Bosdonnat
25848b59e5 v2v: document SUSE's Xen as a working input hypervisor 2016-05-20 10:39:58 +01:00
Cédric Bosdonnat
ee78c06b7f customize: add support for pvvxsvc
SUSE VMDP comes with a replacement for rhsrvany.exe named pvvxsvc.exe.
Check for either one of them instead of only rhsrvany.
2016-05-20 10:39:58 +01:00
Pino Toscano
1c9e808eee fish: generate test-prep.sh with generator
Generate test-prep.sh using the generator, so the prepared disk types
tested are the same as the ones configured in prepopts.ml.
2016-05-19 19:06:00 +02:00
Pino Toscano
d5b3f558e0 tests: remove remaining relative paths to binaries
Tests are run via the ./run binary, so all the binaries in the build
directory are available via $PATH already.

Followup of commit e85a976c5a.
2016-05-19 19:06:00 +02:00
Pino Toscano
64bb9edd52 tests: specify the image format when possible
When possible, make the disk image format explicit when invoking tools
or using add-drive. This avoids warnings from qemu about the unspecified
format for the image, and also makes qemu slightly faster (skipping the
disk image probing).
Tests checking the image probing are not touched.

This changes also:
- old-style invocations of tools (`$tool $filename`) into new style
  (`$tool -a $filename`)
- add-drive-ro/add-drive-with-if guestfish commands into add/add-drive
  with explicit readonly/iface arguments

There should be no change in the tests results.
2016-05-19 19:06:00 +02:00
Pino Toscano
b5c81b3e12 customize: fix ownership when creating ~/.ssh/authorized_keys (RHBZ#1337561)
When creating ~/.ssh and ~/.ssh/authorized_keys (in case they are
missing), change their ownership to the target user.  If not, they are
owned by root.
2016-05-19 19:06:00 +02:00
Pino Toscano
59690dfc04 customize: minor function factoring in ssh_key
Turn the snippet reading user information from /etc/passwd in a slightly
more generic function, so there is no need to copy&paste for other
details.

Mostly code motion.
2016-05-19 19:06:00 +02:00
Cédric Bosdonnat
89ae53ecdd appliance: skip /etc/mtab creation is already existing
At least on openSUSE and SLES, the /etc/mtab file is already existing.
Skipping the symlink creation in init removes one error message during
the appliance boot.
2016-05-19 19:06:00 +02:00
Cédric Bosdonnat
3bf7d307b6 Update packagelist for SLES and openSUSE
SUSE Linux Entreprise Server doesn't have dhcpcd and the hivex package
is not in the default repositories. Better use dhcp-client and
libhivex0.

openSUSE needs ntfs-3g and ntfsprogs packages.
2016-05-19 19:06:00 +02:00
Cédric Bosdonnat
bba9ea9d50 v2v: also search for windows virtio drivers in symlinks
To allow saving space in the package shipping the windows virtio
drivers, we can use symlinks between the drivers folders. For example
SUSE VMDP drivers are the same for Win8.1 and Win2012r2, one folder
is a symlink to the other.

To take advantages of this, find must use the -L flag.
2016-05-19 19:06:00 +02:00
Richard W.M. Jones
54629d3d34 p2v: Run udevadm settle when virt-p2v starts up. 2016-05-19 13:22:29 +01:00
Richard W.M. Jones
1817d9a966 lib: qemu: Memoize qemu feature detection.
qemu feature detection takes about 95ms on my laptop.  The overhead is
almost all due to the time taken by the glibc link loader opening the
170+ libraries that qemu is linked to (×2 because we need to run qemu
twice).

Fixing that is seriously hard work.

Therefore memoize the results of guestfs_int_test_qemu.

This is keyed on the size and mtime of the qemu binary, so if the user
changes the qemu binary (eg. setting LIBGUESTFS_HV) we discard the
memoized result and rerun the qemu commands.  There is also a
generation number so we can bump the generation in future versions of
libguestfs to invalidate all previously cached data.

The memo is stored in the supermin cache directory (eg. /var/tmp/.guestfs-*)
in the files:

  qemu.stat     Result of 'stat(2)' of the qemu binary
  qemu.help     qemu -help output
  qemu.devices  qemu -devices ? output

Note these files are only stored when using the 'direct' backend.  For
the libvirt backend, libvirt itself memoizes this data in its own
place.
2016-05-18 18:10:10 +01:00
Richard W.M. Jones
4e36f2fa9e lib: Move qemu testing code to a new module called 'qemu.c'.
This is code motion, but I have cleaned up and formalized the
interface between this module and other parts of the library.

Also this adds documentation to the interface.
2016-05-18 18:10:10 +01:00
Richard W.M. Jones
166ac594cc launch: direct: Capture and display maxrss of qemu subprocess.
The maxrss is described in getrusage(2) as "This is the maximum
resident set size used (in kilobytes).".  This lets us find out how
much memory qemu really used, and is useful for determining if memory
minimization techniques such as DAX are having any effect.
2016-05-18 18:08:56 +01:00
Pino Toscano
9b305eae29 drives: force format=raw for /dev/null dummy drives
When creating the dummy scratch disk for a /dev/null drive, force its
format as raw if it was not specified already.  After all, raw was
already the only format allowed for this kind of drives, so it makes
sense to specify the format explicitly and avoid the autodetection in
qemu.
2016-05-18 17:33:05 +02:00
Pino Toscano
3fb35e6627 inspect: switch to version struct for os major/minor version
Use the version struct in inspect_fs to hold the version of a
filesystem, adapting the inspection code to that.

Also, move the parts of the version parsing to helper functions of the
version struct, so common bits like parsing "X.Y" or "X" version strings
is done only once.
2016-05-18 15:02:27 +02:00
Pino Toscano
f277087d2a src: start unifying version handling
Introduce a new struct version with few helper functions for it: this
allows to "atomically" represent a version number, without different
variables to be used and checked together.

Add a initialization function from a libvirt-style version number, and
apply it for the qemu and libvirt versions in the direct and libvirt
backends.
2016-05-18 14:57:44 +02:00
Richard W.M. Jones
d6ec6e06d2 Version 1.33.29. 2016-05-17 21:31:44 +01:00
Richard W.M. Jones
613fe4c089 utils: boot-analysis: Make insmod message handling a bit more robust. 2016-05-17 15:35:20 +01:00
Richard W.M. Jones
8a4dcde16a appliance: Find udevd a bit faster.
Rearrange the paths that we check for udevd so that the systemd paths
are first.  Break from the loop as soon as we find udevd.
2016-05-17 15:35:20 +01:00
Richard W.M. Jones
db1f811b29 appliance: Reenable ACPI.
Previously I disabled ACPI because it was not necessary and was slow.
However measuring it again now, I can see no significant difference in
performance, and it is necessary if we are going to use DAX.

It's also useful to keep the appliance kernel state as similar to the
ordinary state, and setting acpi=off is a massive change to the way
that the kernel boots.

Therefore, reenable it.
2016-05-16 23:18:00 +01:00
Richard W.M. Jones
aec89b62be appliance: Move code for creating supermin appliance directory to tmpdirs.c.
This is largely code motion.
2016-05-16 23:18:00 +01:00
Richard W.M. Jones
2c474923b4 src/tmpdirs.c: Add internal documentation. 2016-05-16 23:18:00 +01:00
Richard W.M. Jones
bb9893ab51 launch: direct: Simplify -machine parameter.
Use the ADD_CMDLINE_PRINTF to simplify this code.  No functional
change.
2016-05-16 19:20:22 +01:00
Richard W.M. Jones
214ec3dee7 launch: direct: Break some long source code lines.
Just cosmetic, no functional change.
2016-05-16 19:20:22 +01:00
Pino Toscano
839ae5bcd5 btrfs_filesystem_show: work with btrfs < 4.3.1
Versions older than 4.3.1 output also the version string after the
output.  Ignore such line, since it isn't relevant to what
btrfs_filesystem_show needs.
2016-05-16 14:28:26 +02:00
Richard W.M. Jones
653e374ef6 inspection: Unquote UUID=.. or LABEL=.. before passing to findfs (RHBZ#1335671).
In /etc/fstab the UUID= or LABEL= field may be quoted.  Augeas returns
the field including the quotes, and we passed this directly to
guestfs_findfs_uuid or guestfs_findfs_label.  It happens that this
works on upstream findfs, although it doesn't work in RHEL 7.2.  The
correct thing to do is to remove the quotes before passing the UUID or
label to these functions.

Thanks: Thom Carlin for reporting the bug, Karel Zak for identifying
the change in behaviour in util-linux.
2016-05-16 12:39:25 +01:00
Richard W.M. Jones
e13334a1a2 v2v: Move the shell_unquote function to src/utils.c.
This function is useful outside virt-v2v so move it into the core
utilities library.

The function has been rewritten from OCaml into C, but it should be
functionally identical.
2016-05-16 12:39:25 +01:00
Richard W.M. Jones
12fb49c5dd build: Fix missing +=.
noinst_DATA is defined earlier in the Makefile.am, so we must
use the += operator to append to the previous value.
2016-05-16 12:39:25 +01:00
Richard W.M. Jones
1b35d1d225 mllib: Update documentation for qemu_input_filename.
Don't describe internally how the function works in the
public interface documentation, since that is misleading.
2016-05-16 11:33:41 +01:00
Richard W.M. Jones
1f4a0bd90d utils: boot-analysis: Avoid overflow when comparing large doubles. 2016-05-14 19:30:12 +01:00
Richard W.M. Jones
bf80587367 utils: boot-analysis: Add magic & asserts to some structs.
I suspected data corruption (but didn't prove it).  This commit just
adds some magic numbers to the structs so we will see data corruption
quickly if it happens again.
2016-05-14 18:46:36 +01:00
Richard W.M. Jones
12d8decfa9 launch: Use tsc=reliable.
This saves about 21ms per secondary CPU when using guestfs_set_smp.
2016-05-13 15:57:39 +01:00
Richard W.M. Jones
b6f5a0cd90 utils: boot-analysis: Make handling of first kernel message more flexible.
Allows us to disable EDD completely, and still have boot-analysis work.
2016-05-13 13:30:39 +01:00
Richard W.M. Jones
634f47e6d4 appliance: Copy /etc/ld.so.cache from the host into the appliance.
Previously we were running ldconfig to create /etc/ld.so.cache.

This is required, at least on Fedora, if we need to run any binary
that uses a library with a weird path.  libiscsi (a dependency of
qemu-img, used by virt-dib) is an example of such a weird library,
since it puts its single library into /usr/lib64/iscsi for no readily
understandable reason, and drops a configuration file into
/etc/ld.so.conf.d/ so that this new directory gets picked up.

By copying the /etc/ld.so.cache from the host we get an already
configured cache which should contain every library on the host, so
there is no need to run ldconfig.
2016-05-13 13:30:39 +01:00
Richard W.M. Jones
ba8e8d277d Revert "appliance: init: run ldconfig"
Running ldconfig adds about 100ms to the boot time.  I would prefer
that we understood which libraries need ldconfig to be run, and fix
that.  We could also consider running ldconfig in parallel, but since
it might be required by just about any binary that the init script
runs it's not clear what benefit that gives.

This reverts commit 66aa98265d.
2016-05-13 13:30:39 +01:00
Pino Toscano
e3d429d37d New API: btrfs-filesystem-show (RHBZ#1164765)
Add a new API to list all the devices where a btrfs filesystem is
spanned.
2016-05-12 17:14:11 +02:00
Pino Toscano
ddcd9c2a10 builder: run/schedule a SELinux relabel if needed
If the guest uses SELinux, then make sure to run a relabel (or at least
schedule one) after the image build: this way the template is
relabelled, or at least it will do that at the next boot, without the
need for the user to ask for a relabel.

This just covers the case of building a new image with no additional
operations on it though.
2016-05-10 15:11:54 +02:00
Richard W.M. Jones
754b8f5ef3 boot-analysis: Flush out debug data after printing it.
Just makes it easier to see bugs causing the analysis stage to
hang / infinite loop.
2016-05-10 12:17:28 +01:00
Richard W.M. Jones
e4edede364 boot-analysis: Make ftrace optional in the timeline.
This allows me to test minimal kernels with ftrace disabled at
compile time.
2016-05-10 12:16:36 +01:00
Richard W.M. Jones
320b0faeaf utils: boot-analysis: Fix minor typo in string. 2016-05-09 12:19:16 +01:00
Richard W.M. Jones
a608865cac Version 1.33.28. 2016-05-09 10:10:36 +01:00
Richard W.M. Jones
999df47160 src/utils.c: Update comment. 2016-05-09 09:21:53 +01:00
Pino Toscano
873560f495 perl: use INT2PTR macro for casting back to guestfs_h * (RHBZ#1150298)
Use the right macro, which should avoid the warnings seen with Perl
headers on some architecture.
2016-05-09 10:04:15 +02:00
Richard W.M. Jones
ea71e00d1a fish: Add internal documentation to several files. 2016-05-08 20:59:36 +01:00
Richard W.M. Jones
13017c852e lib: Rename test-utils -> unit-tests. 2016-05-07 12:46:49 +01:00
Richard W.M. Jones
4910a448f4 lib: Add more unit tests.
Add unit tests for the following internal functions:

 - guestfs_int_getumask
 - guestfs_int_new_command and other src/command.c functions
 - guestfs_int_qemu_escape_param
 - guestfs_int_timeval_diff
 - guestfs_int_match, match1, match2
 - guestfs_int_add_string and other src/stringsbuf.c functions

Because we now need to use a libguestfs handle, we have to link the
unit tests to the library.  But because we also need to access the
internal functions (to test them) we need to link the test statically
to the objects making up the library.  So this requires a small change
to the linking of this test too.
2016-05-07 12:40:50 +01:00
Richard W.M. Jones
c3ff4da088 src/stringsbuf.c: Add internal documentation. 2016-05-07 12:40:50 +01:00
Richard W.M. Jones
479828ccd0 src/test-utils.c: Add internal documentation. 2016-05-07 09:31:05 +01:00
Richard W.M. Jones
0ff9b808d9 src/conn-socket.c: Add internal documentation. 2016-05-07 07:44:47 +01:00
Richard W.M. Jones
b4f440e65a src/whole-file.c: Add internal documentation. 2016-05-07 07:38:24 +01:00
Richard W.M. Jones
cad516cae5 src/command.c: Add documentation markup. 2016-05-05 22:56:43 +01:00
Richard W.M. Jones
3965c9f56e lib: Turn qemu_escape_param into a shared function.
This function appeared twice (identically).  Turn it into a single
shared function.

This also adds some documentation for the two files affected.
2016-05-05 22:38:30 +01:00
Pino Toscano
f3c278474d inspect: check also /etc/hosts for detecting Linux root (RHBZ#1203898)
Use /etc/hosts as alternative of /etc/fstab to detect whether a partition
represents the root of a Linux installation; the latter might not exist
in smaller/special installations like Docker images.
2016-05-05 22:00:47 +01:00
Pino Toscano
48116cfb4e python: use constants instead of raw values
Extend the internal libguestfsmod module with the CREATE values, so
there is no need to hardcode values in GuestFS.__init__.
2016-05-05 22:00:47 +01:00
Pino Toscano
dc02e8985f tools: improve reporting for option errors (RHBZ#1316041)
Improve the error messages produced by C-based tools in case of issues
with the command line options:
- explicitly mention to use -a/-d (and -A/-D in virt-diff)
- when extra arguments are found, mention the correct way to pass
  options to certain command line switches (like --format)
- in virt-inspector, give a cleaner error message when neither -i nor
  any -m is specified

In all the cases, keep the extra notice to use 'TOOL --help' to get more
help with it.
2016-05-05 14:25:28 +02:00
Richard W.M. Jones
cd689c9d3a Version 1.33.27. 2016-05-04 18:20:20 +01:00
Richard W.M. Jones
ff7e755f95 utils: Add README to EXTRA_DIST.
Updates commit 3b581a727c
and commit bbec1b570b.
2016-05-04 18:16:26 +01:00
Pino Toscano
43358290b3 python: PEP 8: miscellaneous coding fixes
python/guestfs.py:136:37: E712 comparison to True should be 'if cond is True:' or 'if cond:'
python/t/tests_helper.py:42:8: E713 test for membership should be 'not in'

No functional changes, as the new versions follow the suggested Python
coding style to do the same things.
2016-05-04 18:56:01 +02:00
Pino Toscano
060b724c49 python: PEP 8: avoid whitespace-only lines in docstrings
Tweak the docstring generation to avoid lines with only indentation
spaces.

No functional changes, only whitespaces removals.
2016-05-04 18:56:01 +02:00
Pino Toscano
845d518b8b python: PEP 8: miscellaneous indentation fixes
Small fixes for few remaining indentation issues.

No behaviour changes.
2016-05-04 18:56:01 +02:00
Pino Toscano
6e34396661 python: PEP 8: avoid too long lines
Reindent Python scripts to make sure lines are not longer than 80
columns.

Regarding autogenerated code (guestfs.py and bindtests.py): add an
helper function to make sure comma-separated lists are wrapped at the
wanted length.

This produces only differences in the indentation of long Python lines,
with no behaviour changes.
2016-05-04 18:56:01 +02:00
Pino Toscano
d8337077e3 python: PEP 8: break compound statements
Avoid compound statements, simply indenting their blocks.

No functional changes.
2016-05-04 18:56:01 +02:00
Pino Toscano
2c7bba6374 python: PEP 8: remove trailing semicolons
Remove extra semicolons at the end of single-statement lines.

No behaviour changes.
2016-05-04 18:56:01 +02:00
Pino Toscano
f85e18f62f python: PEP 8: adapt empty lines
Add or remove empty lines to match the needed ones around
blocks/functions/etc.

This is just formatting, no behaviour changes.
2016-05-04 18:56:01 +02:00
Pino Toscano
6105ee0c71 python: PEP 8: adapt whitespaces in lines
Add (after comma) or remove (before opening round bracket, and around
'=' in arguments) whitespaces according to the PEP 8 specification.

This is just code reformatting, with no behaviour changes; no content
changed beside whitespaces, so "git diff -w" gives an empty diff.
2016-05-04 18:56:01 +02:00
Richard W.M. Jones
839a17ff04 docs: Document CVE-2015-8869 OCaml code gen bug. 2016-05-04 17:48:44 +01:00
Richard W.M. Jones
547662d9f6 customize: Improve the error messages when package manager is unknown or unsupported.
For Windows, we now print:

$ virt-customize -a ./test-data/phony-guests/windows.img --install MSSQL
[   0.0] Examining the guest ...
[  14.2] Setting a random seed
virt-customize: warning: random seed could not be set for this type of
guest
[  14.2] Installing packages: MSSQL
virt-customize: error: cannot use '--install' because no package manager
has been detected for this guest OS.

If this guest OS is a common one with ordinary package management then this
may have been caused by a failure of libguestfs inspection.

For OSes such as Windows that lack package management, this is not
possible.  Try using one of the '--firstboot*' flags instead (described in
the manual).
2016-05-04 17:48:25 +01:00
Richard W.M. Jones
5470f059c2 inspection: Set package manager to "unknown" if parsing major version failed (RHBZ#1332025).
In cases where parsing the release file failed and so we have an
obviously incorrect major version number, don't try to infer the
package manager from the major version number.

In the bug report, parsing the /etc/redhat-release file of a CentOS
7.1 guest failed, so major version was set to 0, and the package
manager was inferred as "up2date".  virt-customize then failed with a
peculiar error:

  virt-customize: sorry, don't know how to use --install with the 'up2date' package manager

Instead this sets it to "unknown" which will cause virt-customize to
fail with:

  virt-customize: --install is not supported for this guest operating system

which is (only very slightly) better.

Problem reported by novegin on IRC.
2016-05-04 14:09:50 +01:00
Richard W.M. Jones
d25e509317 Tag versions with "v<VERSION>" instead of just the version number.
This is the normal convention used for tagging git releases.
2016-05-04 14:09:50 +01:00
Richard W.M. Jones
a2ac6b4897 docs: Fix cross-references in guestfs-security(1).
Fixes commit 15b8b6453d.
2016-05-04 14:09:50 +01:00
Richard W.M. Jones
c585a5835b p2v: Fix misleading string in error message. 2016-05-04 14:09:50 +01:00
Richard W.M. Jones
28634ecc2c docs: Link to correct building instructions from guestfs-hacking(1).
No longer in the README file.
2016-05-03 22:54:14 +01:00
Richard W.M. Jones
d899a53f2e docs: Improve the internal documentation in guestfs-hacking.
Several mostly cosmetic changes.
2016-05-03 22:50:15 +01:00
Richard W.M. Jones
a8114449fa docs: Move internal documentation to guestfs-hacking(1).
All developer documentation should go in guestfs-hacking(1) and the
"internal documentation" (ie. documentation about internal functions
and interfaces) belongs here, not in the coincidentally synonymous
guestfs-internals(1).
2016-05-03 22:50:15 +01:00
Richard W.M. Jones
bbec1b570b utils: Add a README file describing briefly the purpose of this directory.
.. and where to find the real documentation.

Updates commit 3b581a727c.
2016-05-03 22:50:15 +01:00
Richard W.M. Jones
6b48977cb7 Version 1.33.26. 2016-05-03 14:49:59 +01:00
Richard W.M. Jones
b1c945195c po: Use xgettext --from-code=utf-8
Since moving boot-benchmark-range.pl out from under a tests/
subdirectory, it is now being added to po/POTFILES.  This causes the
following error:

/usr/bin/xgettext: Non-ASCII string at utils/boot-benchmark/boot-benchmark-range.pl:205.
                   Please specify the source encoding through --from-code.

Add --from-code parameter as instructed.
2016-05-03 14:39:03 +01:00
Richard W.M. Jones
5bbf8f655d Version 1.33.25. 2016-05-03 14:13:01 +01:00
Pino Toscano
ae3224cf8a customize: remove "core" from description of --update
--update invokes a distribution update, updating all the installed
packages and not just some "core" ones.
2016-05-03 14:25:46 +02:00
Pino Toscano
e77faf7f61 mllib: add "internal" to the description of --{short,long}-options
The Arg module of OCaml does not support hiding options from the --help
output: hence, mark --short-options and --long-options as internal
options, since we need them only for the bash completion scripts.
2016-05-03 14:25:46 +02:00
Richard W.M. Jones
a3bc0e13f6 build: Don't use noinst_MANS.
Automake doesn't run noinst_MANS rules at all, likely a bug.

Use noinst_DATA instead which is always run during the build.
2016-05-03 13:21:34 +01:00
Richard W.M. Jones
98b28b15c6 utils/boot-analysis, utils/boot-benchmark: Add manual pages. 2016-05-03 13:21:34 +01:00
Richard W.M. Jones
3b581a727c utils: Move tests/qemu/ boot-analysis etc tools to new utils top level directory.
Create a new top level directory called 'utils' and move the
following programs there:

  tests/qemu/boot-analysis -> utils/boot-analysis/
  tests/qemu/boot-benchmark -> utils/boot-benchmark/
  tests/qemu/qemu-boot -> utils/qemu-boot/
  tests/qemu/qemu-speed-test -> utils/qemu-speed-test/

Also we only build the boot-analysis program on x86-64 and aarch64,
since it requires custom porting to each architecture.
2016-05-03 13:21:34 +01:00
Richard W.M. Jones
c34995c6b3 launch: Add cryptomgr.notests to the appliance command line.
Save 28ms by not running the crypto self-tests when Linux boots.
2016-05-03 13:21:34 +01:00
Pino Toscano
1f5054daa8 php: Fix the tests yet again.
Move unsetting of LIBGUESTFS_DEBUG & LIBGUESTFS_TRACE into the
php-for-tests.sh wrapper.

Fixes commit 0d69eab98f.
2016-05-03 13:21:34 +01:00
Richard W.M. Jones
915f6e299e Revert "php: Fix the tests ... again."
This reverts commit 0d69eab98f.
2016-05-03 13:21:34 +01:00
Pino Toscano
4760d80c93 appliance: move btrfs-progs as common package
Recently Debian switched to btrfs-progs, so almost all the distributions
(except openSUSE) have btrfs-progs which is then moved as common
package.
The old btrfs-tools name is left there, to support Debian Jessie and
older, and Ubuntu Xenial and older.
2016-05-03 13:03:45 +02:00
Richard W.M. Jones
51cea56d1c Version 1.33.24. 2016-04-30 17:20:39 +01:00
Richard W.M. Jones
9cd00805b0 tests/qemu: boot-analysis: Display libvirt as distinct source.
Don't display libvirt events as '[library]', but as '[libvirt]'.
2016-04-30 16:42:24 +01:00
Richard W.M. Jones
2fd05203e4 tests/qemu: boot-analysis: Dump pass data times in ms, with diffs.
When (in --verbose mode) we dump the pass data, dump the times in
milliseconds (instead of nanoseconds) so they are consistent with
other output.  Also dump the time difference from the previous event.

Useful for detailed debugging/analysis of problems.
2016-04-30 16:02:30 +01:00
Richard W.M. Jones
66447f4e29 aarch64: Use AAVMF_CODE.verbose.fd when debugging is enabled.
When we are debugging use the verbose (debug messages enabled) version
of the AAVMF (UEFI) firmware.  This is useful for diagnosing what is
causing failures to boot and what inside UEFI is causing slow booting.
2016-04-30 15:49:58 +01:00
Richard W.M. Jones
f7381470bb v2v: Add unit tests of the Utils UEFI functions. 2016-04-30 15:41:26 +01:00
Richard W.M. Jones
5253d2367b utils: Use struct for UEFI firmware.
Use an array of structs for the UEFI firmware instead of an array of
strings.

This change is hopefully just refactoring and there is no functional
difference.
2016-04-30 15:17:08 +01:00
Richard W.M. Jones
03e2d00036 appliance: Add pciutils to the appliance.
This adds the 'lspci' program, useful for debugging
appliance / qemu problems.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
d76129aa0c launch: Don't initialize all UARTs (serial ports).
This doesn't save very much time, perhaps under 1ms, but it avoids
some useless scanning.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
2b9f58f87b launch: libvirt: Add a /dev/urandom-based virtio-rng device to the appliance.
It is safe to use /dev/urandom to seed the guest.  In libvirt 1.3.4
this silly restriction has been lifted.

This restores commit b2c845333f.
See also commit 9423c16607.

Thanks: Cole Robinson for doing the libvirt implementation.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
e080e5909e launch: libvirt: Add libvirt version to the data struct.
This commit just allows us to make XML features conditional on the
libvirt version, but has no other functional change.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
29cb8d60d2 launch: Disable USB in the appliance.
Only saves a tiny amount of time, but as we don't use USB
we might as well disable it.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
1beab198b9 ocaml: Add LDFLAGS to mlguestfs.cma/mlguestfs.cmxa.
Encode the build LDFLAGS into the OCaml library.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
b2464e07de v2v: Add a slow test to ensure trimming doesn't regress (RHBZ#1264332). 2016-04-30 12:49:28 +01:00
Richard W.M. Jones
5ec42a6238 v2v: OVF: Better mapping for inspection data to vmtype.
The old mapping code was directly copied from old virt-v2v, translated
from Perl to OCaml.

The new mapping code does a few things more accurately:

 - Use the i_product_variant field (Windows InstallationType) if available.

 - Simplify rules, so there is only one special case needed for RHEL 3/4.

 - Don't assume Fedora == Desktop.

 - Don't assume all later Windows variants are server.

 - Works for Windows > 7.
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
3a6636fc05 v2v: Remove the --vmtype option.
It will now print a warning but is otherwise ignored:

  virt-v2v: warning: the --vmtype option has been removed and now does
  nothing

See:

  https://www.redhat.com/archives/libguestfs/2016-April/msg00178.html
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
b81e8ef162 v2v: Remove --no-trim option.
It will now print a warning but is otherwise ignored:

  virt-v2v: warning: the --no-trim option has been removed and now does
  nothing

See:

  https://www.redhat.com/archives/libguestfs/2016-April/msg00178.html
2016-04-30 12:49:28 +01:00
Richard W.M. Jones
d5c40262fa tests/qemu: boot-analysis: Port this program to aarch64 (using UEFI). 2016-04-30 12:45:54 +01:00
Richard W.M. Jones
606f158606 tests/qemu: boot-analysis: Add analysis of initcalls before entering userspace. 2016-04-28 13:35:27 +01:00
Richard W.M. Jones
63915b69f1 Version 1.33.23. 2016-04-24 19:21:34 +01:00
Richard W.M. Jones
7f572434f0 tests: Add tests/qemu/boot-benchmark-range.pl to EXTRA_DIST.
Updates commit 8299d7087a.
2016-04-24 19:21:34 +01:00
Richard W.M. Jones
90aacea2ac ja: Fix unclosed L<> which breaks POD.
Since commit b23e149774, we have been
strict about POD errors.  An error in the Japanese translation caused
"L</guestfish" (ie. an unclosed L<>) to appear in the POD.

This commit fixes the problem, but when building you may need to do:

  rm po-docs/ja/guestfish.pod
  rm po-docs/podfiles; make -C po-docs update-po

in order to update the broken po-docs/ja/guestfish.pod file.

Unfortunately I have been unable to upload this change back to the
Zanata servers because of a variety of client problems.
2016-04-24 19:21:04 +01:00
Richard W.M. Jones
314c5795b0 podwrapper: Remove output file on failure.
Otherwise we end up generated a bad output file and (in some cases)
continuing the build.

Updates commit b23e149774.
2016-04-24 15:35:10 +01:00
Richard W.M. Jones
0d69eab98f php: Fix the tests ... again.
PHP (5?) renamed the PHP_EXECUTABLE variable to TEST_PHP_EXECUTABLE.
As a result of that if you enabled debugging, the tests broke because
we no longer used our custom PHP wrapper to filter out debugging
environment variables before running the tests, so debug output was
mixed with the expected output.

This commit also updates an old comment telling you how to debug PHP
tests.
2016-04-24 15:08:12 +01:00
Richard W.M. Jones
672eff4a34 v2v: target_bus_assignment: Assign removables with slot pref first. 2016-04-24 12:07:16 +01:00
Richard W.M. Jones
c1adbe61df v2v: target_bus_assignment: Various refactorings.
No functional change.
2016-04-24 12:06:02 +01:00
Richard W.M. Jones
6193b2b273 v2v: Assert fail if we overwrite an existing disk in a bus slot.
Prevents us from accidentally "losing" a disk during conversion.  I
believe from code inspection that this assertion is always true for
the current code, so this should have no effect.
2016-04-24 11:33:28 +01:00
Richard W.M. Jones
9e3182b4c5 v2v: Move target_bus_assignment to separate module.
This is just code motion.
2016-04-24 11:31:48 +01:00
Richard W.M. Jones
c42557f5e1 v2v: Move inspect_source to separate module.
It's a large feature / function with its own set of nested functions,
so move the inspect_source function into its own module.  It also lets
us specify and document the interface explicitly.

Also: Define a root_choice type in Types module.  I turned it into a
non-polymorphic variant type for extra type safety.

This is just code motion.
2016-04-24 11:31:16 +01:00
Richard W.M. Jones
0eb8d673c1 v2v: List SOURCES_MLI in alphabetical order.
Fixes commit 01ede002db.
2016-04-23 18:03:16 +01:00
Richard W.M. Jones
ac9c31eb68 v2v: Commenting and refactoring changes.
- Add headings, further documentation to the Types module.

- Move two type definitions in Types module.  Not a functional change.

- Add more comments and clean up comments throughout v2v/v2v.ml.

- Refactor guestcaps / conversion in v2v/v2v.ml.  Not a functional
  change, just hides local variables from the rest of the code.

- In --in-place mode, change inspection message to 'Inspecting the
  source VM'.  This matches the later message 'Closing the source VM'.
2016-04-23 17:57:32 +01:00
Richard W.M. Jones
9304b70ff6 v2v: Move 'du' function to Utils module.
Just code motion.
2016-04-23 17:54:33 +01:00
Richard W.M. Jones
8299d7087a tests: Add boot-benchmark-range script.
Add a script we can use to benchmark performance across a range of
commits in another project.
2016-04-22 17:10:43 +01:00
Richard W.M. Jones
45f84601b0 tests: boot analysis: Add text to describe how to change settings. 2016-04-22 16:39:49 +01:00
Richard W.M. Jones
874ef2a04f docs: Fix use of getopt and pod2usage in make-internal-documentation.pl.
Fixes commit 04229c68d6.
2016-04-22 16:39:49 +01:00
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. 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. 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. 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. 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. 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. 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
Richard W.M. Jones
de66981917 v2v: Don't use List.sort_uniq, add util function for this instead (RHBZ#1321338).
List.sort_uniq was added in OCaml 4.02, so this breaks compilation on
earlier versions of OCaml.

Thanks: Jean-Christophe Manciot
2016-03-25 17:13:58 +00:00
Richard W.M. Jones
f756002b54 builder: Add ubuntu ppc64le script.
Thanks: Gustavo Romero
2016-03-24 20:19:19 +00:00
Lars Kellogg-Stedman
c6512ead45 document behavior of --selinux-relabel
the description of the --selinux-relabel option suggests that it
perform an immediate relabel, when in fact it may (and probably will)
instead simply touch /.autorelabel on the image, which schedules a
relabel operation for the next time the image boots.  This can be
surprising because it results both in an extended initial boot time
*and* results in an automatic reboot (on some distributions).
2016-03-24 20:19:09 +00:00
Richard W.M. Jones
6cdd20716c Version 1.33.16. 2016-03-24 18:51:36 +00:00
Richard W.M. Jones
c3fb5deab6 rescue: Fix test to deal with new --suggest output.
Fixed commit 72fd0531ab.
2016-03-24 18:51:36 +00:00
Richard W.M. Jones
aae74c9e4e python: Add README documenting how to run a single test. 2016-03-24 14:46:42 +00:00
Richard W.M. Jones
a5507a16c6 rescue: Print chroot suggestion for Linux guests. 2016-03-24 13:56:29 +00:00
Richard W.M. Jones
72fd0531ab rescue: Suggest using recursive bind mounts.
Since /dev and other directories contain sub-mounts, suggest using
--rbind instead of --bind.  This also allows us to remove the /dev/pts
line.
2016-03-24 13:56:29 +00:00
Richard W.M. Jones
0024e5a13e python: Misspelling in tests, libirt -> libvirt. 2016-03-24 13:56:29 +00:00
Roman Kagan
db982654d1 v2v: better explain --in-place
It seems that the documentation for --in-place mode of v2v wasn't clear
enough, so try to explain it better.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 16:43:29 +03:00
Roman Kagan
fb73d8261d v2v: in-place: request caps based on source config
In in-place mode, the decisions on which interfaces to use are made and
the source VM configuration is created by the outside entity.  So in
that case v2v needs to look it up in the source configuraion, and try to
follow.

For that, the source VM configuration is used to populate requested caps
object which is then passed to the convert routine.

It's assumed that the configuration has exactly one type of storage
devices and no more than one type of network and video adapters;
anything else is rejected.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
ee02191483 v2v: take requested caps into account when converting
Give the caller certain control over what kind of interface to use for
virtual disks, network and video cards upon conversion.

For that, make convert functions accept additional rcaps parameter
containing an object with optional capabilities similar to the ones
produced on output, with None indicating that the decision is left to
the convert function itself.

To facilicate review, this patch unconditionally passes rcaps with no
preferences; populating it with more sensible values is done in a
followup patch.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
94c83c0165 v2v: introduce requested guestcaps type
Introduce a type to contain the guestcaps that are to be put in effect
in the converted VM: options of the block type, net type, and video.

It'll be populated by the caller and passed into convert function to
affect its choice of devices and drivers.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Roman Kagan
ad5bb4f6bd v2v: collect source network and video adapter types
Those will be useful when making decisions about what configuration to
set on output.

The data is also included in --print-source so the tests are adjusted
accordingly.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Richard W.M. Jones
0ba59db611 tests/qemu: Add program for tracing and analyzing boot times. 2016-03-23 13:25:46 +00:00
Richard W.M. Jones
cd57851019 conn: Pretend to be a serial terminal, so sgabios doesn't hang.
This tedious workaround avoids a 0.26 second pause when using sgabios
(the Serial Graphics Adapter).  It's basically a workaround for buggy
code in sgabios, but much easier than fixing the assembler.
2016-03-23 13:25:46 +00:00
Richard W.M. Jones
f36ba38886 appliance: init: Don't run hwclock command.
This command alone took 0.3 seconds which is about 10% of the current
launch time.  It appears to be unnecessary.

This reverts commit 508f1ee87e.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
705b721b42 appliance: init: Mount selinuxfs along with other special filesystems.
Move this earlier.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
cb8f69e959 appliance: init: Move cmdline parsing earlier.
Since commit bb5d30ab2a, we don't
require any external programs like grep to parse the command line.  We
only use bash intrinsics.

Therefore we can do it early (but after /proc is mounted).

This allows verbose mode to enable set -x early on, so we can trace
most things that the init script does.
2016-03-23 12:58:15 +00:00
Richard W.M. Jones
d368fa0895 appliance: When using verbose mode, 'set -x' in the appliance init script. 2016-03-23 12:58:15 +00:00
Richard W.M. Jones
9423c16607 launch: Add a virtio-rng device to the guest. 2016-03-23 12:58:15 +00:00
Richard W.M. Jones
e94e61f76f launch: Remove guestfs_int_print_timestamped_message function.
This function was kind of like debug(), except that it didn't check
the g->verbose flag and it only worked in the library (it would crash
if used after fork).

It also wasn't very useful.  The sort of boot analysis done by
[forthcoming program] tests/qemu/boot-analysis.c means that
timestamping (some) messages is even less interesting than before.

Remove it and replace calls with debug() instead.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b7b3411976 launch: direct: Don't run qemu -version.
Dr. David Gilbert pointed out to me that the first line of the
qemu -help output includes the qemu version, so we don't need
to run qemu -version at all.

This saves about 0.04s on the launch time when using the direct
backend.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b3e843e5b4 launch: Factor out earlyprintk from the command line.
Just code motion.

In theory we could also add earlyprintk=ttyS0,115200 on x86, but I
cannot get it to work.
2016-03-23 12:57:55 +00:00
Richard W.M. Jones
b652cc419d launch: direct: Remove dead code promising we were going to use virtio-console.
We're never going to use virtio-console since, although it is faster,
it's not available during early boot, and that is more important for
debugging.
2016-03-23 12:57:55 +00:00
Pino Toscano
bb5d30ab2a appliance: use bash features for string matching in files
Read the content of /proc/cmdline using bash features, and use its
[[ ... ]] expression to find texts in a variable.

This shaves off 5 grep invocations.
2016-03-22 22:30:59 +00:00
Pino Toscano
e2457d0773 Reduce GUESTFS_PRIVATE usage
Remove the GUESTFS_PRIVATE=1 define for some tools and tests which don't
really use any private API.
2016-03-22 22:30:59 +00:00
Pino Toscano
40017ba7f3 build: improve GUESTFS_FIND_DB_TOOL macro
- find the unversioned name just once
- add 5.3 and 5.2 as versions
- add db_$TOOL-X and db_$TOOL-X.Y as patterns (found on FreeBSD)
2016-03-22 09:45:41 +01:00
Pino Toscano
5f24d45ab5 build: check the path of true, and use it in tests
Check for the full path of true, and use it instead of hardcoding
/bin/true (which is still left as fallback).
2016-03-22 09:45:41 +01:00
Pino Toscano
76a01fe41d php: pass $(MAKE) to run-php-tests.sh
Instead of hardcoding "make" in run-php-tests.sh, pass the actual name
of make from the Makefile; the default is still "make", mostly to use
the script without having to set $MAKE.
2016-03-22 09:45:41 +01:00
Pino Toscano
39772344ad v2v: tests: use guestfs-hashsums.sh for MD5
Use the common helper for MD5 checksum, instead of assuming md5sum(1).
2016-03-22 09:45:41 +01:00
Pino Toscano
8aee5726d3 v2v: tests: isolate SHA1 calculation in an own shared function
sha1sum(1) does not exist everywhere, so wrap it in an own function so
the right implementation can be chosen on each OS.  Also, wrapping it
avoid using awk everytime.
2016-03-22 09:45:41 +01:00
Pino Toscano
41795a1c98 tests: move guestfs-md5.sh to test-data
Move it to the test-data directory, giving it a more generic name so it
can be used also for more than just md5; adjust qemu tests accordingly.

This is just code motion, no behaviour change.
2016-03-22 09:45:41 +01:00
Pino Toscano
7e970fcdb3 build: check the path of fuser, and use it in FUSE code
Check for the full path of fuser, and use it instead of hardcoding
/sbin/fuser (which is still left as fallback).
2016-03-22 09:45:41 +01:00
Richard W.M. Jones
5897b3bbad appliance: Quiet some warnings about missing files.
Try to make the appliance script as quiet as possible along
the fast path.
2016-03-18 13:18:13 +00:00
Richard W.M. Jones
23028cb30d appliance: Make it clear that the init script is a bash script.
We have used /bin/sh here since 2009.  However this is a bash
script and probably won't work well with other shells.
2016-03-18 13:18:13 +00:00
Richard W.M. Jones
ed739e71f6 appliance: Pass "quiet" option to kernel when !verbose.
The quiet option suppresses kernel messages.  On my laptop it improves
appliance boot times by about 40% (3.5s -> 2.5s).

The emulated UART is slow and has a fixed, small FIFO (16 bytes).  But
it has the advantage of being a simple ISA device which is available
very early in boot, thus enabling us to diagnose early boot problems.
So the aim is to reduce our usage of this UART on fast paths.

Of course when we are in verbose mode, we should not add this flag
because we want to see all the messages.

This change is not entirely invisible:

(1) Progress messages use the "Linux version ..." string from kernel
output in order to determine part of where we are in the boot process.
This string will no longer be detected.  We should probably use a BIOS
message or maybe drop this altogether.  I have added a comment to the
code.

(2) It is possible for programs to be listening for
GUESTFS_EVENT_APPLIANCE events, and they will see fewer messages now
(although what kernel messages programs see is never defined).
2016-03-18 13:18:13 +00:00
Pino Toscano
1df34fd8d1 inspect: improve UsrMove detection (RHBZ#1186935)
In case /usr is a symlink to /usr/bin, then we cannot rely on /usr/bin
to exist, since /usr might be in a different partition.  Thus, in case
/bin is a symlink, check it points to "usr/bin".
2016-03-17 15:28:18 +01:00
Pino Toscano
b0be4c1130 inspector: define more multichoice tags in the RELAX NG schema
Provide new <define> for the following elements: "distro",
"package_format", "package_management", and "format", adding all the
values so far possible for each.
2016-03-17 15:28:18 +01:00
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
a5bf0e7e64 Version 1.33.15. 2016-03-16 15:17:12 +00:00
Richard W.M. Jones
180b853658 fish: Link with LIBTINFO_LIBS.
Required on Gentoo.

Thanks: Mark Pictor
2016-03-16 15:16:39 +00:00
Richard W.M. Jones
1129cbba3d docs: Fix cross-reference to fixed appliance section.
The fixed appliance documentation moved from guestfs(3) to
guestfs-internals(1).

Thanks: Mark Pictor (mark999 on IRC)
2016-03-15 19:13:59 +00:00
Richard W.M. Jones
ffeea7995b Revert "configure: Move version and date together."
You can't use AC_SUBST before AC_INIT.  It resulted in the
RELEASE_DATE being an empty string.

This reverts commit d53fd558ae.
2016-03-09 15:05:43 +00:00
Matteo Cafasso
d314d10e1f sleuthkit availability check renamed
>From 'available icat' to 'available sleuthkit'.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-08 21:13:10 +00:00
Cédric Bosdonnat
f0d71e148c configure: handle older version of ncurses
ncurses didn't have pkg-config files in not-that-old versions. If those
couldn't be found, then try the ncurses6-config and ncurses5-config tools.
2016-03-08 16:25:19 +01:00
Cédric Bosdonnat
1c30c23a19 fish: fix btrfs subvolumes display in error case
The list of filesystems that is printed when there was an error prints
the internal mountable string even for the btrfs subvolumes. Let's
printing a valid -m option value instead.
2016-03-08 16:25:19 +01:00
Cédric Bosdonnat
f5a9cdff2a api: add mountable_device and mountable_subvolume
These two functions allow the user to split the mountable strings
into a device and a subvolume if any. See this thread on the mailing
list for the rationale:

https://www.redhat.com/archives/libguestfs/2016-February/msg00247.html
2016-03-08 16:25:19 +01:00
Pino Toscano
43dd545e46 appliance: pick sleuthkit on all the distros
It looks like it has the same name everywhere, so move it in the common
packages section.

This updates commit 3bb65458ff.
2016-03-08 09:47:30 +01:00
Pino Toscano
d3b68d90c8 inspector: extend the OS "name" in the RELAX NG schema
Put the definition of "name" in an own <define>, and add the missing
operating systems so far known to libguestfs.
2016-03-08 09:20:47 +01:00
Pino Toscano
709e530655 inspector: add --no-applications and --no-icon
Add command line options to optionally disable the output of the
installed application, and the guest icon.

This makes the inspection slightly faster, producing a smaller XML to
parse/process in case there is no interest in these details.
2016-03-08 09:20:47 +01:00
Richard W.M. Jones
31e9be7696 Version 1.33.14. 2016-03-07 20:11:02 +00:00
Matteo Cafasso
ac0d2adf56 added icat API tests
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-07 19:33:53 +00:00
Matteo Cafasso
acd3f235ae added icat API to retrieve deleted or inaccessible files
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-07 19:33:53 +00:00
Matteo Cafasso
3bb65458ff added The Sleuth Kit package to the appliance
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-07 19:33:53 +00: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
8ed6435f04 inspect: list applications with APK
Implement the helper function for guestfs_inspect_list_applications2 to
be able to parse the list of installed applications with the APK package
manager (used on Alpine Linux).
2016-03-07 17:25:21 +01:00
Pino Toscano
b07f8793d0 build: fix reading of the java version
Update the check for the first line (the one containing the version) to
match also the message with OpenJDK; switch to awk so it is easier to
extract the version inside the double quotes.
2016-03-07 16:17:32 +01:00
Richard W.M. Jones
a51b136584 inspect: windows: Make is_systemroot check code more robust.
We rely on this function for security to ensure the caller cannot set
windows_systemroot to a very long or bogus value.
2016-03-07 11:17:07 +00:00
Richard W.M. Jones
af4cd5347e lib: inspect: gpt_prefix is a constant string. 2016-03-07 11:16:58 +00:00
Richard W.M. Jones
7b17447ac4 lib: Minor whitespace rearrangement. 2016-03-07 11:14:21 +00:00
Richard W.M. Jones
e7666da224 lib: Fix incorrect comment in utils.
The string is not freed by the caller.  A fixed buffer is provided
by the caller.
2016-03-07 11:14:21 +00:00
Richard W.M. Jones
c30363d4af v2v: linux: Fix small typo in comment. 2016-03-06 15:50:57 +00:00
Richard W.M. Jones
d5b3aa0cca v2v: Fix incorrect calculation of lc_basename.
We should be using the lowercase path.  Prior to this patch
lc_basename was not actually lowercase.

Fixes commit f7249a0bcc.
2016-03-04 10:22:45 +00:00
Richard W.M. Jones
f33e127d87 v2v: Describe workaround for Windows >= 8 Fast Startup.
Thanks: Nisim Simsolo
2016-03-03 15:42:26 +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
d53fd558ae configure: Move version and date together.
I keep forgetting to update the date field when releasing.
2016-03-03 13:50:36 +00:00
Pino Toscano
e8408fe3c3 daemon: do not fail list-disk-labels w/o labels set
If there are no labels set for the disks, the directory with the
symlinks will not even exists, causing list-disk-labels to fail with
ENOENT.  In this situation, act as if the directory was there, but
empty.
2016-03-02 14:42:02 +01:00
Pino Toscano
4d4f16067e daemon: ntfs: switch away from asprintf_nowarn in ntfsclone-in
No custom formats (eg %Q, %R) are used.
2016-03-02 11:14:19 +01:00
Pino Toscano
acbc5dee4f make-fs: print error message on mkfs failure
This makes a bit easier to diagnose failures on mkfs, without the need
to restart the filesystem creation with verbose output (which will
produce a lot more output).
2016-03-02 11:02:08 +01:00
Pino Toscano
c9b186ae63 daemon: ntfs: fix format strings
Use PRIi64 as format string for int64_t, so it builds and works fine
also on 32bit.  Also switch from asprintf_nowarn to asprintf, since no
custom formats (eg %Q, %R) are used.
2016-03-02 10:55:14 +01:00
Pino Toscano
1d5af46a44 tests: move ntfs tests in a single directory
Move test-ntfscat.sh and test-ntfsclone.sh in a single ntfs directory,
much like the tests for other filesystems.
2016-03-01 14:20:46 +01:00
Matteo Cafasso
a7ea3b577f tests: Added test for ntfscat_i.
Test is based on file signature, it checks whether the extracted file
is the $MFT.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-01 09:06:10 +00:00
Matteo Cafasso
61b0317c12 New API: ntfscat_i
Adding ntfscat_i command for downloading files based on their inode number.

This allows the dowload of files unaccessible otherwise from a NTFS guest disk image.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-03-01 09:06:10 +00:00
Richard W.M. Jones
49dea6c79f docs: building: Document using clean-supermin-appliance rule. 2016-02-28 16:10:41 +00:00
Richard W.M. Jones
b2877dc34f appliance: Add comment and clean-supermin-appliance rule.
Add a comment to appliance/Makefile.am describing the purpose of this
directory.

Add a 'make clean-supermin-appliance' rule which forces the supermin
appliance to be reprepared from scratch.  See the discussion here:
https://www.redhat.com/archives/libguestfs/2016-February/msg00264.html
2016-02-28 15:57:51 +00: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
1225bb194e java: drop empty lines at end of pod-generated text
They are converted as additional empty paragraphs but adding nothing to
the generated API documentation.  Also avoids warnings about them by
javadoc.
2016-02-26 18:36:42 +01:00
Pino Toscano
3b427b90ac doc: add info on per-function needed feature
Document which feature, if any, is needed for a function; this should
help users in properly checking feature availability when using certain
functions.
2016-02-26 18:36:42 +01:00
Richard W.M. Jones
9b1f826202 Version 1.33.13. 2016-02-26 11:45:47 +00:00
Richard W.M. Jones
660246dcbc v2v: -o libvirt: Preserve source <graphics> type (RHBZ#1312254).
Old virt-v2v changed the <graphics> to VNC if the guest was using the
Cirrus hardware and Spice if the guest used QXL.

In commit 3d1cb74b3e I got the logic
backwards, using Spice if the guest used Cirrus and VNC if the guest
used QXL, which obviously makes no sense.

In this commit, I preserve the original <graphics> type from the
source guest.  This has the advantage that the user can use the same
method to access the guest after conversion.  If the source guest had
no <graphics> element, then we force VNC (a safe choice), and if the
source guest is a local disk that we use SDL, but this should only be
used for testing.

Thanks: Xiaodai Wang for the original bug report here:
https://bugzilla.redhat.com/show_bug.cgi?id=1225789#c10
2016-02-26 10:45:21 +00:00
Richard W.M. Jones
534dfcf84e v2v: -o libvirt: Refactor video and graphics elements.
This is just a refactoring and doesn't change the meaning of the code.
2016-02-26 10:45:21 +00:00
Richard W.M. Jones
fadce8d3e7 fish: Set program name correctly for virt-{copy,tar}-{in,out} programs.
Set the (libguestfs handle) program name correctly when running
programs like virt-copy-in, so the program name is not "guestfish" but
"virt-copy-in".

Note this feature cannot be tested using the ./run script, since
libtool (buggily) resets the program name to "lt-guestfish".  However
I tested it on the installed copy and it worked there.
2016-02-26 10:45:21 +00:00
Richard W.M. Jones
7b11fb16ec perl: Don't embed API number in Sys::Guestfs.
It means you have to rerun `make -C perl clean ; make' every time you
add an API, and is useless anyway.
2016-02-26 10:45:21 +00:00
Pino Toscano
d9169fc371 listfs: ignore the default btrfs subvolume
When listing the subvolumes of a btrfs filesystem, ignore the default
subvolume: we get the content of it when mounting the whole device
(without specifying any particular subvolume), so avoid listing it
twice.
2016-02-26 11:41:47 +01:00
Pino Toscano
20efe36582 src: print contents of structs and struct lists on tracing
It eases the debugging, instead of getting just the name of the struct
returned.
2016-02-24 13:47:18 +01:00
Pino Toscano
e58e603a71 fish: use the new structs-print.c to print structs
Use of the new code to print structs, making sure the layout is the same
as before.
2016-02-24 13:47:18 +01:00
Pino Toscano
2c0d16e82e src: generate code for printing contents of structs
Extend the generator to generate a source (and the header for it) with
functions that print the content of a guestfs struct.  The code is
modelled after the code for it in fish.ml, although made a bit more
generic (destination FILE*, line separator) so it can be used also in
the library, when tracing.

This just introduces the new code and builds it as part of the helper
libutils.la.
2016-02-24 13:47:18 +01:00
Richard W.M. Jones
c0c91f96d7 daemon: btrfs: Use COMPILE_REGEXP macro to compile regular expressions. 2016-02-23 10:55:17 +00:00
Richard W.M. Jones
4752c42c21 lib: Allow the COMPILE_REGEXP macro to be used everywhere.
Since the daemon links to pcre and use regular expressions, and since
the COMPILE_REGEXP macro doesn't depend on any aspects of the
library-side code (eg. the guestfs_h handle etc), we can allow the
daemon to use the COMPILE_REGEXP macro.  Move the macro to
"guestfs-internal-all.h" to permit this.
2016-02-23 10:55:17 +00:00
Pino Toscano
b1ae32416e ruby: tests: use more asserts instead of manual checks
Make more use of assert_equal/refute_equal instead of manually checking
values and raising errors.
2016-02-23 11:50:35 +01:00
Pino Toscano
3c2bc20250 Revert "ruby: Run tests one at a time, instead of in parallel."
It seems the default behaviour of rake is to run tests sequentially, and
not in parallel (there are separate gems to achieve that behaviour).

Hence just invoke "rake test" to run all the available tests at once.

This reverts commit 8f30c3c3f8.
2016-02-23 11:50:35 +01:00
Richard W.M. Jones
ae3c051567 generator: Declare which input file(s) generate each output file. 2016-02-23 10:40:06 +00:00
Richard W.M. Jones
52b5ddf23e generator: Make the 'this file is generated' warning clearer.
Also rename the ~extra_inputs parameter as plain ~inputs.  We will use
~inputs more widely in following commit.
2016-02-23 10:40:06 +00:00
Richard W.M. Jones
9eb26a1748 generator: gobject: Remove parameters which are not used.
Revealed by adding typed interfaces in the previous commit.
2016-02-23 10:40:05 +00:00
Richard W.M. Jones
30d2a308c0 generator: Add interfaces to all modules.
Be explicit about what is exported from each module in the generator.
2016-02-23 10:40:05 +00:00
Richard W.M. Jones
b9a97718f7 tests: Use LOG_COMPILER to run valgrind. 2016-02-22 17:55:13 +00:00
Richard W.M. Jones
dd7be596f5 tests: Remove bogus use of $(VG). 2016-02-22 17:55:13 +00:00
Richard W.M. Jones
085815ce10 build: Describe how to set up check-valgrind rules correctly.
Since we enabled parallel tests, you can no longer run tests
under valgrind merely by doing:

  TESTS_ENVIRONMENT = $(top_builddir)/run --test $(VG)
  check-valgrind:
      $(MAKE) check VG="@VG@"

The reason is that the parallel tests framework doesn't run
``$(TESTS_ENVIRONMENT) <test>''.  It inserts some other processes in
between the environment and the test, so you end up valgrinding some
unrelated process (currently the 'env' program).

In run.in, remove out of date documentation for using $(VG).
In guestfs-hacking(1), document how to do it properly.
2016-02-22 17:55:13 +00:00
Pino Toscano
789d256645 python: tests: fix long/int mismatch in test090RetValues.py
Cast the value to the "int_type" representing the "long" value for
test_rint64, so the test works again with Python 3.
2016-02-22 17:13:38 +01:00
Pino Toscano
519c9bc8df python: tests: move the 'int' type in tests_helper
This way it can be used in other tests as well.

Simple code motion.
2016-02-22 16:57:57 +01:00
Pino Toscano
9776615301 python: tests: refactor to use unittest's discovery
Instead of running all the tests manually, the unittest module has a
'discovery' mode to run tests by importing them from a directory: this
requires the tests to have different filenames, since they need to be
imported as modules now (hence an empty __init__.py is added), and the
current naming does not match the convention.

Using unittest as loader/runner brings another change: tests skipped as
whole cannot be done anymore with exit(77), since they are not run but
imported: thus introduce an helper module with decorators applied to the
test classes to skip them according to the current checks.  This also
gets us nicer recordings in the unittest log.

Due to the relative imports (needed for the helper code), it is no more
possible to execute tests anymore by invoking them manually; although
it is possible to run single tests, still using unittest's runner:

  $ cd python
  python$ ../run python -m unittest discover -v t test010Load.py

This does not change anything in what the tests do/check.
2016-02-22 16:57:15 +01:00
Richard W.M. Jones
961721b64b FAQ: Link to posting about compiling libguestfs from source. 2016-02-22 10:19:42 +00:00
Richard W.M. Jones
34e7b69612 FAQ: cache=none, not cache=unsafe, prevents qemu from caching.
Thanks: kaze on IRC.
2016-02-22 09:54:10 +00:00
Richard W.M. Jones
3fa03a30b3 build: installcheck: Ensure libguestfs.so is copied.
If you ran 'make installcheck' when libguestfs-devel was not
installed, then the installcheck would fail in many places with:

  gcc: error: ../../src/.libs/libguestfs.so: No such file or directory

We should stop the installcheck script immediately if the .so file was
not found.

Also this commit ensures that src/.libs/libguestfs.so* not existing
before installcheck is not fatal.
2016-02-19 12:49:18 +00:00
Richard W.M. Jones
2e87face9e v2v: windows: Change wording of warning about basic VGA display driver (RHBZ#1309619). 2016-02-19 09:00:10 +00:00
Pino Toscano
9854ea913a gobject: ship also run-tests-retvalues
Fixes commit f7765ea6e4 and
commit 3787ebace4.
2016-02-19 09:47:37 +01:00
Richard W.M. Jones
cbf0714e07 v2v: RHEV: Treat Windows 8.1 x86 client as Windows 8 (RHBZ#1213324). 2016-02-18 14:43:33 +00:00
Richard W.M. Jones
7bf820b0d9 v2v: RHEV: Treat Windows 8.1 client as Windows 8 (RHBZ#1309580). 2016-02-18 14:41:43 +00:00
Richard W.M. Jones
5431eda3a6 v2v: Make the error message actionable when cannot find libvirt pool.
Make this error message useful and actionable by suggesting commands
that the end user can run to find available pools, etc.

I also had to extend the fixed size buffer we use for messages since
the message got truncated.
2016-02-18 14:14:19 +00:00
Richard W.M. Jones
ba839f553b v2v: OVF: In warning, display inspect.i_arch field.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1213324#c11
2016-02-18 10:06:27 +00:00
Richard W.M. Jones
d87c6fd6f2 v2v: Add Windows 10 to OVF.
See https://github.com/oVirt/ovirt-engine/blob/master/packaging/conf/osinfo-defaults.properties
2016-02-18 10:00:45 +00:00
Richard W.M. Jones
6200ae7204 v2v: glance: Allow Glance backend to import multiple disks (RHBZ#1308769). 2016-02-17 18:04:32 +00:00
Richard W.M. Jones
bae3d92e88 v2v: glance: Add "OUTPUT TO GLANCE" section to the documentation. 2016-02-17 18:02:54 +00:00
Pino Toscano
3787ebace4 gobject: ship correct .js file
Fixes commit f7765ea6e4.
2016-02-17 10:26:35 +01:00
Pino Toscano
967e887e43 v2v: update URL with glance metadata 2016-02-16 14:42:44 +01:00
Pino Toscano
f7765ea6e4 Start adding return values tests for bindings
Introduce a new kind of bindings tests, 090-retvalues, to check all the
possible return values in bindings; start implementing them for
scripting languages such as GObject introspection, Perl, PHP, Python,
and Ruby, reusing existing implementations where existing.
2016-02-15 18:32:07 +01:00
Richard W.M. Jones
938f48f08a v2v: Fix CompatibleIDs for Windows > 7 conversions.
Thanks Joshua Pincus for finding the bug.

I checked back with the original W2K8R2 guest which I had used for
getting these registry entries, and there was a transcription error
with two of the CompatibleIDs.
2016-02-15 10:40:11 +00:00
Pino Toscano
2a2a540436 python: tests: use more targeted assert*() functions/checks
- use assertIsInstance, assertNotEqual, and assertIsNotNone as more
  specific checks (will produce better logging)
- use assertRaises when expecting exceptions being thrown
- when testing internal_test_rhashtable, instead of checking type and
  elements of the return values just check the return value as a whole
  (easier and already getting all the work needed by unittest)
2016-02-12 17:57:58 +01:00
Richard W.M. Jones
6629cb0d91 Version 1.33.12. 2016-02-12 15:57:51 +00:00
Richard W.M. Jones
85b1815e7b tests: Make '080' be an official test of the guestfs_version API.
Useful because it tests returning a single structure.
2016-02-12 15:41:42 +00:00
Richard W.M. Jones
b647dd8b52 python: tests: Use the 'unittest' module to run the test suite. 2016-02-12 15:32:39 +00:00
Richard W.M. Jones
2e16e3e993 daemon: lvm: Ignore LVs with the activationskip flag set (RHBZ#1306666).
When listing logical volumes, ignore the ones which don't get
activated automatically.  No /dev/VG/LV device node is created for
these ones which confuses APIs that attempt to do 'guestfs_lvs'
followed by opening the device node.  Note that 'guestfs_lvs_full' is
unaffected by this change.
2016-02-12 14:21:08 +00:00
Pino Toscano
7a598a0c02 php: restructure and expand tests
Rename the existing tests according to the naming/numbering described in
guestfs-hacking(1), and improve the current ones:
- guestfs_php_001.phpt: rename to guestfs_020_create.phpt
- guestfs_php_003.phpt: rename to guestfs_070_optargs.phpt
- guestfs_php_bindtests.phpt: rename to guestfs_090_bindtests.phpt
- guestfs_090_version.phpt: new, checks taken from the former
  guestfs_php_002.phpt
- guestfs_100_launch.phpt: new, modelled after the equivalent in e.g.
  OCaml/Perl/Python
- guestfs_php_002.phpt: remove, as what it did is now covered by
  090_version and 100_launch
2016-02-12 15:10:07 +01:00
Pino Toscano
9753986819 fish, sysprep: run FUSE-related tests only when FUSE is available
They will fail anyway in that case, so run them only when the FUSE
support is built in.
2016-02-11 18:40:04 +01:00
Richard W.M. Jones
18fa191250 v2v: Small documentation fix in permissions section.
In vCenter 5.5 at least, it's 'Sessions', not 'Session'.
2016-02-10 14:44:35 +00:00
Richard W.M. Jones
eae73a5aa9 Revert "v2v: Document that vCenter etc permissions must be set to "OK"."
On further examining the incredibly confusing VMware dialogs, I don't
believe this is true after all.

This reverts commit e76128a20b.
2016-02-10 14:43:09 +00:00
Richard W.M. Jones
e76128a20b v2v: Document that vCenter etc permissions must be set to "OK".
And that READ_ONLY access is insufficient.  I believe this is a bug in
libvirt, but it requires further investigation.  If it is resolved in
libvirt then we can update this documentation again.

Thanks: Ulhas Surse
2016-02-10 13:21:47 +00:00
Pino Toscano
2f461b7cb8 Update zanata.xml
Update the Zanata configuration based on what Zanata itself proposes as
project configuration.
2016-02-10 14:15:05 +01:00
Richard W.M. Jones
f9686217b5 docs: Add recipe for FUSE-mounting a Windows guest with drive letters.
Thanks: Pino Toscano, Hilko Bengen.
2016-02-10 11:06:07 +00:00
Richard W.M. Jones
3a9643834c docs: Alphabetize headings in guestfs-recipes(1).
No change, just reorder a section so they are in alphabetical order.
2016-02-10 10:43:09 +00:00
Roman Kagan
92ea4ed5f7 v2v: move virtio_win to windows_virtio
Now that all the stuff related to Windows virtio drivers has been moved
into a dedicated module, it makes sense to move the definition of
virtio_win there, too, and stop passing it around as a parameter.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2016-02-09 16:36:10 +00:00
Richard W.M. Jones
511280c076 Version 1.33.11. 2016-02-09 13:27:55 +00:00
Pino Toscano
41afeb266d tmpdirs: fix typo in variable name
On mkdtemp error, free tmppath and not tmpdir (which is CLEANUP_FREE).

Fixes commit 673a7a959c.
2016-02-09 14:18:15 +01:00
Pino Toscano
15d28b09c0 tmpdirs: centralize permissions handling
Move to lazy_make_tmpdir the logic for making world-readable (but only
for root) newly-created temporary directories, removing the non-fatal
code doing that in guestfs_impl_launch.

Followup of commit 772f649e59.
2016-02-09 14:15:06 +01:00
Pino Toscano
772f649e59 lib: fix sockdir for root
When running as root libvirt will launch qemu as qemu.qemu, which will
not be able to read inside the socket directory in case it is set as
XDG_RUNTIME_DIR under /run/user/0.

Since normal users don't need particular extra access permissions for
their sockdirs, restrict /tmp as only possible sockdir for root,
changing the permissions only for this user (and making this operation
fatal).

Fixes commit 55202a4d49 and
commit 7453952d24.
2016-02-09 11:36:23 +01:00
Richard W.M. Jones
d5c0f85c6e Version 1.33.10. 2016-02-08 17:52:29 +00:00
Pino Toscano
fcf1884932 tests: reduce sizes of scratch disks to 2 GB
1 GB should be enough to create a btrfs filesystem, even with 64K page
size; hence, make the /dev/sda and /dev/sdb test devices smaller so
there is less space taken during the test run.

Followup of commit 8ffad75e5b and
commit 9e9b648770.
2016-02-08 17:22:48 +00:00
Richard W.M. Jones
7453952d24 launch: Set sockdir mode to 0755.
https://bugzilla.redhat.com/show_bug.cgi?id=610880

Fixes commit 55202a4d49.
2016-02-08 17:20:30 +00:00
Richard W.M. Jones
7fd17fa99d launch: libvirt: Debug sockdir not tmpdir.
Fixes commit 55202a4d49.
2016-02-08 17:09:48 +00:00
Dawid Zamirski
7cb28488a6 inspect: get windows drive letters for GPT disks.
This patch updates the guestfs_inspect_get_drive_mappings API call to
also return drive letters for GPT paritions. Previously this worked
only for MBR partitions. This is achieved by matching the GPT partition
GUID with the info stored in the blob from
HKLM\SYSTEM\MountedDevices\DosDevices keys. For GPT partions this blob
contains a "DMIO:ID:" prefix followed by a 16 byte binary GUID.
2016-02-06 17:09:18 +00:00
Richard W.M. Jones
985a693251 Version 1.33.9. 2016-02-05 19:11:47 +00:00
Richard W.M. Jones
8cba70c038 lib: Stop exporting the safe_malloc, etc. functions.
As was forewarned in the comment, stop exporting these functions
outside the library.
2016-02-05 14:17:48 +00:00
Richard W.M. Jones
32cd056ff8 ruby: Stop using the safe_malloc, etc. functions. 2016-02-05 14:17:48 +00:00
Richard W.M. Jones
4b96331ad5 perl: Stop using the safe_malloc, etc. functions. 2016-02-05 14:17:48 +00:00
Richard W.M. Jones
2a48a6591f java: Stop using the safe_malloc, etc. functions. 2016-02-05 13:16:22 +00:00
Richard W.M. Jones
ae750fcfe0 python: Stop using the safe_malloc, etc. functions. 2016-02-05 13:15:59 +00:00
Richard W.M. Jones
0445284dfb ocaml: Stop using the safe_malloc, etc. functions. 2016-02-05 13:15:48 +00:00
Richard W.M. Jones
0b10465772 java: Fix documentation of @throws.
The javadoc @throws directive requires a string documenting
when the exception is thrown.
2016-02-05 13:05:30 +00:00
Richard W.M. Jones
7ac9127bf4 v2v: Move the other OVMF paths into the core library.
Refactoring change, continuing the theme from the previous commit.
2016-02-05 09:22:28 +00:00
Richard W.M. Jones
4ac6ff6b47 aarch64: Use a common table of AAVMF paths.
Previously the code had two places where an identical set of AAVMF
paths were stored.  Put this information into one place.

This is just refactoring.
2016-02-04 18:36:19 +00:00
Pino Toscano
13c3698358 customize: add globbing for --delete
Support globbing in paths passed to --delete, telling glob to not
return directories with leading slash.

This re-adds back globbing for --delete in virt-sysprep, which was
available before the integration with common code from virt-customize.
2016-02-04 11:26:20 +01:00
Pino Toscano
01f46e4e31 daemon: glob: add optarg to control trailing slash for dirs
Add a new optional bool "directoryslash" to indicate whether the caller
wants trailing slashes in names of directories, defaulting to true (the
current behaviour); this helps with interoperability with other tools
(such as rm).

Related to RHBZ#1293271.
2016-02-04 11:25:56 +01:00
Pino Toscano
14b8e67f0b sysprep, get-kernel: explicit the Guestfs parameter
Help the OCaml compiler by expliciting Guestfs.guestfs as type for 'g'
in some functions.
2016-02-04 10:22:18 +01:00
Richard W.M. Jones
fe7fceba6e v2v: Replace "=" by "_" in OVF .meta DESCRIPTION field.
The current VDSM .meta file parser is incorrect:

  https://code.engineering.redhat.com/gerrit/gitweb?p=vdsm.git;a=blob;f=vdsm/storage/fileVolume.py;h=20573bd2a3fe6909a8474bd7c53c8d0fea79091c;hb=c1289fd70edcde0a0b3bc8e37ecad1e2a5babe1a#l285

When parsing the key=value fields in the .meta file, it uses the
Python expression:

  key, value = l.split("=")

which throws an exception "ValueError: too many values to unpack" if
the value part also contains an "=" character (because split returns
an n-tuple with n > 2).  The correct way to split the string in this
situation is to use l.split("=", 1).

In commit 399e031c25 I changed the
DESCRIPTION field in .meta so that in RHEL it would look like this:

  DESCRIPTION=generated by libguestfs 1.32.2rhel=7,release=1.el7,libvirt

thus containing an "=" character in the value and throwing an
exception in VDSM.

Although this is a bug in VDSM which needs to be fixed separately,
change any occurrence of "=" in the value to "_" to avoid this
problem.

Thanks: Derrick Ornelas for helping to diagnose this bug and finding
the offending code in VDSM.
2016-02-03 21:35:48 +00:00
Richard W.M. Jones
9e9b648770 tests: btrfs: Use a 2000 MB partition for btrfs test (instead of 200 MB).
One of the mkfs-btrfs tests used two 200 MB partitions.  That isn't
enough to create a btrfs filesystem on aarch64 (with 64K page size).
Since we now have a 10 GB disk, we can make the test partition 10
times larger.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
5238c4ee0a tests: btrfs: Don't test --leafsize, and use --nodesize 64K.
In btrfs-progs 4.4, the --leafsize parameter is deprecated.  It's now
just an alias for --nodesize.

On aarch64, --nodesize 4096 does not work because it's smaller than
the page size (64K).  Luckily we can test a 64K nodesize on any
platform, so use that instead.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
8ffad75e5b tests: Increase the size of the /dev/sda and /dev/sdb test devices.
Previously these were rather small - just 500 MB.  This is too small
to create a btrfs device on aarch64 (where page size may be 64K), and
barely enough even on x86-64.  This change makes both these devices
10 GB, and adjusts a few tests so they continue to pass.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
c055f842d7 Version 1.33.8. 2016-02-03 14:02:26 +00:00
Richard W.M. Jones
f88e931866 resize: Use sparse copy for extended partitions unless --no-sparse.
Thanks: Maxim Perevedentsev
2016-02-03 13:32:35 +00:00
Pino Toscano
d3502bdc32 generator: simplify generated code for always-available features
Just refer to the dummy function directly, instead of using #define's.
2016-02-03 13:24:37 +01:00
Pino Toscano
55202a4d49 New API: get-sockdir
Introduce a new read-only API to get a path where to store temporary
sockets: this is different from tmpdir, as we need short paths for
sockets (due to sockaddr_un::sun_path), and it is either
XDG_RUNTIME_DIR if set, or /tmp; adapt guestfs_int_create_socketname
to create sockets in that location.

Furthermore, print sockdir and XDG_RUNTIME_DIR in test-tool for
debugging.
2016-02-03 13:15:29 +01:00
Pino Toscano
4f7251f896 launch: add internal helper for socket paths creation
Introduce an internal helper to create paths for sockets -- will be
useful for changing later the logic for placing sockets.
Futhermore, check that the length of sockets won't overflow the buffer
for their filenames.
2016-02-03 12:51:26 +01:00
Pino Toscano
673a7a959c lib: extract lazy tmpdir creation helper
Extract the bit of code for lazy creation of a temporary directory, so
it can be used for more directories as well.

This is just code motion, with no behaviour changes.
2016-02-03 11:07:34 +01:00
Pino Toscano
dbad317120 launch: libvirt: cleanup sockets on shutdown
Unlink the sockets in the shutdown callback, instead of right before
creating a new ones.  This makes sure we are unlinking the right
sockets.
2016-02-01 10:52:15 +01:00
Pino Toscano
e31e3ccd8f launch: libvirt: move socket path variables
Move the paths of the sockets used, from the libvirt_xml_params struct
to backend_libvirt_data; this way, they will be usable also outside the
launch callback.

Simply code motion.
2016-02-01 10:52:14 +01:00
Pino Toscano
cfedf73b3d launch: direct: cleanup daemon socket on shutdown
Unlink the daemon socket in the shutdown callback, instead of right
before creating a new one.  This makes sure we are unlinking the right
socket.
2016-02-01 10:52:14 +01:00
Pino Toscano
0f6a3b13a5 launch: direct: save the path of the daemon socket
Save the path of the socket passed to qemu for communication with
guestfsd; we will need it to clean it correctly.
2016-02-01 10:52:13 +01:00
Pino Toscano
79b2f19fe7 launch: unix: check for length of sockets
Error out early if the path to the socket will not fit into
sockaddr_un::sun_path, as we will not be able to connect to it.
2016-02-01 10:52:12 +01:00
Richard W.M. Jones
e8ce35b007 FAQ: Add answer about unsupported use of NTFS in RHEL 7.2. 2016-01-31 16:00:00 +00:00
Richard W.M. Jones
19f3689e5d v2v: Split with_hive into with_hive_readonly, with_hive_write.
I find the code slightly easier to read if we get rid of the ~write
flag, and instead split the with_hive function into two functions, one
for readonly access, and one for write access.

This is just code refactoring.
2016-01-31 14:25:30 +00:00
Richard W.M. Jones
53cc0370b2 mllib: Add 'protect' function (like try/finally).
Use the function in the virt-v2v [Windows] module.

This is just refactoring.  There is no visible change in
functionality.
2016-01-31 14:14:37 +00:00
Richard W.M. Jones
db3e2023eb mllib: Move the maybe type (like Haskell Either) to common library.
Just code motion.
2016-01-31 14:01:59 +00:00
Richard W.M. Jones
14d80452dc arm: Disable -Wcast-align warning.
Any modern system can handle unaligned memory access.  On armv7 it's
slightly slower, that's all.
2016-01-29 20:58:46 +00:00
Richard W.M. Jones
8a910136e4 v2v: windows: Remove unused code left over by previous commit.
As this code wasn't exported in the module interface, it cannot have
been used anywhere.

Fixes commit b76f271425.
2016-01-29 12:50:12 +00:00
Richard W.M. Jones
b6a7aaf0d0 v2v: Remove items from TODO which have been implemented already. 2016-01-29 12:41:02 +00:00
Richard W.M. Jones
825ff5d04d Version 1.33.7. 2016-01-29 10:26:27 +00:00
Richard W.M. Jones
b76f271425 v2v: windows: Move all virtio driver installation code to common module.
Add a common module `Windows_virtio' and move all the code related to
finding and installing Windows virtio drivers to this module.

This is just code motion and code refactoring, there is no change in
functionality.
2016-01-29 10:10:18 +00:00
Pino Toscano
0ac8894f62 inotify_add_watch: pass IN_ALL_EVENTS as mask for test
Instead of pass 0x3fffffff as mask value, pass a simplier 0xfff, which
is the value of the IN_ALL_EVENTS define.  This will still catch all
the inotify events, and avoid a EINVAL error with Linux 4.4.
2016-01-29 10:06:33 +01:00
Richard W.M. Jones
6db3c4099f v2v: windows: Update comment about device number key.
Thanks: Vadim Rozenfeld for finding the TechNet documentation
related to this key.
2016-01-29 08:56:10 +00:00
Richard W.M. Jones
b2a10de6db v2v: Add location of SUSE UEFI binaries.
Thanks: Jim Fehlig
2016-01-29 08:52:09 +00:00
Richard W.M. Jones
52e7085d18 ruby: Rename internal C functions with more consistent naming. 2016-01-28 22:06:01 +00:00
Richard W.M. Jones
f9259c7ba4 lua: Rename 'guestfs_lua_' functions to 'guestfs_int_lua_'.
Actually these are all static functions, so they don't really need the
'guestfs_' prefix at all, but using a prefix avoids any possibility of
a collision with a standard C function.

This is a mechanical refactoring.
2016-01-28 21:53:38 +00:00
Richard W.M. Jones
1a9312c743 python: Rename 'py_guestfs_' functions to 'guestfs_int_py_'.
Purely mechanical change, done by a Perl script (hah!)
2016-01-28 21:49:47 +00:00
Richard W.M. Jones
14cd9a031a java: Rename internal C function without guestfs_ prefix. 2016-01-28 21:38:18 +00:00
Richard W.M. Jones
53403fbdef ocaml, virt tools: More consistent naming for C functions.
For functions linked to virt tools, make sure the name of the function
actually matches the virt tool.  Because of the history of moving
functions across tools, some names no longer matched.

For mllib, use `guestfs_int_mllib_' prefix.

For OCaml bindings, use `guestfs_int_ocaml_' prefix.

This commit is by no means complete.  There are many other C functions
in other language bindings which could do with being more consistently
named.

There is no functional change, this is just refactoring.
2016-01-28 21:30:20 +00:00
Richard W.M. Jones
e32a14ceec docs: Remove reference to double underscore, which is no longer used in internal identifiers. 2016-01-28 21:08:01 +00:00
Richard W.M. Jones
4125181681 docs: Rework headings in guestfs-hacking(1) manual page. 2016-01-28 21:08:01 +00:00
Richard W.M. Jones
98332e8c85 docs: Move section about local* files to guestfs-building(1).
Since it is part of the instructions for building libguestfs, it goes
better in the guestfs-building(1) man page.
2016-01-28 21:08:01 +00:00
Pino Toscano
f9e8f3b2d2 lvm: support lvm2 older than 2.02.107
lvm2 2.02.107 adds the -S/--select option used in lvs to filter out only
public LVs (see RHBZ#1278878).  To make this work again with versions
of lvm2 older than that, only on old versions filter out thin layouts
and compose the resulting device strings ourselves.

The filtering done is much simplier than what "-S lv_role=public" will
do, but should be good enough for our need.
2016-01-28 15:38:25 +01:00
Richard W.M. Jones
569ad259b4 v2v: linux: Find dracut if it is located in /usr/bin.
In Fedora 23, dracut moved to /usr/bin.  However we only looked for
/sbin/dracut, so we didn't find it.  You would have seen a failure
like this:

  virt-v2v: error: unable to rebuild initrd
  (/boot/initramfs-4.2.3-300.fc23.x86_64.img) because mkinitrd or dracut was
  not found in the guest

Look for dracut in /usr/bin as well.

Thanks: Arnaud Bougeard.
2016-01-28 13:57:04 +00:00
Pino Toscano
2bccaa3047 python: stop using parens-less print in tests
print "" is no more available in Python 3, and print(...) is available
since Python 2.7; as one of the tests was using print(), use this form
everywhere so the tests can run fine with Python 3.
2016-01-28 14:45:23 +01:00
Richard W.M. Jones
a6c7b39530 v2v: windows: Don't hard code "oem1.inf" string.
Find the next free "oem%d.inf" string.

Thanks: Vadim Rozenfeld for clarifying what we should be doing
in this case.
2016-01-28 13:11:48 +00:00
Richard W.M. Jones
58ce08f36f v2v: Abbreviate a couple of comments.
No functional change.
2016-01-28 13:11:48 +00:00
Richard W.M. Jones
b12f0a809f GCC 6: Avoid warning about logical OR of "equal" expressions.
The warning (see below) is fairly useless.  This modification to the
code avoids it.

inotify.c: In function 'do_inotify_read':
inotify.c:219:32: error: logical 'or' of equal expressions [-Werror=logical-op]
       if (errno == EWOULDBLOCK || errno == EAGAIN) /* End of list. */
                                ^~
2016-01-28 12:37:33 +00:00
Richard W.M. Jones
b1b15dc77d Version 1.33.6. 2016-01-27 17:36:03 +00:00
Richard W.M. Jones
c323bb7db7 p2v: tests: Don't supply os-version in test. 2016-01-27 15:27:06 +00:00
Pino Toscano
c355b748ce actions: mark btrfs test case of vfs_minimum_size as TestRunOrUnsupported
The btrfs implementation of vfs_minimum_size requires
btrfs-progs >= 4.2, erroring with ENOTSUP otherwise; thus mark the btrfs
test case of the vfs_minimum_size tests as TestRunOrUnsupported, so it
will not cause failures if the available btrfs-progs is not enough.
2016-01-27 14:23:48 +01:00
Pino Toscano
ceefa701c6 generator: add TestRunOrUnsupported test type
Create a new TestRunOrUnsupported test type, which represents a test
sequence where a failure with ENOTSUP in the last command only marks the
test as skipped.  To be used mainly when testing features available only
with some versions of helper tools used in the appliance, for example.
2016-01-27 14:17:22 +01:00
Pino Toscano
474e3051c7 btrfs: also check return value of sysroot_path in btrfs_minimum_size
Followup of commit 79ac68030f.
2016-01-27 14:09:16 +01:00
Pino Toscano
79ac68030f btrfs: fix leak in btrfs_minimum_size
Make sure the result of sysroot_path is properly free'd.
2016-01-27 13:45:24 +01:00
Pino Toscano
fa262e2540 btrfs: fix wrapping in message in btrfs_minimum_size 2016-01-27 13:29:16 +01:00
Richard W.M. Jones
3aaa4c9419 p2v: virt-p2v-make-disk: Make os-version parameter optional.
Having to choose the os-version of the virt-p2v disk was confusing.
Users thought it had something to do with the physical machine being
converted.

In some cases, virt-p2v-make-disk can now choose a suitable os-version
for the user.  Usually it's the latest numeric version of Fedora or
Debian, depending on the host distro.  If we don't recognize the host
distro, we bail and ask the user to choose, but this is still an
improvement.
2016-01-27 11:54:09 +00:00
Richard W.M. Jones
42f8c6e3bd p2v: Use $program consistently in virt-p2v-make-disk script. 2016-01-27 11:48:17 +00:00
Richard W.M. Jones
c3ad944555 p2v: Fix typo in virt-p2v-make-disk manual page. 2016-01-27 11:38:09 +00:00
Richard W.M. Jones
683dd5cbab docs: Refresh the guestfs-testing(1) man page.
Require libguestfs >= 1.22.  Testing ancient versions isn't useful.

Add a virt-builder test section.
2016-01-26 22:18:42 +00:00
Richard W.M. Jones
09e29a70e7 docs: Fix headings in guestfs-security(1). 2016-01-26 21:49:04 +00:00
Richard W.M. Jones
e96df6e776 docs: Add security contact information. 2016-01-26 21:45:17 +00:00
Richard W.M. Jones
1b4de75cb0 docs: Refactor list of manual pages in guestfs(3). 2016-01-26 21:38:12 +00:00
Richard W.M. Jones
1b3d3a3589 customize: Remove "useless" sprintf.
Actually the OCaml compiler rewrites all printf functions at compile
time to a series of primitive string operations, so the use of sprintf
here doesn't really matter.  Still, it's a bit tidier not to use
sprintf where it's not needed.

Also this commit contains some code reformatting.

This is just refactoring.
2016-01-26 21:26:23 +00:00
Richard W.M. Jones
81ff8c5d23 p2v: User can click on an interface name to identify the physical interface.
When the user clicks on the second column of the list of network
interfaces, run 'ethtool --identify <if_name> 10', which (on supported
cards) flashes a light on the physical interface for 10 seconds,
allowing it to be identified by the operator.
2016-01-26 17:54:20 +00:00
Richard W.M. Jones
4470f0483b customize: Add support for the APK (Alpine Linux) package manager. 2016-01-26 17:54:20 +00:00
Pino Toscano
7adb8ffa61 inspect: resolve symlinks when detecting architecture
Resolve the paths of the binaries we are looking in the guest to
identify the architecture. This way we can identify also busybox-based
guests such as Alpine Linux, where all the "base" binaries in /bin are
symlinks to busybox.
2016-01-26 17:54:20 +00:00
Richard W.M. Jones
302bba4f3f Version 1.33.5. 2016-01-26 14:04:38 +00:00
Pino Toscano
5aa26e76ea daemon: fold xfs_admin stdout to stderr
Apparent newer versions of that report everything on stdout, including
error messages; since we only print something on failure, fold stdout to
stderr so we can see everything on failure.
2016-01-26 11:25:54 +01:00
Pino Toscano
1d0bd79c08 xfs_admin: do not set lazycounter in tests not checking that
This flag cannot be disabled (yet) in V5 xfs filesystems; since 2 out
of the current 3 tests of xfs_admin check other results than that flag,
avoid setting it when not needed.
2016-01-26 11:23:25 +01:00
Pino Toscano
d2a36f8cbe daemon: improve debugging for "stdout on stderr" flag
When the COMMAND_FLAG_FOLD_STDOUT_ON_STDERR flag is passed to
command*(), indicate that as stdout=e in debugging message.
2016-01-26 11:21:46 +01:00
Pino Toscano
c22dea9871 btrfs_subvolume_show: fix root/toplevel check w/ btrfs-progs >= 4.4
In trfs-progs 4.4 the error message has been changed, and our check did
not work anymore.  Yes, parsing user messages really sucks...
2016-01-25 19:53:42 +01:00
Pino Toscano
08bf961d68 actions: expand partitions for btrfs_image test
Apparently with newer btrfs-progs (seen with 4.4) 100M are not enough
for a btrfs filesystem; hence double the size of the partitions
created in the test of btrfs_image, so now 200M are enough for btrfs.
2016-01-25 19:08:14 +01:00
Richard W.M. Jones
f2e201033a p2v: Use new miniexpect methods to access the handle fields. 2016-01-24 17:01:17 +00:00
Richard W.M. Jones
38edddb8e8 p2v: Resynch miniexpect with upstream.
Upstream miniexpect commit 3df4c0d3e4192cb6bb8e9ed7126346ab6aa98043.
2016-01-24 17:01:17 +00:00
Richard W.M. Jones
86ec266f22 p2v: Handle mexp_close returning -1 correctly.
If a system call fails, this function returns -1 and sets errno.  This
case was not handled correctly.
2016-01-24 17:01:16 +00:00
Richard W.M. Jones
b564e3682b arm: Remove all DTB (device tree) code.
In commit af762e4342 (2015-03-05)
I stopped libguestfs from using the supermin -dtb parameter when
building appliances.

It has not been necessary for quite a long time to specify a DTB,
since qemu itself creates a device tree structure in the guest
(appliance) memory from the devices presented to the guest.  Qemu does
this on the fly each time the guest starts.

As I promised in the commit mentioned above I would remove this code,
and this commit does that (for libguestfs only).
2016-01-22 22:23:25 +00:00
Richard W.M. Jones
1477c95da4 launch: libvirt: Reword an SELinux debug message. 2016-01-22 21:51:18 +00:00
Richard W.M. Jones
bf469bca13 launch: libvirt: Refactor destroy_domain function.
Small rewrite of commit 7e2f2b0b24.  No
functional change.
2016-01-22 21:48:16 +00:00
Richard W.M. Jones
2b9fda2f92 docs: Tested clang, and userspace probes now work. 2016-01-22 15:44:21 +00:00
Richard W.M. Jones
e3ff6507e9 Version 1.33.4. 2016-01-22 13:16:03 +00:00
Richard W.M. Jones
e23b44e2de daemon: Link with cleanups.c.
And remove the cleanup_* functions from guestfsd.c.

This fixes commit d94860d7e8.
2016-01-22 13:08:24 +00:00
Richard W.M. Jones
2cb8e5ddb8 Minor fixes to "daemon: Split out command* functions and CLEANUP_* macros."
This updates commit d94860d7e8.

Thanks: Pino Toscano.
2016-01-22 12:52:33 +00:00
Richard W.M. Jones
ac5fe225a9 Version 1.33.3. 2016-01-22 12:42:57 +00:00
Richard W.M. Jones
d94860d7e8 daemon: Split out command* functions and CLEANUP_* macros.
This allows the command* functions and CLEANUP_* macros to be used
independently from the daemon.
2016-01-22 09:12:17 +00:00
Richard W.M. Jones
b5066c67e0 daemon: Rename daemon/command.c -> daemon/sh.c.
Simply a file rename, no other change.
2016-01-21 14:25:44 +00:00
Richard W.M. Jones
550fdefc3c p2v: Display architecture in the About dialog. 2016-01-21 13:56:13 +00:00
Richard W.M. Jones
6d25ad48e5 p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied.
This allows you to build a 32 bit virt-p2v USB key, even on a 64 bit
host.

Because of problems with the Fedora build system it's unfortunately
not easy to build a 32 bit virt-p2v binary, so this patch punts on
this issue and assumes that the user can supply the binary themselves.
2016-01-21 13:55:16 +00:00
Richard W.M. Jones
d5222a3ab9 p2v: Fix paths to data files in documentation. 2016-01-21 12:39:47 +00:00
Maxim Perevedentsev
e834b7413a New API: part_expand_gpt.
This action moves second(backup) GPT header to the end of the disk.
It is usable in in-place image expanding, since free space after
second GPT header is unusable. To use additional space, we have
to move second header. This is what sgdisk -e does.

However, sgdisk -e may perform additional actions if the partition
table has unexpected params (e.g. if we call sgdisk -e /dev/sda1,
it may fix partition table thus destroying the filesystem).
To prevent such cases, we do a dry-run at first and fail if
additional actions are scheduled.
2016-01-20 17:41:13 +00:00
Roman Kagan
390c68441a convert_windows: uninstall Parallels Tools on first boot
If present, Parallels Tools may stand in the way of proper running the
windows guests in non-Parallels hypervisors, so we're better off
uninstalling them on the first boot into the new environment.

With this patch, the uninstall records for Parallels Tools are looked up
in the registry and, if found, corresponding firstboot actions are
registered, taking special care that those actions are run fully
unattended.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2016-01-20 17:33:24 +00:00
Richard W.M. Jones
e40acef864 Version 1.33.2. 2016-01-20 17:25:09 +00:00
Richard W.M. Jones
4a0905ac36 tests: regressions: Allow test-big-heap to work on machines with less memory.
This test would fail on machines with around 4 GB of free memory.
Adjust the test so it would now work on such machines (it will however
still fail on a machine with around 2 GB of free memory).
2016-01-20 17:05:53 +00:00
Richard W.M. Jones
ce5607895f docs: Add requirement on ncurses.
Previously missing from the requirements list.
2016-01-20 16:34:34 +00:00
Richard W.M. Jones
9310fabd26 docs: Add guestfs-building(1) man page.
This contains instructions for building libguestfs from source.
2016-01-20 13:42:38 +00:00
Richard W.M. Jones
50f838de31 p2v, v2v: Move HACKING documentation to guestfs-hacking(1) manual page. 2016-01-20 12:05:22 +00:00
Maxim Perevedentsev
dce3b4649d resize: preserve GPT disk GUID.
Changed disk GUID makes some OSes fail to boot.
To enable virt-resize to support such OSes we
have to preserve disk GUID.
2016-01-19 17:59:58 +00:00
Maxim Perevedentsev
1af51b9b02 New API: part_set_disk_guid_random.
Provides a way to set a new randomly-generated GUID to disk.
2016-01-19 17:59:58 +00:00
Maxim Perevedentsev
035936a038 New API: part_get_disk_guid and part_set_disk_guid.
Some OSes (e.g. Windows Server 2012 R2) fail to boot if the disk
GPT GUID has changed. To preserve disk guid e.g. during virt-resize,
we need a way to get/set disk GUIDs.
2016-01-19 17:59:58 +00:00
Richard W.M. Jones
7e2f2b0b24 lib: Handle slow USB devices more gracefully.
Libvirt has a fixed 15 second timeout for qemu to exit.  If qemu is
writing to a slow USB key, it can hang (in D state) for much longer
than this - many minutes usually.

The solution is to check specifically for the libvirt EBUSY error when
this happens, and retry the virDomainDestroyFlags operation
(indefinitely).

See also the description here:
https://www.redhat.com/archives/libvir-list/2016-January/msg00767.html

Similar to the following OpenStack Nova commit:
http://git.openstack.org/cgit/openstack/nova/commit/?id=3907867

Thanks: Kashyap Chamarthy and Daniel Berrange.
2016-01-19 17:59:58 +00:00
Richard W.M. Jones
c3ebc0a837 launch: libvirt: In error messages, display err->int1, don't display domain.
The err->domain field is essentially random from the point of view
of libguestfs.

The err->int1 field has some useful information in some circumstances:
it has the errno value from the failed system call.
2016-01-19 16:04:02 +00:00
Richard W.M. Jones
d029fa0507 Revert "p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied."
This won't work unless we also build a 32 bit virt-p2v binary.

This reverts commit d723b352f8.
2016-01-19 16:04:02 +00:00
Pino Toscano
40b5698388 daemon: resolve paths for ll and llz
Resolve in the guest the given path, so absolute symlinks can be listed
using appliance tools without resolution errors.
Also remove the note about the possibility to escape the sysroot using
ll and llz, since realpath won't return paths outside sysroot.

Fixes part of RHBZ#1293276.
2016-01-19 09:46:20 +01:00
Richard W.M. Jones
3f376fa513 p2v: virt-p2v-make-disk: Use a more robust way to get the latest kernel version.
Fedora/i686 does not have a package called 'kernel', so the command
'rpm -q kernel' fails.  In any case the method used wasn't exactly
very robust.

The new method is based on how febootstrap used to do this.

This updates commit d723b352f8.
2016-01-18 17:44:12 +00:00
Maxim Perevedentsev
4a7b32a7e2 Add -f option to resize2fs -P in vfs_minimum_size.
Sometimes the user wants to know minimum size
for dirty (e.g. mounted) filesystems. In this case,
resize2fs -P will require calling e2fsck -f, while
"in general, it is not safe to run e2fsck on mounted filesystems".

Since resize2fs -P does not modify filesystem, we force it
to display (probably approximate) minimum size.
2016-01-18 16:49:18 +00:00
Richard W.M. Jones
d723b352f8 p2v: virt-p2v-make-disk: Allow --arch parameter to be supplied.
This allows you to easily build a 32 bit virt-p2v USB key, even on a
64 bit host.
2016-01-18 12:12:58 +00:00
Richard W.M. Jones
727ac63dea Update gnulib.
The version we picked just before 1.32 was released suffers from:

  test-mbrtowc.c:49: assertion 'ret == (size_t)(-2)' failed

on RHEL 7.  See this thread for details:

  http://comments.gmane.org/gmane.comp.lib.gnulib.bugs/35567
2016-01-14 17:05:57 +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
7bccd0593f tests/mountable: Allow test to be skipped. 2016-01-12 18:26:33 +00:00
Richard W.M. Jones
c1799541d3 Version 1.33.1. 2016-01-11 14:06:42 +00: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
bb27fc1c0a podwrapper: Generate consistent WARNING sections (RHBZ#1293527). 2016-01-11 13:42:49 +00:00
Richard W.M. Jones
6fa4d983a3 podwrapper: Enforce that every manual page must have a DESCRIPTION section.
For every user command line tool (eg. guestfish or virt-cat) require
that the manual page has a DESCRIPTION section.  This doesn't apply to
non-CLI man pages (eg. guestfs-perl, guestfs-faq).
2016-01-11 13:42:49 +00:00
Richard W.M. Jones
3b8322e18c customize: Document missing command line parameters in the synopsis.
I noticed that the --attach option was not covered in the synopsis.
This commit documents all of the missing command line parameters in
the synopsis.
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
64af88a1b7 v2v: Unquote path when removing VirtualBox Guest Additions (RHBZ#1296606). 2016-01-11 13:38:36 +00:00
Richard W.M. Jones
2e728ed0dc p2v: Break long lines when displaying virt-v2v output in GUI. 2016-01-08 13:12:01 +00:00
Richard W.M. Jones
abd41320e1 tests: Allow test-disk-create.sh to be skipped. 2016-01-06 17:05:28 +00:00
Richard W.M. Jones
980dc9deaf regressions: test-big-heap: Allow this test to be skipped. 2016-01-06 16:04:46 +00:00
Richard W.M. Jones
de94d01692 regressions: test-big-heap: Add comment about a failure of this test. 2016-01-06 16:04:23 +00:00
Richard W.M. Jones
6afde4fd34 Version 1.33.0. 2016-01-06 11:45:27 +00:00
Richard W.M. Jones
f674520651 hacking: Fix git push command for pushing stable branch.
This fixes commit 5218f54a54.
2016-01-06 11:35:34 +00:00
790 changed files with 451801 additions and 248640 deletions

47
.gitignore vendored
View File

@@ -18,6 +18,7 @@
*.o
*.orig
*.patch
*.pyc
*.rej
*.swp
*.trs
@@ -26,6 +27,7 @@ bindtests.tmp
cscope.out
.deps
.dirstamp
dll*.so
.gdb_history
.libs
Makefile
@@ -143,6 +145,7 @@ Makefile.in
/diff/stamp-virt-diff.pod
/diff/virt-diff
/diff/virt-diff.1
/docs/guestfs-building.1
/docs/guestfs-faq.1
/docs/guestfs-hacking.1
/docs/guestfs-internals.1
@@ -151,6 +154,8 @@ Makefile.in
/docs/guestfs-release-notes.1
/docs/guestfs-security.1
/docs/guestfs-testing.1
/docs/internal-documentation.pod
/docs/stamp-guestfs-building.pod
/docs/stamp-guestfs-faq.pod
/docs/stamp-guestfs-hacking.pod
/docs/stamp-guestfs-internals.pod
@@ -202,6 +207,7 @@ Makefile.in
/fish/stamp-virt-copy-out.pod
/fish/stamp-virt-tar-in.pod
/fish/stamp-virt-tar-out.pod
/fish/test-prep.sh
/fish/virt-copy-in.1
/fish/virt-copy-out.1
/fish/virt-tar-in.1
@@ -219,6 +225,7 @@ Makefile.in
/fuse/test-guestmount-fd
/fuse/test-guestunmount-fd
/generator/.depend
/generator/bytes.ml
/generator/files-generated.txt
/generator/generator
/generator/.pod2text.data*
@@ -284,9 +291,11 @@ Makefile.in
/make-fs/virt-make-fs.1
/missing
/mllib/.depend
/mllib/bytes.ml
/mllib/common_gettext.ml
/mllib/common_utils_tests
/mllib/dummy
/mllib/getopt_tests
/mllib/guestfs_config.ml
/mllib/JSON_tests
/mllib/libdir.ml
@@ -315,12 +324,15 @@ Makefile.in
/p2v/dependencies.redhat
/p2v/dependencies.suse
/p2v/launch-virt-p2v
/p2v/stamp-test-virt-p2v-pxe-data-files
/p2v/stamp-test-virt-p2v-pxe-hostkey
/p2v/stamp-test-virt-p2v-pxe-kernel
/p2v/stamp-test-virt-p2v-pxe-userkey
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
/p2v/stamp-virt-p2v-make-kiwi.pod
/p2v/test-virt-p2v-pxe.authorized_keys
/p2v/test-virt-p2v-pxe.id_rsa
/p2v/test-virt-p2v-pxe.id_rsa.pub
/p2v/test-virt-p2v-pxe.img
@@ -331,10 +343,14 @@ Makefile.in
/p2v/test-virt-p2v-pxe.vmlinuz
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v/virt-p2v.i686
/p2v/virt-p2v.img
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/p2v/virt-p2v-make-kiwi
/p2v/virt-p2v-make-kiwi.1
/perl/_build
/perl/bindtests.pl
/perl/blib
@@ -364,12 +380,6 @@ Makefile.in
/php/extension/configure.in
/php/extension/env
/php/extension/guestfs_php.c
/php/extension/guestfs_php_*.diff
/php/extension/guestfs_php_*.exp
/php/extension/guestfs_php_*.log
/php/extension/guestfs_php_*.out
/php/extension/guestfs_php_*.php
/php/extension/guestfs_php_*.sh
/php/extension/install-sh
/php/extension/libtool
/php/extension/ltmain.sh
@@ -382,7 +392,13 @@ Makefile.in
/php/extension/php-for-tests.sh
/php/extension/php_guestfs_php.h
/php/extension/run-tests.php
/php/extension/tests/guestfs_php_bindtests.phpt
/php/extension/tests/guestfs_*.diff
/php/extension/tests/guestfs_*.exp
/php/extension/tests/guestfs_*.log
/php/extension/tests/guestfs_*.out
/php/extension/tests/guestfs_*.php
/php/extension/tests/guestfs_*.sh
/php/extension/tests/guestfs_090_bindtests.phpt
/php/extension/tmp-php.ini
/pick-guests.pl
/po-docs/*/*.1
@@ -407,6 +423,7 @@ Makefile.in
/python/guestfs-internal-all.h
/python/guestfs-internal-frontend-cleanups.h
/python/guestfs-internal-frontend.h
/python/ignore-value.h
/python/MANIFEST
/python/__pycache__
/python/setup.py
@@ -464,7 +481,9 @@ Makefile.in
/src/structs-compare.c
/src/structs-copy.c
/src/structs-free.c
/src/test-utils
/src/structs-print.c
/src/structs-print.h
/src/unit-tests
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
@@ -504,8 +523,6 @@ Makefile.in
/tests/mountable/test-internal-parse-mountable
/tests/parallel/test-parallel
/tests/protocol/test-error-messages
/tests/qemu/qemu-boot
/tests/qemu/qemu-speed-test
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/tests/regressions/rhbz914931
@@ -552,21 +569,29 @@ Makefile.in
/test-tool/libguestfs-test-tool.1
/test-tool/libguestfs-test-tool-helper
/test-tool/stamp-libguestfs-test-tool.pod
/tools/stamp-virt-*.pod
/tools/virt-*.1
/utils/boot-analysis/boot-analysis
/utils/boot-analysis/boot-analysis.1
/utils/boot-benchmark/boot-benchmark
/utils/boot-benchmark/boot-benchmark.1
/utils/qemu-boot/qemu-boot
/utils/qemu-speed-test/qemu-speed-test
/v2v/.depend
/v2v/centos-6.img
/v2v/centos-7.0.img
/v2v/fedora-20.img
/v2v/fedora-23.img
/v2v/fake-virtio-win.iso
/v2v/oUnit-*
/v2v/rhel-5.10.img
/v2v/rhel-6.5.img
/v2v/rhel-7.0.img
/v2v/rhel-7.2.img
/v2v/stamp-virt-v2v.pod
/v2v/stamp-virt-v2v-copy-to-local.pod
/v2v/test-harness/.depend
/v2v/test-harness/META
/v2v/test-harness/dllv2v_test_harness.so
/v2v/test-harness/stamp-virt-v2v-test-harness.pod
/v2v/test-harness/virt-v2v-test-harness.1
/v2v/v2v_unit_tests

Submodule .gnulib updated: 26989d00c8...348402f2aa

View File

@@ -1,7 +0,0 @@
^test-data/
^COPYING(.LIB)?$
^\.gitmodules$
(^|\/)ChangeLog[^/]*$
(^|\/)(?:GNU)?[Mm]akefile[^/]*$
\.(am|mk)$
^po/Rules-quot$

View File

@@ -1 +0,0 @@
^examples/to-xml\.c$

View File

@@ -1,2 +0,0 @@
^examples/hello.c
^examples/to-xml.c

View File

@@ -1,2 +0,0 @@
^.*\.java$
^.*\.pl$

View File

@@ -1 +0,0 @@
^examples/to-xml\.c$

View File

@@ -1 +0,0 @@
^examples/to-xml\.c$

View File

@@ -1,2 +0,0 @@
test-data/binaries/bin-win64.exe
*.pod

View File

@@ -1,4 +1,5 @@
Adam Huffman
Andrea Bolognani
Angus Salkeld
Ani Peter
Bastien ROUCARIÈS
@@ -14,6 +15,7 @@ Daniel Cabrera
Daniel Exner
Dave Vasilevsky
David Sommerseth
Dawid Zamirski
Douglas Schilling Landgraf
Eric Blake
Erik Nolte
@@ -31,12 +33,14 @@ John Eckersberg
Joseph Wang
Karel Klíč
Kashyap Chamarthy
Lars Kellogg-Stedman
Lee Yarwood
Marcin Gibula
Margaret Lewicka
Maros Zatko
Martin Kletzander
Masami HIRATA
Matteo Cafasso
Matthew Booth
Maxim Koltsov
Maxim Perevedentsev
@@ -51,6 +55,7 @@ Nikos Skalkotos
Olaf Hering
Or Goshen
Paul Mackerras
Pavel Butsykin
Pino Toscano
Piotr Drąg
Qin Guan
@@ -63,6 +68,7 @@ Shahar Havivi
Shahar Lev
Shankar Prasad
Thomas S Hatch
Tomáš Golembiovský
Török Edwin
Wanlong Gao
Wulf C. Krueger

508
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2016-01-06
Last updated: 2016-07-27
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
@@ -20,9 +20,6 @@ When reporting a new bug, please check:
--------------------------------------------------
Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
554829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=554829
SELinux handling could be done better.
572337 NEW https://bugzilla.redhat.com/show_bug.cgi?id=572337
libguestfs should support gptsync
@@ -71,9 +68,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
848926 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848926
virt-v2v should verify that the RHEV-M domain is an export storage domain
855058 NEW https://bugzilla.redhat.com/show_bug.cgi?id=855058
RFE: virt-p2v: display more information about storage devices
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
libguestfs 'file-architecture' returns 'ARM' for arm binaries
@@ -95,12 +89,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
903987 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903987
Command "acl-set-file" is inconvenient to use
906766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906766
virt-resize cannot resize RHEL 5 guest with GPT partition table type
906777 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906777
In tests, set_label sometimes fails
910115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910115
RFE: support ntfsresize --bad-sectors option in virt-resize
@@ -131,9 +119,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
982516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982516
sh "rpm -Va" fails because apparently /dev/shm is not created/bind-mounted correctly
983969 NEW https://bugzilla.redhat.com/show_bug.cgi?id=983969
RFE: virt-sysprep should be SELinux-aware
986242 NEW https://bugzilla.redhat.com/show_bug.cgi?id=986242
golang bindings cannot be compiled if golang-guestfs package is installed
@@ -146,9 +131,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
991830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991830
virt-resize throws ambiguous error when /dev/mapper/VG-LV path is used
994965 NEW https://bugzilla.redhat.com/show_bug.cgi?id=994965
libguestfs doesn't work on armv7hl
1019388 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1019388
firstboot scripts (virt-builder, virt-sysprep) don't work for Debian 6 & 7 guests
@@ -170,9 +152,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1040912 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1040912
[ARM] mount-local / FUSE support does not seem to work at all
1051694 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1051694
libguestfs FTBFS on Ubuntu saucy
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
@@ -191,9 +170,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1079734 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079734
Tiny Core Linux is not recognized by libguestfs inspection
1089100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1089100
NetworkManager avc unlink denied for resolv.conf after using --selinux-relabel
1092583 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1092583
guestfish removes query string from URI
@@ -224,9 +200,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1103444 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1103444
virt-v2v of RHEL AS release 3(Taroon) VMware VM fails because rpm binary segfaults
1107317 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1107317
Ubuntu package fails to depend on linux-image-extra (causes missing virtio-serial)
1108171 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1108171
RFE: virt-builder should be able to build PXE images for baremetal installation
@@ -239,9 +212,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1129110 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1129110
Libguestfs NTFS not setting ACLs
1134726 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1136371 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1136371
add apt-rpm support to supermin
@@ -251,9 +221,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1150298 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1150298
ARM 32 bit on Ubuntu: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1151902 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151902
RFE: virt-v2v should do something with <interface type='direct'> (either virtualize it or give an error)
@@ -272,12 +239,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1152821 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152821
Can not end a running command in virt-rescue by press ^C or other keys, the only way is to exit virt-rescue
1152825 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152825
virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance
1152832 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152832
virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance
1152833 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152833
llz give ? for the security context of a file, which is wrong
@@ -291,16 +252,7 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
RFE: Allow uploading virt-v2v converted images directly to Cinder
1161019 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1161019
Remove rhev related files(rhsrvany.exe and rhev-apt.exe) after conversion of windows guests to kvm
1164765 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1164765
[RFE] Add a new API to scan devices for a btrfs filesystem
1164766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1164766
[RFE] Add a new API to scan devices for a btrfs filesystem
1167916 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167916
P2V: invalid conversion server prints unexpected end of file waiting for password prompt.
RFE: Only install RHEV-APT if virt-v2v -o rhev/-o vdsm option is used
1170771 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1170771
virt-sparsify fails to sparsify CentOS 7 SWAP
@@ -320,21 +272,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1177460 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177460
virt-customize does not work with fedora atomic
1183493 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1183493
RFE: virt-rescue: add a flag to autorun the suggested mount commands and chroot, suggested with --suggest
1186935 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1186935
libguestfs cannot inspect recent Fedora / RHEL >= 7 when /usr is a separate partition
1190666 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1190666
virt-builder should get RHEL images from RHN
1193238 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1193238
Specifying a --source option doesn't overwrite the built-in templates
1195278 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1195278
libguestfs-test-tool fails in nested environment
1195881 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1195881
virt-builder can't docker pull
@@ -347,45 +287,24 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1203816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203816
virt-sysprep should error if a command line flag is not used because the operation is disabled
1203898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203898
Support inspecting docker images without /etc/fstab
1212507 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212507
sfdisk-disk-geometry fails to display the disk geometry from the partition
1212546 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212546
rsync-out fails to synchronize filesystem with remote filesystem
1212556 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212556
The system release info get from 'utsname' is different from the host
1212679 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212679
Failed to create a augeas handle with flag=8 because of custom lens (guestfs_lvm_conf.aug)
1213274 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213274
Improve the misunderstanding error messages of virt-tar-in/virt-tar-out/virt-copy-in/virt-copy-out
1213319 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213319
[RFE]virt-v2v support convert guest with all interface types to others
1213701 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213701
Fail to import win8/win2012 to rhev with error "selected display type is not supported"
1213844 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213844
guestfish should reset the console on ^Z
1215803 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1215803
'/var/lib/random-seed: No such file or directory' with virt-tools on images with bind-mount of /var
1216296 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1216296
rm-rf does not follow symlinks
1217959 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1217959
journal logging support
1218766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1218766
Rebase libguestfs in RHEL 7.3
1220751 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1220751
fusermount returns EBUSY, but unmounts the disk anyway, confusing guestunmount
@@ -395,18 +314,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1224795 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1224795
On Ubuntu, virt-builder --install and --update cannot use the network
1224903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1224903
'guestmount: no operating system was found on this disk' for rhel7 be guest on ppc64le host
1227599 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1227599
P2V invalid password prints unexpected end of file waiting for command prompt.
1229386 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1229386
virt-p2v in non-GUI mode doesn't show any conversion progress or status
1230414 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1230414
Windows inspection fails with hivex_close: do_hivex_close: you must call 'hivex-open' first to initialize the hivex handle
1232477 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1232477
guestfs_add_drive_opts incorrectly quotes query parameters
@@ -419,9 +326,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1242028 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1242028
virt-make-fs cannot set g+s bit on vfat
1245326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1245326
virt-v2v tests: warning: the target hypervisor does not support a x86_64 KVM guest
1250670 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1250670
libguestfs-test-tool succeeds but guestmount fails
@@ -431,21 +335,12 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1252701 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1252701
virt-p2v cannot convert older HP Smart Array servers which require cciss driver
1253373 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1253373
Provide version of virt-p2v ISO based on RHEL 6
1253593 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1253593
[RFE]virt-p2v support conversion of citrix xen guest
1255610 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1255610
W2K8R2 FC guest has no VGA driver on RHEV
1262491 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1262491
virt-builder fail to resize or recognize coreos
1264332 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1264332
Parameter '--no-trim all' doesn't work when converting guest via virt-v2v command
1265588 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1265588
Windows guest with dynamic disk cannot show RAID(E:) Disk on rhev after conversion by virt-p2v
@@ -455,39 +350,102 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1272119 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1272119
virt-v2v on W2K3 32-bit image fails
1273991 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1273991
write-append doesn't expand new lines properly when used in guestfish command line
1277744 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1277744
When a virtual machine from VirtualBox is launched, virt-filesystems shows error, instead of displaying partitions
1284191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1284191
virt-builder cgroup error when running docker
1287826 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1287826
Remove virt-v2v support for ppc64le
1291055 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291055
v2v: Conversion of VM from VMware environment failed with "HTTP/1.1 404 Not Found".
1291339 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291339
[RFE] Add support for layered/composable images in virt-builder repos
1291715 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291715
test suite failure: libguestfs: error: mkfs_btrfs: /dev/sda1: not enough free space
1292437 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1292437
Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
1292710 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1292710
i686 qemu guest install of Fedora 23 fails or does not boot properly
1293271 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1293271
virt-sysprep --delete fails to delete a symbolic link to a dir
1293516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1293516
rm-rf can not delete files and dirs in symbolic link dir
1294955 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1294955
set-label fails to set some unicode characters as the NTFS filesystem label
1301525 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1301525
ll fails to list a symbolic link pointing to a non-existing file
1308535 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1308535
RFE: v2v: Copy bios.hddOrder to target
1311890 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1311890
virt-v2v: error: libguestfs error: hivex_open: hivex failed to open /Windows/System32/config/SOFTWARE: Operation not supported
1314739 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1314739
The X server of Xen rhel5.11 can't start successfully after converted by virt-p2v
1317180 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1317180
virt-sysprep fails with immutable files
1318922 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1318922
network name mangling after virt-v2v conversion causes old-style network scripts to fail
1319086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1319086
libguestfs-java: mismatch class version vs java dependency
1322837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1322837
Setting LIBGUESTFS_HV causes security context to be reset
1336627 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1336627
Convert rhel6.8 x86 iscsi-qla4xxx host by virt-p2v failed with control conversion closed by remote
1337052 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1337052
Can't see iscsi-be2iscsi storage on the p2v client
1337865 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1337865
Part-init and part-add failed to create partition with mac parttype on aarch64
1340312 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1340312
Installing packages with subscription manager results in AVC errors
1341619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1341619
Sendkey"ctrl+alt+detele" is not useful at p2v client GUI mode
1346818 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1346818
RFE: virt-get-kernel should be able to extract the kernel command line too
1347830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1347830
virt-edit on domains over remote transport attempts to edit a local path
1350762 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1350762
Xterm's scroll bar can't work in p2v client if connect machine via virtual console
1351000 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1351000
virt-customize --commands-from-file will fail if there is an extra blank in the file
1351352 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1351352
SELinux relabel fails (due to read-only / ?) on simple Fedora 24 virt-builder image
1354507 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1354507
virt-v2v conversions from vCenter do not consistently obey the proxy environment variables
1354509 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1354509
v2v: Map Windows 8.1 client to Windows 8.1 in oVirt
1356550 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1356550
QXL driver can't be installed automatically in win7sp1 guest after converted by v2v
1357427 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1357427
virtio driver can't be installed for netwrok automatically in win2012 guest sometimes when convert the guest using virt-v2v by auto
1358142 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1358142
Some info will show when convert guest to libvirt by virt-v2v with parameter --quiet
1358332 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1358332
virt-p2v to become supported tool in RHEL 7.3
1359086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1359086
Rebase libguestfs in RHEL 7.4
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
@@ -530,6 +488,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1130506 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
1134726 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1141631 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1141631
[RFE] virt-v2v should support convert a guest to a dir-pool with using pool's uuid
@@ -542,109 +503,73 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1152369 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1152369
virt-v2v failed to convert RHEL 6.7 UEFI guest: no grub1/grub-legacy or grub2 configuration file was found
1190669 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1190669
Support virt-v2v conversion of Windows > 7
1164765 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1164765
[RFE] Add a new API to scan devices for a btrfs filesystem
1167623 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Remove "If reporting bugs, run virt-v2v with debugging enabled .." message when running virt-p2v
1183493 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1183493
RFE: virt-rescue: add a flag to autorun the suggested mount commands and chroot, suggested with --suggest
1198344 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1198344
[RFE] virt-builder should support download resume
(176 bugs)
1213844 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1213844
guestfish should reset the console on ^Z
(166 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
1064041 POST https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1099976 POST https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message with gnupg2
1164708 POST https://bugzilla.redhat.com/show_bug.cgi?id=1164708
set-label can only set <=127 bytes for btrfs and <=126 bytes for ntfs filesystem which not meet the help message. Also for ntfs it should give a warning message when the length >128 bytes
1173695 POST https://bugzilla.redhat.com/show_bug.cgi?id=1173695
RFE: allow passing in a pre-opened libvirt connection from python
1174551 POST https://bugzilla.redhat.com/show_bug.cgi?id=1174551
"lstatnslist" and "lstatlist" don't give an error if the API is used wrongly
1176801 POST https://bugzilla.redhat.com/show_bug.cgi?id=1176801
File /etc/sysconfig/kernel isn't updated when convert XenPV guest with regular kernel installed
1180769 POST https://bugzilla.redhat.com/show_bug.cgi?id=1180769
Security context on image file gets reset
1225789 POST https://bugzilla.redhat.com/show_bug.cgi?id=1225789
Wrong video driver is installed for rhel5.11 guest after conversion to libvirt
1229119 POST https://bugzilla.redhat.com/show_bug.cgi?id=1229119
Unrelated info in fstab makes virt-v2v fail with unclear error info
1238053 POST https://bugzilla.redhat.com/show_bug.cgi?id=1238053
v2v:Duplicate disk target set when convert guest with cdrom attached
1242853 POST https://bugzilla.redhat.com/show_bug.cgi?id=1242853
mount-loop failed to setup loop device: No such file or directory
1260801 POST https://bugzilla.redhat.com/show_bug.cgi?id=1260801
virt-builder --ssh-inject doesn't set proper permissions on created files
1264835 POST https://bugzilla.redhat.com/show_bug.cgi?id=1264835
ppc64le: virt-customize --install fail to detect the guest arch
1267032 POST https://bugzilla.redhat.com/show_bug.cgi?id=1267032
guestfish copy-in command behaves oddly/unexpectedly with wildcards
1277074 POST https://bugzilla.redhat.com/show_bug.cgi?id=1277074
Virt-p2v client shouldn't present the vdsm option because it's not usable
1277122 POST https://bugzilla.redhat.com/show_bug.cgi?id=1277122
RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefully or ungracefully)
1290755 POST https://bugzilla.redhat.com/show_bug.cgi?id=1290755
guestfish should be able to handle LVM thin layouts
1293527 POST https://bugzilla.redhat.com/show_bug.cgi?id=1293527
There should be a reminder to avoid user to edit a guest image by multiple tools at the same time in guestfish man page
1294956 POST https://bugzilla.redhat.com/show_bug.cgi?id=1294956
set-label returns wrong error message when set the ext3/ext4 filesystem label
1359652 POST https://bugzilla.redhat.com/show_bug.cgi?id=1359652
Fail to inspect Windows ISO file
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
1156298 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1156298
Remove files in package libguestfs-bash-completion, these files are bash completion files, some of the virt tool completion are already implement in another file, so can remove its completion file
1173695 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1173695
RFE: allow passing in a pre-opened libvirt connection from python
1166057 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1166057
btrfs filesystem will not work well if you create the filesystem with multiple disks at the same time, such as: mkfs-btrfs "/dev/sda1 /dev/sdb1"
1167623 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Remove "If reporting bugs, run virt-v2v with debugging enabled .." message when running virt-p2v
1227609 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1227609
virt-p2v: Using "Back" button causes output list to be repopulated multiple times
1239154 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1239154
appliance fails to start with "supermin: ext2fs_file_write: /var/log/tallylog: Could not allocate block in ext2 filesystem"
1020950 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1020950
CVE-2013-4419 libguestfs: insecure temporary directory handling for guestfish's network socket [epel-5]
1213324 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1213324
virt-v2v: warning: unknown guest operating system: windows windows 6.3 when converting win8,win8.1,win2012,win2012R2 to rhev
1190669 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1190669
Support virt-v2v conversion of Windows > 7
1213691 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1213691
Win2012R2 guest fails to boot on iscsi data domain after conversion by virt-v2v
(28 bugs)
1239154 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1239154
appliance fails to start with "supermin: ext2fs_file_write: /var/log/tallylog: Could not allocate block in ext2 filesystem"
1277122 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1277122
RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefully or ungracefully)
1342398 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1342398
Convert a guest from RHEL by virt-v2v but its origin info shows RHEV at rhevm
1352761 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1352761
Virt-manager can't show OS icons of win7/win8/ubuntu guest.
(9 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
1164729 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164729
set-label can only set <=63 bytes for btrfs and ntfs filesystem which not meet the help message. Also for btrfs and ntfs it should give a warning message when the length exceed the limited length
855058 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=855058
RFE: virt-p2v: display more information about storage devices
1064041 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1099976 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message with gnupg2
1156298 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1156298
Remove files in package libguestfs-bash-completion, these files are bash completion files, some of the virt tool completion are already implement in another file, so can remove its completion file
1164708 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164708
set-label can only set <=127 bytes for btrfs and <=126 bytes for ntfs filesystem which not meet the help message. Also for ntfs it should give a warning message when the length >128 bytes
1165564 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165564
Provide Reboot/Shutdown button after virt-p2v
@@ -652,23 +577,59 @@ These bugs are in the VERIFIED state.
1165569 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165569
Disable "cancel conversion" button after virt-p2v conversion finished
1166057 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1166057
btrfs filesystem will not work well if you create the filesystem with multiple disks at the same time, such as: mkfs-btrfs "/dev/sda1 /dev/sdb1"
1167601 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167601
"Conversion was successful" pop out even virt-p2v fails
1167774 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167774
virt-p2v fails with error:"nbd.c:nbd_receive_negotiate():L501: read failed"
1216298 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1216298
'inspect-get-icon' fails to get the icon form the rhel7.1 image
1167916 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167916
P2V: invalid conversion server prints unexpected end of file waiting for password prompt.
1216305 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1216305
virt-inspector fails to detect the rhel7 images
1174551 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1174551
"lstatnslist" and "lstatlist" don't give an error if the API is used wrongly
1218934 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1218934
virt-sparsify: read all the output from 'qemu-img --help'
1176801 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1176801
File /etc/sysconfig/kernel isn't updated when convert XenPV guest with regular kernel installed
1229305 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229305
virt-sysprep at cleanup deletes /var/spool/at/.SEQ which results in failing at
1180769 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1180769
Security context on image file gets reset
1213324 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1213324
virt-v2v: warning: unknown guest operating system: windows windows 6.3 when converting win8,win8.1,win2012,win2012R2,win10 to rhev
1213701 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1213701
Fail to import win8/win2012 to rhev with error "selected display type is not supported"
1218766 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1218766
Rebase libguestfs in RHEL 7.3
1225789 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1225789
Wrong video driver is installed for rhel5.11 guest after conversion to libvirt
1227599 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1227599
P2V invalid password prints unexpected end of file waiting for command prompt.
1227609 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1227609
virt-p2v: Using "Back" button causes output list to be repopulated multiple times
1229119 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229119
Unrelated info in fstab makes virt-v2v fail with unclear error info
1229386 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229386
virt-p2v in non-GUI mode doesn't show any conversion progress or status
1238053 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1238053
v2v:Duplicate disk target set when convert guest with cdrom attached
1242853 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1242853
mount-loop failed to setup loop device: No such file or directory
1260801 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1260801
virt-builder --ssh-inject doesn't set proper permissions on created files
1261242 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1261242
virt-v2v should prevent using '-of' option appears twice on the command line
@@ -679,6 +640,129 @@ These bugs are in the VERIFIED state.
1262959 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1262959
virt-builder/virt-customize set password does not work
(12 bugs)
1264835 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1264835
ppc64le: virt-customize --install fail to detect the guest arch
1267032 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1267032
guestfish copy-in command behaves oddly/unexpectedly with wildcards
1277074 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1277074
Virt-p2v client shouldn't present the vdsm option because it's not usable
1287826 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1287826
Remove virt-v2v support for ppc64le
1290755 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1290755
guestfish should be able to handle LVM thin layouts
1292437 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1292437
Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
1293527 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1293527
There should be a reminder to avoid user to edit a guest image by multiple tools at the same time in guestfish man page
1296606 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1296606
virt-v2v doesn't remove VirtualBox additions correctly because of file quoting
1306557 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1306557
Running 'git clone' in virt-builder or virt-customize results in an error message
1308769 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1308769
virt-v2v does not copy additional disks to Glance
1309580 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1309580
OS name of win8.1 x64 guest shows incorrect in rhevm3.6 general info
1309619 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1309619
Wrong warning info "use standard VGA" shows when converting windows > 7 by virt-v2v
1309706 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1309706
error: internal error: Invalid floppy device name: hdb
1309796 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1309796
Filter perl provides
1311373 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1311373
Fail to install QXL driver for windows 2008r2 and win7 guest after conversion by virt-v2v
1312254 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1312254
virt-v2v -o libvirt doesn't preserve or use correct <graphics type="vnc|spice">
1314244 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1314244
RFE: virt-p2v log window should process colour escapes and backspaces
1315237 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1315237
Remove reference info about --dcpath in virt-v2v manual page
1316479 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1316479
v2v cmd cannot exit and "block I/O error in device 'appliance': No space left on device (28)" is printed when specified "-v -x"
1318440 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1318440
virt-sysprep will fail detecting OS if "/usr" is a distinct partition mounted in "/" via fstab
1325825 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1325825
virt-v2v should prevent using multiple '-b' and '-n' option appears on the command line
1326266 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1326266
virt-v2v should prevent multiple conflicting for "-oa "
1328766 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1328766
Remove --in-place option in virt-v2v help
1332025 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1332025
Inspection does not parse /etc/redhat-release containing "Derived from Red Hat Enterprise Linux 7.1 (Source)"
1340407 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1340407
Multiple network ports will not be aligned at p2v client
1340464 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1340464
[RFE] Suggestion give user a reminder for "Cancel conversion" button
1340809 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1340809
Testing connection timeout when input regular user of conversion server with checked "use sudo......"button
1341564 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1341564
virt-p2v spinner should be hidden when it stops spinning
1341608 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1341608
Ethtool command is not supported on p2v client
1341984 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1341984
virt-get-kernel prompts an 'invalid value' error when using --format auto
1342337 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1342337
Should remind a warning about disk image has a partition when using virt-p2v-make-disk
1342447 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1342447
Ifconfig command is not supported on p2v client
1343167 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1343167
Failure when disk contains an LV with activationskip=y
1343414 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1343414
Failed SSH to conversion server by ssh identity http url at p2v client
1343423 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1343423
[RFE]Should give a better description about 'curl error 22' when failed using ssh identity http url at p2v client
1345809 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1345809
virt-customize --truncate-recursive should give an error message when specifying a no-existing path
1345813 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1345813
virt-sysprep --install always failed to install the packages specified
1348900 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1348900
virt-p2v should update error prompt when 'Test connection' with a non-existing user in conversion server
1349237 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1349237
virt-inspector can not get windows drive letters for GPT disks
1349342 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1349342
Error info is not clear when failed ssh to conversion server using non-root user with password on p2v client
1350363 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1350363
Improve error info "remote server timeout unexpectedly waiting for password prompt" when connect to a bogus server at p2v client
(69 bugs)
End of BUGS file.

View File

@@ -65,7 +65,8 @@ SUBDIRS += tests/lvm
SUBDIRS += tests/luks
SUBDIRS += tests/md
SUBDIRS += tests/selinux
SUBDIRS += tests/ntfsclone
SUBDIRS += tests/relabel
SUBDIRS += tests/ntfs
SUBDIRS += tests/btrfs
SUBDIRS += tests/xfs
SUBDIRS += tests/charsets
@@ -81,7 +82,9 @@ SUBDIRS += tests/http
SUBDIRS += tests/syslinux
SUBDIRS += tests/journal
SUBDIRS += tests/relative-paths
SUBDIRS += tests/gdisk
SUBDIRS += tests/regressions
SUBDIRS += tests/tsk
endif
# libguestfs-test-tool
@@ -165,6 +168,15 @@ if HAVE_FUSE
SUBDIRS += fuse
endif
# Miscellaneous utilities.
if HAVE_BOOT_ANALYSIS
SUBDIRS += utils/boot-analysis
endif
SUBDIRS += \
utils/boot-benchmark \
utils/qemu-boot \
utils/qemu-speed-test
# po-docs must come after tools, inspector.
if HAVE_PO4A
SUBDIRS += po-docs
@@ -210,9 +222,11 @@ EXTRA_DIST = \
logo/virt-builder.svg \
m4/.gitignore \
ocaml-link.sh \
podcheck.pl \
tests/automake2junit.ml \
tmp/.gitignore \
update-bugs.sh \
utils/README \
valgrind-suppressions \
website/bugs.png \
website/communicate.png \
@@ -230,14 +244,7 @@ EXTRA_DIST = \
website/pod.css \
website/standard.css \
zanata.xml \
zanata-pull.sh \
.x-sc_avoid_ctype_macros \
.x-sc_prohibit_have_config_h \
.x-sc_prohibit_magic_number_exit \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_strcmp_and_strncmp \
.x-sc_TAB_in_indentation \
.x-sc_trailing_blank
zanata-pull.sh
# XXX Eventually move builder/website under website/ top level directory.
BUILDERFILES = \
@@ -263,37 +270,66 @@ maintainer-upload-website:
cp $(BUILDERFILES) $(WEBSITEDIR)/download/builder/
# When doing 'make dist' update a few files automatically.
dist-hook:
git log --decorate=false > ChangeLog
cp ChangeLog $(distdir)/ChangeLog
$(top_srcdir)/update-bugs.sh > BUGS-t
mv BUGS-t BUGS
cp BUGS $(distdir)/BUGS
git shortlog -s | $(AWK) -F'\t' '{print $$2}' | sort -f > AUTHORS-t
mv AUTHORS-t AUTHORS
cp AUTHORS $(distdir)/AUTHORS
# Update the list of translatable files. These are separated into:
#
# po/POTFILES - files with ordinary extensions, but not OCaml files
# AUTHORS - list of authors (created from git)
# BUGS - list of bugs (created from Bugzilla)
# ChangeLog - changelog (created from git)
# docs/C_SOURCE_FILES
# - source files scanned for internal documentation
# po/POTFILES - files with ordinary extensions, but not OCaml files
# po/POTFILES-pl - Perl files that don't end in *.pl, which need a
# special xgettext option [not generated here]
# po/POTFILES-ml - OCaml files, which need a special tool to translate
#
# See po/Makefile.am.
#
dist-hook: AUTHORS BUGS ChangeLog docs/C_SOURCE_FILES po/POTFILES po/POTFILES-ml
cp AUTHORS $(distdir)/AUTHORS
cp BUGS $(distdir)/BUGS
cp ChangeLog $(distdir)/ChangeLog
AUTHORS: configure.ac
rm -f $@ $@-t
git shortlog -s | $(AWK) -F'\t' '{print $$2}' | sort -f > $@-t
mv $@-t $@
BUGS: configure.ac
rm -f $@ $@-t
$(top_srcdir)/update-bugs.sh > $@-t
mv $@-t $@
ChangeLog: configure.ac
rm -f $@ $@-t
git log --decorate=false > $@-t
mv $@-t $@
# This has to be in the top-level Makefile.am so that we have access
# to DIST_SUBDIRS.
all-local:
docs/C_SOURCE_FILES: configure.ac
rm -f $@ $@-t
find $(DIST_SUBDIRS) -name '*.c' | \
grep -v -E '^(builder/index-parse.c|builder/index-scan.c|examples/|gnulib/|gobject/|perl/|tests/|test-data/)' | \
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
grep -v -E '.*/errnostring\.c$$' | \
grep -v -E '.*-gperf\.c$$' | \
LC_ALL=C sort > $@-t
mv $@-t $@
# For more information about translations, see po/Makefile.am.
po/POTFILES: configure.ac
rm -f $@ $@-t
cd $(srcdir); \
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
grep -v -E '^(examples|gnulib|gobject/docs|perl/(blib|examples)|po-docs|tests|test-data)/' | \
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
grep -v -E '^python/utils\.c$$' | \
LC_ALL=C sort > po/POTFILES
LC_ALL=C sort > $@-t
mv $@-t $@
po/POTFILES-ml: configure.ac
rm -f $@ $@-t
cd $(srcdir); \
find builder customize dib get-kernel mllib resize sparsify sysprep v2v -name '*.ml' | \
LC_ALL=C sort > po/POTFILES-ml
LC_ALL=C sort > $@-t
mv $@-t $@
# Try to stop people using 'make install' without 'DESTDIR'.
install:
@@ -303,7 +339,7 @@ install:
else \
echo "***"; \
echo "*** Using 'make install' is usually a very bad idea."; \
echo "*** Use the './run' script instead - see the README."; \
echo "*** Use the './run' script instead - see the guestfs-building(1) man page."; \
echo "***"; \
echo "*** You can override this by setting REALLY_INSTALL=yes, but don't do that."; \
echo "***"; \
@@ -315,12 +351,14 @@ installcheck-local: installcheck.sh
$(builddir)/installcheck.sh
# NB. podwrapper is an internal tool, so the man page mustn't be installed.
noinst_MANS = podwrapper.1
# It should be noinst_MANS but that doesn't work.
noinst_DATA += podwrapper.1
podwrapper.1: podwrapper.pl
$(PODWRAPPER) \
--section 1 \
--man $@-t \
--license GPLv2+ \
--warning safe \
$<
mv $@-t $@
@@ -489,7 +527,7 @@ maintainer-commit:
# Tag HEAD with current version (only for maintainer).
maintainer-tag:
git tag -a $(VERSION) -m "Version $(VERSION) ($(BRANCH_TYPE))" -f
git tag -a "v$(VERSION)" -m "Version $(VERSION) ($(BRANCH_TYPE))" -f
# Maintainer only: check EXTRA_DIST rule is complete.
# (Note you must have done 'make dist')
@@ -531,7 +569,6 @@ help:
@echo
@echo "make installcheck Test installed libguestfs packages."
@echo
@echo "make syntax-check -j1 -k Check syntax and style problems in the code."
@echo "make print-subdirs Print subdirectories."
@echo
@echo "make install Install everything."

407
README
View File

@@ -8,410 +8,15 @@ list:
http://www.redhat.com/mailman/listinfo/libguestfs
To find out how to build libguestfs from source, read:
Requirements
----------------------------------------------------------------------
Running ./configure will check you have all the requirements installed
on your machine.
Fedora/RHEL users:
A useful tip is to run:
yum-builddep libguestfs
or:
dnf builddep libguestfs
which will install all build dependencies automatically. If that is
successful, you don't need to bother with the rest of this section.
Debian/Ubuntu users:
Use:
apt-get build-dep libguestfs
to install all build dependencies. If that doesn't work, take a
look at the Debian source package:
http://packages.debian.org/source/libguestfs
at the list of 'build-depends' and 'build-depends-indep', and
install everything listed there.
If either of those techniques is successful, you don't need to
bother with the rest of this section.
The full requirements are described below.
R = Required
O = Optional
+==============+=============+===+=========================================+
| Package name | Min.version | | Notes |
+==============+=============+===+=========================================+
| Install as many packages listed in appliance/packagelist.in as possible. |
| This installs the disk management tools required by the appliance. The |
| list below is *additional* packages needed on the host. |
+--------------+-------------+---+-----------------------------------------+
| qemu | 1.2.0 | R | 1.1 may work, but has broken virtio-scsi|
+--------------+-------------+---+-----------------------------------------+
| qemu-img | | R | >= 2.2.0 is required for virt-v2v but |
| | | | optional elsewhere |
+--------------+-------------+---+-----------------------------------------+
| kernel | 2.6.34 | R | Make sure the following are enabled |
| | | | compiled in or as a module: |
| | | | - virtio-pci |
| | | | - virtio-serial |
| | | | - virtio-block |
| | | | - virtio-net |
+--------------+-------------+---+-----------------------------------------+
| supermin | 5.1.0 | R | This is required on all distros. |
| | | | 'supermin' is the new name for |
| | | | 'febootstrap'. |
| | | | For alternatives, see: |
| | | | libguestfs.org/download/binaries/appliance/
+--------------+-------------+---+-----------------------------------------+
| glibc | | R | We use various glibc-isms. |
| | | | Also glibc provides XDR, rpcgen. |
+--------------+-------------+---+-----------------------------------------+
| GCC or LLVM | | R | We use __attribute__((cleanup)). |
+--------------+-------------+---+-----------------------------------------+
| Perl | | R | Various build and test programs need |
| | | | Perl. Not needed at runtime except if |
| | | | you need to run a handful of virt-* |
| | | | tools that are still written in Perl. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Man | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Simple | | R | Part of Perl core. |
+--------------+-------------+---+-----------------------------------------+
| OCaml | 3.11 |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | To build generated files and OCaml bindings.
+--------------+-------------+---+-----------------------------------------+
| findlib | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | To build generated files and OCaml bindings.
+--------------+-------------+---+-----------------------------------------+
| autotools | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | Autotools-based build system. |
+--------------+-------------+---+-----------------------------------------+
| cpio | | R | |
+--------------+-------------+---+-----------------------------------------+
| gperf | | R | |
+--------------+-------------+---+-----------------------------------------+
| flex | | R | flex & bison are required for virt- |
+--------------+-------------+---| builder. We could make these |
| bison | | R | optional but automakes makes it hard. |
+--------------+-------------+---+-----------------------------------------+
| PCRE | | R | Perl-compatible Regular Expression lib. |
+--------------+-------------+---+-----------------------------------------+
| genisoimage | | R | mkisofs may work. |
+--------------+-------------+---+-----------------------------------------+
| libxml2 | | R | Popular XML library. |
+--------------+-------------+---+-----------------------------------------+
| augeas | 1.0.0 | R | |
+--------------+-------------+---+-----------------------------------------+
| xz | | R | Used to compress disk images. |
| | | | Used by virt-builder for compression. |
+--------------+-------------+---+-----------------------------------------+
| po4a | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | For localizing man pages. |
+--------------+-------------+---+-----------------------------------------+
| hivex | 1.2.7 |R/O| Require if compiling from git. |
| | | | Windows Registry hive parser. |
+--------------+-------------+---+-----------------------------------------+
| libmagic | | O | The library used by the 'file' command. |
+--------------+-------------+---+-----------------------------------------+
| libvirt | | O | >= 0.10.2 is needed if you want to use |
| | | | libvirt to manage transient VMs. |
+--------------+-------------+---+-----------------------------------------+
| xmllint | | O | Part of libxml2. Used for tests only. |
+--------------+-------------+---+-----------------------------------------+
| libconfig | | O | Used to parse libguestfs's own config |
| | | | files eg. /etc/libguestfs-tools.conf. |
+--------------+-------------+---+-----------------------------------------+
| libselinux | | O | Used by the libvirt backend to securely |
| | | | confine the appliance (sVirt). |
+--------------+-------------+---+-----------------------------------------+
| db utils | | O | db_dump, db_load etc. Usually found in |
| | | | a package called db-utils, db4-utils, |
| | | | db4.X-utils, Berkeley DB utils, etc. |
+--------------+-------------+---+-----------------------------------------+
| systemtap | | O | For userspace probes. |
+--------------+-------------+---+-----------------------------------------+
| readline | | O | For nicer command line in guestfish. |
+--------------+-------------+---+-----------------------------------------+
| acl | | O | Library (libacl) and programs for |
| | | | handling POSIX ACLs. |
+--------------+-------------+---+-----------------------------------------+
| libcap | | O | Library (libcap) and programs for |
| | | | handling Linux capabilities. |
+--------------+-------------+---+-----------------------------------------+
| libldm | | O | Library (libldm) and 'ldmtool' for |
| | | | handling Windows Dynamic Disks. |
+--------------+-------------+---+-----------------------------------------+
| sd-journal | | O | systemd journal library |
+--------------+-------------+---+-----------------------------------------+
| yajl | 2.0.4 | O | JSON parser for parsing output of |
| | | | ldmtool and qemu-img info commands. |
+--------------+-------------+---+-----------------------------------------+
| gdisk | | O | GPT disk support. |
+--------------+-------------+---+-----------------------------------------+
| netpbm | | O | Render icons from guests. |
+--------------+-------------+---+-----------------------------------------+
| icoutils | | O | Render icons from Windows guests. |
+--------------+-------------+---+-----------------------------------------+
| Expect | | O | Perl module used to test virt-rescue. |
+--------------+-------------+---+-----------------------------------------+
| FUSE | | O | fusermount, libfuse, and kernel module |
| | | | are all needed if you want guestmount |
| | | | and/or 'mount-local' support. |
+--------------+-------------+---+-----------------------------------------+
| static glibc | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| qemu-nbd | | O | Used for testing only. |
+--------------+-------------+---+-----------------------------------------+
| uml_mkcow | | O | For the UML backend. |
+--------------+-------------+---+-----------------------------------------+
| curl | | O | Used by virt-builder for downloads |
+--------------+-------------+---+-----------------------------------------+
| gpg | | O | Used by virt-builder for digital |
| | | | signatures |
+--------------+-------------+---+-----------------------------------------+
| liblzma | | O | Can be used by virt-builder for fast |
| | | | uncompression of templates. |
+--------------+-------------+---+-----------------------------------------+
| gtk2 | 2.24 | O | Used by virt-p2v user interface. |
+--------------+-------------+---+-----------------------------------------+
| zip, unzip | | O | Used by virt-v2v for OVA files. |
+--------------+-------------+---+-----------------------------------------+
| python-evtx | | O | Used by virt-log to parse Windows |
| | | | Event Log files. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| Module::Build| 0.19 | O | To build the Perl bindings. |
+--------------+-------------+---+-----------------------------------------+
| Python | 2.2 | O | For the Python bindings. |
+--------------+-------------+---+-----------------------------------------+
| Ruby | | O | >= 1.9 is better than 1.8. |
+--------------+-------------+---+-----------------------------------------+
| rake | | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| rubygem-minitest | O | For the Ruby bindings. |
+--------------+-------------+---+-----------------------------------------+
| Java | 1.6 | O | Java + JNI + jpackage-utils are needed |
| | | | for the Java bindings. |
+--------------+-------------+---+-----------------------------------------+
| GHC | | O | For the Haskell bindings. |
+--------------+-------------+---+-----------------------------------------+
| PHP | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| phpize | | O | For the PHP bindings. |
+--------------+-------------+---+-----------------------------------------+
| glib2 | | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gobject-introspection | O | For the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| gjs | | O | For testing the GObject bindings. |
+--------------+-------------+---+-----------------------------------------+
| LUA | | O | For the LUA bindings. |
+--------------+-------------+---+-----------------------------------------+
| Erlang | | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| erl_interface| | O | For the Erlang bindings. |
+--------------+-------------+---+-----------------------------------------+
| golang | 1.1.1 | O | For the Go bindings. |
+--------------+-------------+---+-----------------------------------------+
| valgrind | | O | For testing for memory problems. |
+--------------+-------------+---+-----------------------------------------+
| Sys::Virt | | O | Perl bindings for libvirt. |
+--------------+-------------+---+-----------------------------------------+
| libvirt-python | O | For testing Python libvirt/libguestfs |
| | | | interactions. |
+--------------+-------------+---+-----------------------------------------+
| Win::Hivex | | O | Perl bindings for hivex. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Usage | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| Test::More | | O | Perl module used by tests. |
+--------------+-------------+---+-----------------------------------------+
| perl-libintl | | O | Perl module for localization. |
+--------------+-------------+---+-----------------------------------------+
| bash-completion | O | For tab-completion of commands in bash. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-ounit | 2.0.0 | O | For the tests of the common OCaml |
| | | | modules. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-libvirt| 0.6.1.5 | O | For building the virt-v2v test harness. |
+==============+=============+===+=========================================+
R = Required
O = Optional
Building
----------------------------------------------------------------------
Build the daemon, library and root filesystem:
building from tarball building from git
--------------------- -----------------
./configure ./autogen.sh
make make
Run the tests:
make check
Also:
make check-valgrind
runs a subset of the test suite under valgrind (requires valgrind to
be installed obviously).
make check-all
runs check-valgrind + even more tests, but these require that you have
some libvirt guests installed, that these guests' disks are accessible
by the current user, and these tests may fail for other reasons which
are not necessarily because of real problems.
make help
lists all 'make' targets.
You may install the library by running the following command as root.
However *most users should probably not do this*. Instead, './run'
the programs from the build directory as described below.
make install
Distro packagers should use this instead:
make INSTALLDIRS=vendor [DESTDIR=...] install
You can run guestfish, guestmount and the virt tools without needing
to install, using the "./run" script in the top directory. This
script sets up some environment variables. For example:
./run guestfish [usual guestfish args ...]
./run virt-inspector [usual virt-inspector args ...]
If you are already in the fish/ subdirectory, then the following
command will also work:
../run guestfish [...]
The ./run script adds every libguestfs binary to the $PATH, so the
above example runs guestfish from the build directory (not the
globally installed guestfish if there is one).
You can also run the C programs under valgrind like this:
./run valgrind [valgrind opts...] virt-cat [virt-cat opts...]
or under gdb:
./run gdb --args virt-cat [virt-cat opts...]
This also works with sudo (eg. if you need root access for libvirt or
to access a block device):
sudo ./run virt-cat -d LinuxGuest /etc/passwd
qemu
----------------------------------------------------------------------
By far the most common problem is with broken or incompatible
qemu releases.
Different versions of qemu have problems booting the appliance for
different reasons. This varies between versions of qemu, and Linux
distributions which add their own patches.
If you find a problem, you could try using your own qemu built from
source (qemu is very easy to build from source), with a 'qemu
wrapper'. Qemu wrappers are described in the guestfs(3) manpage.
Note on using KVM
----------------------------------------------------------------------
By default the configure script will look for qemu-kvm (KVM support).
You will need a reasonably recent processor for this to work. KVM is
much faster than using plain Qemu.
You may also need to enable KVM support for non-root users, by following
these instructions:
http://www.linux-kvm.org/page/FAQ#How_can_I_use_kvm_with_a_non-privileged_user.3F
On some systems, this will work too:
chmod 0666 /dev/kvm
On some systems, the chmod will not survive a reboot, and you will
need to make edits to the udev configuration.
Mirroring tip
----------------------------------------------------------------------
On my machines I can usually rebuild the appliance in around 3
minutes. If it takes much longer for you, use a local distro mirror
or squid.
To use squid to cache yum downloads, read this first:
https://lists.dulug.duke.edu/pipermail/yum/2006-August/009041.html
(In brief, because yum chooses random mirrors each time, squid doesn't
work very well with default yum configuration. To get around this,
choose a Fedora mirror which is close to you, set this with
'./configure --with-mirror=[...]', and then proxy the whole lot
through squid by setting http_proxy environment variable).
You will also need to substantially increase the squid configuration
limits:
http://fedoraproject.org/wiki/Using_Mock_to_test_package_builds#Using_Squid_to_Speed_Up_Mock_package_downloads
Porting to other Linux distros / non-Linux
----------------------------------------------------------------------
libguestfs itself should be fairly portable to other Linux
distributions. Non-Linux ports are trickier, but we will accept
patches if they aren't too invasive.
The main porting issues are with the dependencies needed to build the
appliance. You will need to port supermin first
(http://people.redhat.com/~rjones/supermin/).
Note on using clang (from LLVM) instead of GCC
----------------------------------------------------------------------
export CC=clang
./configure --disable-probes
make
SystemTap/DTrace-style userspace probe points don't work under the
clang compiler, which is why you may need to disable them.
Don't enable GCC warnings (ie. *don't* use
'./configure --enable-gcc-warnings').
Copyright and license information
----------------------------------------------------------------------
docs/guestfs-building.pod
http://libguestfs.org/guestfs-building.1.html
man docs/guestfs-building.1
Copyright (C) 2009-2016 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and
COPYING.LIB for full license information.
The examples are under a very liberal license.
COPYING.LIB for full license information. The examples are under a
very liberal license.

16
TODO
View File

@@ -59,12 +59,6 @@ Ideas for extra commands
SELinux:
chcat
restorecon
[Wanlong Gao submitted patches for restorecon, but
there are problems with using the restorecon binary
from the host on the guest. Most of the time it
would do more harm than good.]
setfiles
Oddball:
pivot_root
@@ -576,3 +570,13 @@ Subsecond handling in virt-diff, virt-ls
Handle nanoseconds properly. You should be able to specify them on
the command line and display them.
Use QMP to query qemu features
------------------------------
The following command will dump out the QMP schema. With a lot of
work, this can be used to more accurately parse out various qemu
features that currently we get by looking at the -help text.
echo -e '{ "execute": "qmp_capabilities" }\n\n{ "execute": "query-qmp-schema" }\n\n{ "execute": "quit" }' | \
qemu-system-x86_64 -display none -M none -S -qmp-pretty stdio

View File

@@ -19,6 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
test-virt-alignment-scan.sh \
test-virt-alignment-scan-docs.sh \
test-virt-alignment-scan-guests.sh \
virt-alignment-scan.pod
@@ -50,7 +51,6 @@ virt_alignment_scan_SOURCES = \
virt_alignment_scan_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/df \
-I$(top_srcdir)/fish \
@@ -85,6 +85,7 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
--man virt-alignment-scan.1 \
--html $(top_builddir)/website/virt-alignment-scan.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -92,7 +93,8 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS =
TESTS = \
test-virt-alignment-scan-docs.sh
if ENABLE_APPLIANCE
TESTS += \

View File

@@ -26,6 +26,7 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
@@ -86,6 +87,7 @@ usage (int status)
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" --uuid Print UUIDs instead of names\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
@@ -105,7 +107,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:P:qvVx";
static const char options[] = "a:c:d:P:qvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
@@ -115,7 +117,7 @@ main (int argc, char *argv[])
{ "long-options", 0, 0, 0 },
{ "quiet", 0, 0, 'q' },
{ "short-options", 0, 0, 0 },
{ "uuid", 0, 0, 0, },
{ "uuid", 0, 0, 0 },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
@@ -130,10 +132,8 @@ main (int argc, char *argv[])
int r;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -149,12 +149,10 @@ main (int argc, char *argv[])
OPTION_format;
} else if (STREQ (long_options[option_index].name, "uuid")) {
uuid = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name,
long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
@@ -170,11 +168,8 @@ main (int argc, char *argv[])
break;
case 'P':
if (sscanf (optarg, "%zu", &max_threads) != 1) {
fprintf (stderr, _("%s: -P option is not numeric\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
if (sscanf (optarg, "%zu", &max_threads) != 1)
error (EXIT_FAILURE, 0, _("-P option is not numeric"));
break;
case 'q':
@@ -229,16 +224,11 @@ main (int argc, char *argv[])
if (r == -1)
exit (EXIT_FAILURE);
#else
fprintf (stderr, _("%s: compiled without support for libvirt.\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0, _("compiled without support for libvirt"));
#endif
} else { /* Single guest. */
if (uuid) {
fprintf (stderr, _("%s: --uuid option cannot be used with -a or -d\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
if (uuid)
error (EXIT_FAILURE, 0, _("--uuid option cannot be used with -a or -d"));
/* Add domains/drives from the command line (for a single guest). */
add_drives (drvs, 'a');

View File

@@ -1,5 +1,6 @@
# libguestfs Python bindings
# Copyright (C) 2010 Red Hat Inc.
#!/bin/bash -
# libguestfs
# Copyright (C) 2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,11 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
import guestfs
export LANG=C
set -e
g = guestfs.GuestFS (python_return_dict=True)
g.add_drive ("/dev/null")
g.add_drive ("/dev/null", readonly = True)
g.add_drive ("/dev/null", iface = "virtio", format = "raw")
g.close ()
$srcdir/../podcheck.pl virt-alignment-scan.pod virt-alignment-scan

View File

@@ -18,7 +18,7 @@
export LANG=C
$VG virt-alignment-scan -a ../test-data/phony-guests/fedora.img
$VG virt-alignment-scan --format=raw -a ../test-data/phony-guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -15,6 +15,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This subdirectory builds the appliance. It is first prepared as a
# supermin appliance (appliance/supermin.d/*), and then the supermin
# appliance is built into a full fat appliance in $TMPDIR/.guestfs-*
# (which is under tmp/ if you are using the ./run script).
#
# Because preparing the supermin appliance is expensive, even
# `make clean' does not delete it. If you want to force the supermin
# appliance to be reprepared, do:
#
# make -C appliance clean-supermin-appliance
# make -C appliance
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
@@ -54,6 +66,9 @@ stamp-supermin: make.sh packagelist supermin.d/excludefiles
supermin.d/udev-rules.tar.gz
touch $@
clean-supermin-appliance:
rm -f stamp-supermin
# This used to be a configure-generated file. However config.status
# always touches the destination file, which means the appliance got
# rebuilt too often.
@@ -134,6 +149,7 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/website/libguestfs-make-fixed-appliance.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@

View File

@@ -13,5 +13,6 @@ dnl SUSE=1 For OpenSUSE.
dnl FRUGALWARE=1 For Frugalware.
dnl MAGEIA=1 For Mageia.
/etc/ld.so.cache
/lib/lsb/*
/usr/share/augeas/lenses/*.aug

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
echo Starting /init script ...
@@ -17,10 +17,6 @@ if [ ! -d /tmp ] || [ ! -d /var/tmp ]; then
chmod 1777 /tmp /var/tmp
fi
# Make sure to find all the libraries, also those in non-standard place
# but with a proper ld.so configuration pointing at them
ldconfig
# Try to print a stack trace for segfaults inside the appliance.
for d in /lib64 /lib; do
f=$d/libSegFault.so
@@ -33,9 +29,32 @@ done
mkdir -p /sysroot
# Mount /proc.
if [ ! -d /proc ]; then rm -f /proc; fi
mkdir -p /proc
mount -t proc /proc /proc
# Parse the kernel command line early (must be after /proc is mounted).
cmdline=$(</proc/cmdline)
if [[ $cmdline == *guestfs_verbose=1* ]]; then
guestfs_verbose=1
set -x
fi
if [[ $cmdline == *guestfs_network=1* ]]; then
guestfs_network=1
fi
if [[ $cmdline == *guestfs_rescue=1* ]]; then
guestfs_rescue=1
fi
if [[ $cmdline == *guestfs_noreboot=1* ]]; then
guestfs_noreboot=1
fi
if [[ $cmdline == *guestfs_boot_analysis=1* ]]; then
guestfs_boot_analysis=1
fi
# Mount the other special filesystems.
if [ ! -d /sys ]; then rm -f /sys; fi
mkdir -p /sys
mount -t sysfs /sys /sys
@@ -47,61 +66,51 @@ ln -s ../run/lock /var/lock
# On Fedora 23, util-linux creates /etc/mtab in %post .. stupid
# and e2fsprogs fails if the link doesn't exist .. stupid stupid
ln -s /proc/mounts /etc/mtab
if ! test -e /etc/mtab; then
ln -s /proc/mounts /etc/mtab
fi
# devtmpfs is required since udev 176
mount -t devtmpfs /dev /dev
if [[ $cmdline == *selinux=1* ]]; then
mount -t selinuxfs none /sys/fs/selinux
fi
# Static nodes must happen before udev is started.
# Set up kmod static-nodes (RHBZ#1011907).
mkdir -p /run/tmpfiles.d
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
# Create a machine-id with a random UUID
machine_id=$(dd if=/dev/urandom bs=16 count=1 status=none | od -x -A n)
echo "${machine_id// /}" > /etc/machine-id
# Set up tmpfiles (must run after kmod.conf is created above).
systemd-tmpfiles --prefix=/dev --create --boot
systemd-tmpfiles --prefix=/dev --prefix=/run --create --boot
# Find udevd and run it directly.
for f in /sbin/udevd /lib/udev/udevd \
/lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
for f in /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
/sbin/udevd /lib/udev/udevd \
/usr/lib/udev/udevd; do
if [ -x "$f" ]; then UDEVD="$f"; fi
if [ -x "$f" ]; then UDEVD="$f"; break; fi
done
if [ -z "$UDEVD" ]; then
echo "udev not found! Things will probably not work ..."
echo "error: udev not found! Things will probably not work ..."
fi
$UDEVD --daemon #--debug
udevadm trigger
udevadm settle --timeout=600
if grep -sq selinux=1 /proc/cmdline; then
mount -t selinuxfs none /sys/fs/selinux
fi
# Disk optimizations.
# Increase the SCSI timeout so we can read remote images.
shopt -s nullglob
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
# https://access.redhat.com/site/solutions/5427
for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
# Update the system clock.
hwclock -u -s
# Parse the kernel command line.
if grep -sq guestfs_verbose=1 /proc/cmdline; then
guestfs_verbose=1
fi
if grep -sq guestfs_network=1 /proc/cmdline; then
guestfs_network=1
fi
if grep -sq guestfs_rescue=1 /proc/cmdline; then
guestfs_rescue=1
fi
if grep -sq guestfs_noreboot=1 /proc/cmdline; then
guestfs_noreboot=1
fi
eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
shopt -u nullglob
# Set up the network.
ip addr add 127.0.0.1/8 brd + dev lo scope host
@@ -109,6 +118,7 @@ ip link set dev lo up
if test "$guestfs_network" = 1; then
iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
touch /etc/fstab # Workaround for Ubuntu.
if dhclient --version >/dev/null 2>&1; then
dhclient $iface
else
@@ -121,7 +131,6 @@ mdadm -As --auto=yes --run
# Scan for LVM.
modprobe dm_mod ||:
lvmetad ||:
lvm vgchange -aay --sysinit
@@ -129,7 +138,7 @@ lvm vgchange -aay --sysinit
ldmtool create all
# These are useful when debugging.
if test "$guestfs_verbose" = 1; then
if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; then
uname -a
ls -lR /dev
cat /proc/mounts
@@ -151,6 +160,7 @@ fi
if ! test "$guestfs_rescue" = 1; then
# Run the daemon.
cmd="guestfsd"
eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
if test "x$guestfs_channel" != "x"; then
cmd="$cmd --channel $guestfs_channel"
fi

View File

@@ -39,7 +39,7 @@ L<guestfs-performance(1)>).
=back
For deeper understanding of why you might need this tool, read
L<guestfs(3)/FIXED APPLIANCE>.
L<guestfs-internals(1)/FIXED APPLIANCE>.
Instead of running this tool, you can download fixed appliances from
L<http://libguestfs.org/download/binaries/appliance/>. These

View File

@@ -24,7 +24,6 @@ ifelse(UBUNTU,1,`define(`DEBIAN',1)')
ifelse(REDHAT,1,
augeas-libs
btrfs-progs
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
dhclient
@@ -44,6 +43,7 @@ ifelse(REDHAT,1,
ntfs-3g
openssh-clients
pcre
policycoreutils
reiserfs-utils
libselinux
syslinux-extlinux
@@ -56,6 +56,7 @@ ifelse(REDHAT,1,
ifelse(DEBIAN,1,
bsdmainutils
dnl old name used in Jessie and earlier
btrfs-tools
cryptsetup
extlinux
@@ -100,7 +101,6 @@ dnl iproute has been renamed to iproute2
ifelse(ARCHLINUX,1,
augeas
btrfs-progs
cdrkit
cryptsetup
dhcpcd
@@ -134,6 +134,7 @@ ifelse(SUSE,1,
btrfsprogs
cryptsetup
dhcpcd
dhcp-client
genisoimage
glibc-locale
gptfdisk
@@ -141,9 +142,12 @@ ifelse(SUSE,1,
iproute2
iputils
libcap2
libhivex0
libselinux1
libyajl2
mkisofs
ntfsprogs
ntfs-3g
reiserfs
systemd
vim
@@ -152,7 +156,6 @@ ifelse(SUSE,1,
ifelse(FRUGALWARE,1,
augeas
btrfs-progs
cryptsetup-luks
cdrkit
dhclient
@@ -178,7 +181,6 @@ ifelse(FRUGALWARE,1,
ifelse(MAGEIA,1,
augeas
btrfs-progs
cryptsetup
chkconfig /* for /etc/init.d */
cdrkit-genisoimage
@@ -212,12 +214,14 @@ acl
attr
bash
binutils
btrfs-progs
bzip2
coreutils
cpio
diffutils
dosfstools
e2fsprogs
f2fs-tools
file
findutils
gawk
@@ -238,12 +242,14 @@ dnl Enabling this pulls out 140 extra packages
dnl into the appliance:
dnl ocfs2-tools
parted
pciutils
procps
procps-ng
psmisc
rsync
scrub
sed
sleuthkit
strace
syslinux
tar
@@ -278,6 +284,7 @@ ifelse(MAGEIA,1,
which
)
curl
kpartx
dnl (virt-dib) tools optionally used for elements
debootstrap

View File

@@ -27,6 +27,7 @@ EXTRA_DIST = \
test-simplestreams/streams/v1/index.json \
test-simplestreams/streams/v1/net.cirros-cloud_released_download.json \
test-virt-builder.sh \
test-virt-builder-docs.sh \
test-virt-builder-list.sh \
test-virt-builder-list-simplestreams.sh \
test-virt-builder-planner.sh \
@@ -89,13 +90,6 @@ SOURCES_ML = \
builder.ml
SOURCES_C = \
../mllib/fsync-c.c \
../mllib/uri-c.c \
../mllib/mkdtemp-c.c \
../customize/perl_edit-c.c \
../customize/crypt-c.c \
../fish/uri.c \
../fish/file-edit.c \
index-scan.c \
index-struct.c \
index-parse.c \
@@ -130,31 +124,7 @@ virt_builder_CFLAGS = \
$(LIBXML2_CFLAGS) \
$(YAJL_CFLAGS)
BOBJECTS = \
$(top_builddir)/mllib/libdir.cmo \
$(top_builddir)/mllib/guestfs_config.cmo \
$(top_builddir)/mllib/common_gettext.cmo \
$(top_builddir)/mllib/common_utils.cmo \
$(top_builddir)/mllib/fsync.cmo \
$(top_builddir)/mllib/planner.cmo \
$(top_builddir)/mllib/regedit.cmo \
$(top_builddir)/mllib/JSON.cmo \
$(top_builddir)/mllib/uRI.cmo \
$(top_builddir)/mllib/mkdtemp.cmo \
$(top_builddir)/customize/customize_utils.cmo \
$(top_builddir)/customize/urandom.cmo \
$(top_builddir)/customize/random_seed.cmo \
$(top_builddir)/customize/hostname.cmo \
$(top_builddir)/customize/timezone.cmo \
$(top_builddir)/customize/firstboot.cmo \
$(top_builddir)/customize/perl_edit.cmo \
$(top_builddir)/customize/crypt.cmo \
$(top_builddir)/customize/password.cmo \
$(top_builddir)/customize/ssh_key.cmo \
$(top_builddir)/customize/subscription_manager.cmo \
$(top_builddir)/customize/customize_cmdline.cmo \
$(top_builddir)/customize/customize_run.cmo \
$(SOURCES_ML:.ml=.cmo)
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
@@ -190,29 +160,22 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
OCAMLLINKFLAGS = mlguestfs.cma -custom
else
OBJECTS = $(XOBJECTS)
BEST = opt
OCAMLLINKFLAGS = mlguestfs.cmxa
endif
virt_builder_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) customize.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY)
virt_builder_DEPENDENCIES = \
$(OBJECTS) \
../mllib/mllib.$(MLARCHIVE) \
../customize/customize.$(MLARCHIVE) \
$(top_srcdir)/ocaml-link.sh
virt_builder_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(OBJECTS) -o $@
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
if HAVE_OCAMLOPT
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
endif
# Manual pages and HTML files for the website.
man_MANS += virt-builder.1
@@ -227,6 +190,7 @@ stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synop
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -275,20 +239,24 @@ yajl_tests_THEOBJECTS = $(yajl_tests_BOBJECTS)
yajl_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
yajl_tests_DEPENDENCIES = $(yajl_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
yajl_tests_DEPENDENCIES = \
$(yajl_tests_THEOBJECTS) \
../mllib/mllib.$(MLARCHIVE) \
../customize/customize.$(MLARCHIVE) \
$(top_srcdir)/ocaml-link.sh
yajl_tests_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \
$(yajl_tests_THEOBJECTS) -o $@
TESTS = \
test-virt-builder-docs.sh \
test-virt-builder-list.sh \
test-virt-index-validate.sh
test-virt-index-validate.sh \
$(SLOW_TESTS)
check_PROGRAMS =
if HAVE_YAJL
TESTS += test-virt-builder-list-simplestreams.sh
endif
if ENABLE_APPLIANCE
TESTS += test-virt-builder.sh
@@ -301,8 +269,10 @@ endif
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
SLOW_TESTS = test-virt-builder-planner.sh
check-slow:
$(MAKE) TESTS="test-virt-builder-planner.sh" check
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
# Dependencies.
depend: .depend
@@ -366,6 +336,7 @@ stamp-virt-index-validate.pod: virt-index-validate.pod
--man virt-index-validate.1 \
--html $(top_builddir)/website/virt-index-validate.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@

View File

@@ -75,6 +75,30 @@ let remove_duplicates index =
false
) index
(* Look for the specified os-version, resolving it as alias first. *)
let selected_cli_item cmdline index =
let arg =
(* Try to resolve the alias. *)
try
let item =
List.find (
fun (name, { Index.aliases = aliases }) ->
match aliases with
| None -> false
| Some l -> List.mem cmdline.arg l
) index in
fst item
with Not_found -> cmdline.arg in
let item =
try List.find (
fun (name, { Index.arch = a }) ->
name = arg && cmdline.arch = normalize_arch a
) index
with Not_found ->
error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
arg cmdline.arch in
item
let main () =
(* Command line argument parsing - see cmdline.ml. *)
let cmdline = parse_cmdline () in
@@ -94,19 +118,17 @@ let main () =
let mode =
match cmdline.mode with
| `Get_kernel -> (* --get-kernel is really a different program ... *)
let cmd =
sprintf "virt-get-kernel%s%s%s%s --add %s"
(if verbose () then " --verbose" else "")
(if trace () then " -x" else "")
(match cmdline.format with
| None -> ""
| Some format -> sprintf " --format %s" (quote format))
(match cmdline.output with
| None -> ""
| Some output -> sprintf " --output %s" (quote output))
(quote cmdline.arg) in
if verbose () then printf "%s\n%!" cmd;
exit (Sys.command cmd)
let cmd = [ "virt-get-kernel" ] @
(if verbose () then [ "--verbose" ] else []) @
(if trace () then [ "-x" ] else []) @
(match cmdline.format with
| None -> []
| Some format -> [ "--format"; format ]) @
(match cmdline.output with
| None -> []
| Some output -> [ "--output"; output ]) @
[ "--add"; cmdline.arg ] in
exit (run_command cmd)
| `Delete_cache -> (* --delete-cache *)
(match cmdline.cache with
@@ -126,7 +148,7 @@ let main () =
* disables all signature checks.
*)
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.gpg in
if Sys.command cmd <> 0 then (
if shell_command cmd <> 0 then (
if cmdline.check_signature then
error (f_"gpg is not installed (or does not work)\nYou should install gpg, or use --gpg option, or use --no-check-signature.")
else if verbose () then
@@ -135,12 +157,12 @@ let main () =
(* Check that curl works. *)
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.curl in
if Sys.command cmd <> 0 then
if shell_command cmd <> 0 then
error (f_"curl is not installed (or does not work)");
(* Check that virt-resize works. *)
let cmd = "virt-resize --help >/dev/null 2>&1" in
if Sys.command cmd <> 0 then
if shell_command cmd <> 0 then
error (f_"virt-resize is not installed (or does not work)");
(* Create the cache. *)
@@ -163,7 +185,7 @@ let main () =
{
Sources.name = source; uri = source;
gpgkey = Utils.Fingerprint fingerprint;
proxy = Downloader.SystemProxy;
proxy = Curl.SystemProxy;
format = Sources.FormatNative;
}
) cmdline.sources in
@@ -189,6 +211,12 @@ let main () =
let mode =
match mode with
| `List -> (* --list *)
let sources, index =
match cmdline.arg with
| "" -> sources, index (* no template -> all the available ones *)
| arg -> (* just the specified template *)
let item = selected_cli_item cmdline index in
[], [item] in
List_entries.list_entries ~list_format:cmdline.list_format ~sources index;
exit 0
@@ -229,26 +257,8 @@ let main () =
| (`Install|`Notes) as mode -> mode in
(* Which os-version (ie. index entry)? *)
let arg =
(* Try to resolve the alias. *)
try
let item =
List.find (
fun (name, { Index.aliases = aliases }) ->
match aliases with
| None -> false
| Some l -> List.mem cmdline.arg l
) index in
fst item
with Not_found -> cmdline.arg in
let item =
try List.find (
fun (name, { Index.arch = a }) ->
name = arg && cmdline.arch = normalize_arch a
) index
with Not_found ->
error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
arg cmdline.arch in
let item = selected_cli_item cmdline index in
let arg = fst item in
let entry = snd item in
let sigchecker = entry.Index.sigchecker in
@@ -270,6 +280,15 @@ let main () =
(* --- If we get here, we want to create a guest. --- *)
(* Warn if the user might be writing to a partition on a USB key. *)
(match cmdline.output with
| Some device when is_partition device ->
if cmdline.warn_if_partition then
warning (f_"output device (%s) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition")
device;
| Some _ | None -> ()
);
(* Download the template, or it may be in the cache. *)
let template =
let template, delete_on_exit =
@@ -386,7 +405,7 @@ let main () =
let is_not t = not (is t) in
let remove = List.remove_assoc in
let ret = ref [] in
let tr task weight otags = ret := (task, weight, otags) :: !ret in
let tr task weight otags = push_front (task, weight, otags) ret in
(* XXX Weights are not very smartly chosen. At the moment I'm
* using a range [0..100] where 0 = free and 100 = expensive. We
@@ -539,16 +558,14 @@ let main () =
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
message (f_"Copying");
let cmd = sprintf "cp %s %s" (quote ifile) (quote ofile) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
let cmd = [ "cp"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Rename, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
let cmd = sprintf "mv %s %s" (quote ifile) (quote ofile) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
let cmd = [ "mv"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Pxzcat, otags ->
let ifile = List.assoc `Filename itags in
@@ -571,23 +588,21 @@ let main () =
let () =
let g = open_guestfs () in
g#disk_create ?preallocation ofile oformat osize in
let cmd =
sprintf "virt-resize%s%s%s --output-format %s%s%s --unknown-filesystems error %s %s"
(if verbose () then " --verbose" else " --quiet")
(if is_block_device ofile then " --no-sparse" else "")
(match iformat with
| None -> ""
| Some iformat -> sprintf " --format %s" (quote iformat))
(quote oformat)
(match expand with
| None -> ""
| Some expand -> sprintf " --expand %s" (quote expand))
(match lvexpand with
| None -> ""
| Some lvexpand -> sprintf " --lv-expand %s" (quote lvexpand))
(quote ifile) (quote ofile) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
let cmd = [ "virt-resize" ] @
(if verbose () then [ "--verbose" ] else [ "--quiet" ]) @
(if is_block_device ofile then [ "--no-sparse" ] else []) @
(match iformat with
| None -> []
| Some iformat -> [ "--format"; iformat ]) @
[ "--output-format"; oformat ] @
(match expand with
| None -> []
| Some expand -> [ "--expand"; expand ]) @
(match lvexpand with
| None -> []
| Some lvexpand -> [ "--lv-expand"; lvexpand ]) @
[ "--unknown-filesystems"; "error"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Disk_resize, otags ->
let ofile = List.assoc `Filename otags in
@@ -597,8 +612,7 @@ let main () =
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if verbose () then "" else " >/dev/null") in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
if shell_command cmd <> 0 then exit 1
| itags, `Convert, otags ->
let ifile = List.assoc `Filename itags in
@@ -616,8 +630,7 @@ let main () =
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote (qemu_input_filename ofile))
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
if shell_command cmd <> 0 then exit 1
) plan;
(* Now mount the output disk so we can make changes. *)
@@ -629,12 +642,6 @@ let main () =
may g#set_smp cmdline.smp;
g#set_network cmdline.network;
(* Make sure to turn SELinux off to avoid awkward interactions
* between the appliance kernel and applications/libraries interacting
* with SELinux xattrs.
*)
g#set_selinux false;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
@@ -652,15 +659,7 @@ let main () =
let root =
match Array.to_list (g#inspect_os ()) with
| [root] ->
let mps = g#inspect_get_mountpoints root in
let cmp (a,_) (b,_) =
compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
List.iter (
fun (mp, dev) ->
try g#mount dev mp
with G.Error msg -> warning (f_"%s (ignored)") msg
) mps;
inspect_mount_root g root;
root
| _ ->
error (f_"no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.")

View File

@@ -25,8 +25,8 @@ open Unix
open Printf
let clean_cachedir dir =
let cmd = sprintf "rm -rf %s" (quote dir) in
ignore (Sys.command cmd);
let cmd = [ "rm"; "-rf"; dir ] in
ignore (run_command cmd);
type t = {
directory : string;

View File

@@ -43,7 +43,6 @@ let verify_checksum csum filename =
in
let cmd = sprintf "%s %s" prog (quote filename) in
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
match lines with
| [] ->

View File

@@ -20,6 +20,7 @@
open Common_gettext.Gettext
open Common_utils
open Getopt.OptionName
open Customize_cmdline
@@ -42,7 +43,7 @@ type cmdline = {
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : [`Short|`Long|`Json];
list_format : List_entries.format;
memsize : int option;
network : bool;
ops : Customize_cmdline.ops;
@@ -51,6 +52,7 @@ type cmdline = {
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
let parse_cmdline () =
@@ -70,7 +72,7 @@ let parse_cmdline () =
| "auto" -> attach_format := None
| s -> attach_format := Some s
in
let attach_disk s = attach := (!attach_format, s) :: !attach in
let attach_disk s = push_front (!attach_format, s) attach in
let cache = ref Paths.xdg_cache_home in
let set_cache arg = cache := Some arg in
@@ -82,20 +84,18 @@ let parse_cmdline () =
let delete_on_failure = ref true in
let fingerprints = ref [] in
let add_fingerprint arg = fingerprints := arg :: !fingerprints in
let add_fingerprint arg = push_front arg fingerprints in
let format = ref "" in
let gpg = ref "gpg" in
let list_format = ref `Short in
let list_set_long () = list_format := `Long in
let list_format = ref List_entries.Short in
let list_set_long () = list_format := List_entries.Long in
let list_set_format arg =
list_format := match arg with
| "short" -> `Short
| "long" -> `Long
| "json" -> `Json
| fmt ->
error (f_"invalid --list-format type '%s', see the man page") fmt in
(* Do not catch the Invalid_argument that list_format_of_string
* throws on invalid input, as it is already checked by the
* Getopt handling of Symbol. *)
list_format := List_entries.list_format_of_string arg in
let machine_readable = ref false in
@@ -112,66 +112,64 @@ let parse_cmdline () =
let set_smp arg = smp := Some arg in
let sources = ref [] in
let add_source arg = sources := arg :: !sources in
let add_source arg = push_front arg sources in
let sync = ref true in
let warn_if_partition = ref true in
let formats = List_entries.list_formats
and formats_string = String.concat "|" List_entries.list_formats in
let argspec = [
"--arch", Arg.Set_string arch, "arch" ^ " " ^ s_"Set the output architecture";
"--attach", Arg.String attach_disk, "iso" ^ " " ^ s_"Attach data disk/ISO during install";
"--attach-format", Arg.String set_attach_format,
"format" ^ " " ^ s_"Set attach disk format";
"--cache", Arg.String set_cache, "dir" ^ " " ^ s_"Set template cache dir";
"--no-cache", Arg.Unit no_cache, " " ^ s_"Disable template cache";
"--cache-all-templates", Arg.Unit cache_all_mode,
" " ^ s_"Download all templates to the cache";
"--check-signature", Arg.Set check_signature,
" " ^ s_"Check digital signatures";
"--check-signatures", Arg.Set check_signature,
" " ^ s_"Check digital signatures";
"--no-check-signature", Arg.Clear check_signature,
" " ^ s_"Disable digital signatures";
"--no-check-signatures", Arg.Clear check_signature,
" " ^ s_"Disable digital signatures";
"--curl", Arg.Set_string curl, "curl" ^ " " ^ s_"Set curl binary/command";
"--delete-cache", Arg.Unit delete_cache_mode,
" " ^ s_"Delete the template cache";
"--no-delete-on-failure", Arg.Clear delete_on_failure,
" " ^ s_"Don't delete output file on failure";
"--fingerprint", Arg.String add_fingerprint,
"AAAA.." ^ " " ^ s_"Fingerprint of valid signing key";
"--format", Arg.Set_string format, "raw|qcow2" ^ " " ^ s_"Output format (default: raw)";
"--get-kernel", Arg.Unit get_kernel_mode,
"image" ^ " " ^ s_"Get kernel from image";
"--gpg", Arg.Set_string gpg, "gpg" ^ " " ^ s_"Set GPG binary/command";
"-l", Arg.Unit list_mode, " " ^ s_"List available templates";
"--list", Arg.Unit list_mode, " " ^ s_"List available templates";
"--long", Arg.Unit list_set_long, " " ^ s_"Shortcut for --list-format short";
"--list-format", Arg.String list_set_format,
"short|long|json" ^ " " ^ s_"Set the format for --list (default: short)";
"--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
"--notes", Arg.Unit notes_mode, " " ^ s_"Display installation notes";
"-o", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--output", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--print-cache", Arg.Unit print_cache_mode,
" " ^ s_"Print info about template cache";
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
"--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL";
"--no-sync", Arg.Clear sync, " " ^ s_"Do not fsync output file on exit";
[ L"arch" ], Getopt.Set_string ("arch", arch), s_"Set the output architecture";
[ L"attach" ], Getopt.String ("iso", attach_disk), s_"Attach data disk/ISO during install";
[ L"attach-format" ], Getopt.String ("format", set_attach_format),
s_"Set attach disk format";
[ L"cache" ], Getopt.String ("dir", set_cache), s_"Set template cache dir";
[ L"no-cache" ], Getopt.Unit no_cache, s_"Disable template cache";
[ L"cache-all-templates" ], Getopt.Unit cache_all_mode,
s_"Download all templates to the cache";
[ L"check-signature"; L"check-signatures" ], Getopt.Set check_signature,
s_"Check digital signatures";
[ L"no-check-signature"; L"no-check-signatures" ], Getopt.Clear check_signature,
s_"Disable digital signatures";
[ L"curl" ], Getopt.Set_string ("curl", curl), s_"Set curl binary/command";
[ L"delete-cache" ], Getopt.Unit delete_cache_mode,
s_"Delete the template cache";
[ L"no-delete-on-failure" ], Getopt.Clear delete_on_failure,
s_"Don't delete output file on failure";
[ L"fingerprint" ], Getopt.String ("AAAA..", add_fingerprint),
s_"Fingerprint of valid signing key";
[ L"format" ], Getopt.Set_string ("raw|qcow2", format), s_"Output format (default: raw)";
[ L"get-kernel" ], Getopt.Unit get_kernel_mode,
s_"Get kernel from image";
[ L"gpg" ], Getopt.Set_string ("gpg", gpg), s_"Set GPG binary/command";
[ S 'l'; L"list" ], Getopt.Unit list_mode, s_"List available templates";
[ L"long" ], Getopt.Unit list_set_long, s_"Shortcut for --list-format long";
[ L"list-format" ], Getopt.Symbol (formats_string, formats, list_set_format),
s_"Set the format for --list (default: short)";
[ L"machine-readable" ], Getopt.Set machine_readable, s_"Make output machine readable";
[ S 'm'; L"memsize" ], Getopt.Int ("mb", set_memsize), s_"Set memory size";
[ L"network" ], Getopt.Set network, s_"Enable appliance network (default)";
[ L"no-network" ], Getopt.Clear network, s_"Disable appliance network";
[ L"notes" ], Getopt.Unit notes_mode, s_"Display installation notes";
[ S 'o'; L"output" ], Getopt.Set_string ("file", output), s_"Set output filename";
[ L"print-cache" ], Getopt.Unit print_cache_mode,
s_"Print info about template cache";
[ L"size" ], Getopt.String ("size", set_size), s_"Set output disk size";
[ L"smp" ], Getopt.Int ("vcpus", set_smp), s_"Set number of vCPUs";
[ L"source" ], Getopt.String ("URL", add_source), s_"Set source URL";
[ L"no-sync" ], Getopt.Clear sync, s_"Do not fsync output file on exit";
[ L"no-warn-if-partition" ], Getopt.Clear warn_if_partition,
s_"Do not warn if writing to a partition";
] in
let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
let argspec = set_standard_options argspec in
let args = ref [] in
let anon_fun s = args := s :: !args in
let anon_fun s = push_front s args in
let usage_msg =
sprintf (f_"\
%s: build virtual machine images quickly
@@ -188,7 +186,8 @@ A short summary of the options is given below. For detailed help please
read the man page virt-builder(1).
")
prog in
Arg.parse argspec anon_fun usage_msg;
let opthandle = create_standard_options argspec ~anon_fun usage_msg in
Getopt.parse opthandle;
(* Dereference options. *)
let args = List.rev !args in
@@ -212,6 +211,7 @@ read the man page virt-builder(1).
let smp = !smp in
let sources = List.rev !sources in
let sync = !sync in
let warn_if_partition = !warn_if_partition in
(* No arguments and machine-readable mode? Print some facts. *)
if args = [] && machine_readable then (
@@ -239,9 +239,10 @@ read the man page virt-builder(1).
if format <> None then
error (f_"--list: use '--list-format', not '--format'");
(match args with
| [arg] -> arg
| [] -> ""
| _ ->
error (f_"--list option does not need any extra arguments")
error (f_"too many parameters, at most one 'os-version' is allowed for --list")
)
| `Notes ->
(match args with
@@ -323,4 +324,5 @@ read the man page virt-builder(1).
gpg = gpg; list_format = list_format; memsize = memsize;
network = network; ops = ops; output = output;
size = size; smp = smp; sources = sources; sync = sync;
warn_if_partition = warn_if_partition;
}

View File

@@ -30,7 +30,7 @@ type cmdline = {
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : [`Short|`Long|`Json];
list_format : List_entries.format;
memsize : int option;
network : bool;
ops : Customize_cmdline.ops;
@@ -39,6 +39,7 @@ type cmdline = {
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
val parse_cmdline : unit -> cmdline

View File

@@ -32,17 +32,12 @@ type t = {
cache : Cache.t option; (* cache for templates *)
}
type proxy_mode =
| UnsetProxy
| SystemProxy
| ForcedProxy of string
let create ~curl ~cache = {
curl = curl;
cache = cache;
}
let rec download t ?template ?progress_bar ?(proxy = SystemProxy) uri =
let rec download t ?template ?progress_bar ?(proxy = Curl.SystemProxy) uri =
match template with
| None -> (* no cache, simple download *)
(* Create a temporary name. *)
@@ -83,24 +78,38 @@ and download_to t ?(progress_bar = false) ~proxy uri filename =
unlink_on_exit filename_new;
(match parseduri.URI.protocol with
(* Download (ie. copy) from a local file. *)
| "file" ->
let path = parseduri.URI.path in
let cmd = sprintf "cp%s %s %s"
(if verbose () then " -v" else "")
(quote path) (quote filename_new) in
let r = Sys.command cmd in
let cmd = [ "cp" ] @
(if verbose () then [ "-v" ] else []) @
[ path; filename_new ] in
let r = run_command cmd in
if r <> 0 then
error (f_"cp (download) command failed copying '%s'") path;
| _ as protocol -> (* Any other protocol. *)
let outenv = proxy_envvar protocol proxy in
(* Any other protocol. *)
| _ ->
let common_args = [
"location", None; (* Follow 3xx redirects. *)
"url", Some uri; (* URI to download. *)
] in
let quiet_args = [ "silent", None; "show-error", None ] in
(* Get the status code first to ensure the file exists. *)
let cmd = sprintf "%s%s%s -L --max-redirs 5 -g -o /dev/null -I -w '%%{http_code}' %s"
outenv
t.curl
(if verbose () then "" else " -s -S")
(quote uri) in
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
let curl_h =
let curl_args = ref common_args in
if not (verbose ()) then append curl_args quiet_args;
append curl_args [
"output", Some "/dev/null"; (* Write output to /dev/null. *)
"head", None; (* Request only HEAD. *)
"write-out", Some "%{http_code}" (* HTTP status code to stdout. *)
];
Curl.create ~curl:t.curl !curl_args in
let lines = Curl.run curl_h in
if List.length lines < 1 then
error (f_"unexpected output from curl command, enable debug and look at previous messages");
let status_code = List.hd lines in
@@ -114,36 +123,19 @@ and download_to t ?(progress_bar = false) ~proxy uri filename =
error (f_"failed to download %s: HTTP status code %s") uri status_code;
(* Now download the file. *)
let cmd = sprintf "%s%s%s -L --max-redirs 5 -g -o %s %s"
outenv
t.curl
(if verbose () then "" else if progress_bar then " -#" else " -s -S")
(quote filename_new) (quote uri) in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
if r <> 0 then
error (f_"curl (download) command failed downloading '%s'") uri;
let curl_h =
let curl_args = ref common_args in
push_back curl_args ("output", Some filename_new);
if not (verbose ()) then (
if progress_bar then push_back curl_args ("progress-bar", None)
else append curl_args quiet_args
);
Curl.create ~curl:t.curl !curl_args in
ignore (Curl.run curl_h)
);
(* Rename the file if the download was successful. *)
rename filename_new filename
and proxy_envvar protocol = function
| UnsetProxy ->
(match protocol with
| "http" -> "env http_proxy= no_proxy=* "
| "https" -> "env https_proxy= no_proxy=* "
| "ftp" -> "env ftp_proxy= no_proxy=* "
| _ -> "env no_proxy=* "
)
| SystemProxy ->
(* No changes required. *)
""
| ForcedProxy proxy ->
let proxy = quote proxy in
(match protocol with
| "http" -> sprintf "env http_proxy=%s no_proxy= " proxy
| "https" -> sprintf "env https_proxy=%s no_proxy= " proxy
| "ftp" -> sprintf "env ftp_proxy=%s no_proxy= " proxy
| _ -> ""
)

View File

@@ -24,18 +24,10 @@ type filename = string
type t
(** The abstract data type. *)
(** Type of proxy. *)
type proxy_mode =
| UnsetProxy (* The proxy is forced off. *)
| SystemProxy (* The proxy is not changed (follows the
* system configuration).
*)
| ForcedProxy of string (* The proxy is forced to the specified URL. *)
val create : curl:string -> cache:Cache.t option -> t
(** Create the abstract type. *)
val download : t -> ?template:(string*string*Utils.revision) -> ?progress_bar:bool -> ?proxy:proxy_mode -> uri -> (filename * bool)
val download : t -> ?template:(string*string*Utils.revision) -> ?progress_bar:bool -> ?proxy:Curl.proxy -> uri -> (filename * bool)
(** Download the URI, returning the downloaded filename and a
temporary file flag. The temporary file flag is [true] iff
the downloaded file is temporary and should be deleted by the

View File

@@ -26,6 +26,13 @@
#include "index-struct.h"
#include "index-parse.h"
/* The generated code uses frames > 5000 bytes. */
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wframe-larger-than="
#pragma GCC diagnostic ignored "-Wstack-usage="
#endif
#define YY_EXTRA_TYPE struct parse_context *
extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg);
@@ -150,7 +157,8 @@ emptylines:
void
yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg)
{
int has_suffix = context->error_suffix != NULL && context->error_suffix[0] != 0;
const int has_suffix =
context->error_suffix != NULL && context->error_suffix[0] != 0;
fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s%s%s\n",
context->progname ? context->progname : "",

View File

@@ -16,9 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* This file handles the interface between the C/lex/yacc index file
* parser, and the OCaml world. See index_parser.ml for the OCaml
* type definition.
/**
* This file handles the interface between the C/lex/yacc index file
* parser, and the OCaml world. See F<builder/index_parser.ml> for
* the OCaml type definition.
*/
#include <config.h>

View File

@@ -45,6 +45,14 @@
extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
#if (YY_FLEX_MAJOR_VERSION > 2) \
|| ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION > 6)) \
|| ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION == 6) && (YY_FLEX_SUBMINOR_VERSION >= 1))
#define IS_EOF 0
#else
#define IS_EOF EOF
#endif
%}
%option nounput
@@ -82,7 +90,7 @@ extern void scanner_destroy (yyscan_t scanner);
yylval->field->next = NULL;
yylval->field->key = strndup (yytext, i);
if (yytext[i] == '[') {
size_t j = strcspn (yytext+i+1, "]");
const size_t j = strcspn (yytext+i+1, "]");
yylval->field->subkey = strndup (yytext+i+1, j);
i += 1+j+1;
} else {
@@ -104,7 +112,7 @@ extern void scanner_destroy (yyscan_t scanner);
int c, prevnl = 0;
/* Eat everything to the first blank line. */
while ((c = input (yyscanner)) != EOF) {
while ((c = input (yyscanner)) != IS_EOF) {
if (c == '\n' && prevnl)
break;
prevnl = c == '\n';
@@ -116,7 +124,7 @@ extern void scanner_destroy (yyscan_t scanner);
/* Hack to eat the PGP epilogue. */
^"-----BEGIN PGP SIGNATURE-----\n" {
/* Eat everything to the end of the file. */
while (input (yyscanner) != EOF)
while (input (yyscanner) != IS_EOF)
;
return PGP_EPILOGUE;

View File

@@ -23,6 +23,7 @@
#include <string.h>
#include <limits.h>
#include <getopt.h>
#include <error.h>
#include <errno.h>
#include <locale.h>
#include <libintl.h>
@@ -47,7 +48,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "V";
static const char options[] = "V";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "compat-1.24.0", 0, 0, 0 },
@@ -81,11 +82,10 @@ main (int argc, char *argv[])
compat_1_24_0 = compat_1_24_1 = 1;
else if (STREQ (long_options[option_index].name, "compat-1.24.1"))
compat_1_24_1 = 1;
else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'V':
@@ -108,10 +108,8 @@ main (int argc, char *argv[])
input = argv[optind++];
in = fopen (input, "r");
if (in == NULL) {
perror (input);
exit (EXIT_FAILURE);
}
if (in == NULL)
error (EXIT_FAILURE, errno, "fopen: %s", input);
ret = do_parse (&context, in);
@@ -122,16 +120,15 @@ main (int argc, char *argv[])
if (ret != 0) {
parse_context_free (&context);
fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
guestfs_int_program_name, input);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("'%s' could not be validated, see errors above"), input);
}
if (compat_1_24_1 && context.seen_comments) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s contains comments which will not work with virt-builder 1.24.1\n"),
guestfs_int_program_name, input);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("%s contains comments which will not work with virt-builder 1.24.1"),
input);
}
/* Iterate over the parsed sections, semantically validating it. */
@@ -142,9 +139,9 @@ main (int argc, char *argv[])
if (compat_1_24_0) {
if (strchr (sections->name, '_')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] has invalid characters which will not work with virt-builder 1.24.0\n"),
guestfs_int_program_name, input, sections->name);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("%s: section [%s] has invalid characters which will not work with virt-builder 1.24.0"),
input, sections->name);
}
}
@@ -153,18 +150,18 @@ main (int argc, char *argv[])
if (strchr (fields->key, '[') ||
strchr (fields->key, ']')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.0\n"),
guestfs_int_program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("%s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.0"),
input, sections->name, fields->key);
}
}
if (compat_1_24_1) {
if (strchr (fields->key, '.') ||
strchr (fields->key, ',')) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.1\n"),
guestfs_int_program_name, input, sections->name, fields->key);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("%s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.1"),
input, sections->name, fields->key);
}
}
if (STREQ (fields->key, "sig"))
@@ -173,9 +170,9 @@ main (int argc, char *argv[])
if (compat_1_24_0 && !seen_sig) {
parse_context_free (&context);
fprintf (stderr, _("%s: %s: section [%s] is missing a 'sig' field which will not work with virt-builder 1.24.0\n"),
guestfs_int_program_name, input, sections->name);
exit (EXIT_FAILURE);
error (EXIT_FAILURE, 0,
_("%s: section [%s] is missing a 'sig' field which will not work with virt-builder 1.24.0"),
input, sections->name);
}
}

View File

@@ -43,7 +43,7 @@ and entry = {
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
}
let print_entry chan (name, { printable_name = printable_name;

View File

@@ -35,7 +35,7 @@ and entry = {
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
}
val print_entry : out_channel -> (string * entry) -> unit

View File

@@ -30,10 +30,10 @@ let split_locale loc =
let territory = match_or_empty 3 in
(match territory with
| "" -> ()
| territory -> l := (lang ^ "_" ^ territory) :: !l);
l := lang :: !l;
| territory -> push_front (lang ^ "_" ^ territory) l);
push_front lang l;
);
l := "" :: !l;
push_front "" l;
List.rev !l
let languages () =

View File

@@ -21,11 +21,24 @@ open Common_utils
open Printf
type format =
| Short
| Long
| Json
let list_formats = [ "short"; "long"; "json" ]
let list_format_of_string = function
| "short" -> Short
| "long" -> Long
| "json" -> Json
| fmt -> invalid_arg fmt
let rec list_entries ~list_format ~sources index =
match list_format with
| `Short -> list_entries_short index
| `Long -> list_entries_long ~sources index
| `Json -> list_entries_json ~sources index
| Short -> list_entries_short index
| Long -> list_entries_long ~sources index
| Json -> list_entries_json ~sources index
and list_entries_short index =
List.iter (

View File

@@ -16,4 +16,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:Sources.source list -> Index.index -> unit
type format =
| Short
| Long
| Json
val list_formats : string list
(** The string representation of the available formats. *)
val list_format_of_string : string -> format
(** Convert from a string to the corresponding format.
Throw [Invalid_argument] if the string does not match any
valid format. *)
val list_entries : list_format:format -> sources:Sources.source list -> Index.index -> unit

View File

@@ -110,7 +110,7 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
pid = fork ();
if (pid == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "fork", Nothing);
}
@@ -166,6 +166,9 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
if (fd == -1)
unix_error (errno, (char *) "open", filenamev);
guestfs_int_fadvise_noreuse (fd);
guestfs_int_fadvise_random (fd);
/* Check file magic. */
if (!check_header_magic (fd)) {
close (fd);
@@ -185,40 +188,37 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
*/
ofd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_NOCTTY, 0644);
if (ofd == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "open", outputfilev);
}
guestfs_int_fadvise_random (ofd);
if (ftruncate (ofd, 1) == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "ftruncate", outputfilev);
}
if (lseek (ofd, 0, SEEK_SET) == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "lseek", outputfilev);
}
if (write (ofd, "\0", 1) == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "write", outputfilev);
}
if (ftruncate (ofd, size) == -1) {
int err = errno;
const int err = errno;
close (fd);
unix_error (err, (char *) "ftruncate", outputfilev);
}
#if defined HAVE_POSIX_FADVISE
/* Tell the kernel we won't read the output file. */
ignore_value (posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED));
#endif
/* Iterate over blocks. */
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd);
@@ -226,6 +226,9 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
if (close (fd) == -1)
unix_error (errno, (char *) "close", filenamev);
if (close (ofd) == -1)
unix_error (errno, (char *) "close", outputfilev);
}
static int
@@ -250,8 +253,8 @@ parse_indexes (value filenamev, int fd)
{
lzma_ret r;
off_t pos, index_size;
uint8_t footer[LZMA_STREAM_HEADER_SIZE];
uint8_t header[LZMA_STREAM_HEADER_SIZE];
CLEANUP_FREE uint8_t *footer = NULL;
CLEANUP_FREE uint8_t *header = NULL;
lzma_stream_flags footer_flags;
lzma_stream_flags header_flags;
lzma_stream strm = LZMA_STREAM_INIT;
@@ -260,6 +263,13 @@ parse_indexes (value filenamev, int fd)
lzma_index *this_index = NULL;
lzma_vli stream_padding = 0;
size_t nr_streams = 0;
CLEANUP_FREE uint8_t *buf = NULL;
footer = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE);
header = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE);
buf = malloc (sizeof (uint8_t) * BUFSIZ);
if (footer == NULL || header == NULL || buf == NULL)
caml_raise_out_of_memory ();
/* Check file size is a multiple of 4 bytes. */
pos = lseek (fd, 0, SEEK_END);
@@ -322,13 +332,11 @@ parse_indexes (value filenamev, int fd)
}
do {
uint8_t buf[BUFSIZ];
strm.avail_in = index_size;
if (strm.avail_in > BUFSIZ)
strm.avail_in = BUFSIZ;
n = read (fd, &buf, strm.avail_in);
n = read (fd, buf, strm.avail_in);
if (n == -1)
unix_error (errno, (char *) "read", filenamev);
@@ -454,12 +462,17 @@ iter_blocks (lzma_index *idx, unsigned nr_threads,
value filenamev, int fd, value outputfilev, int ofd)
{
struct global_state global;
struct per_thread_state per_thread[nr_threads];
pthread_t thread[nr_threads];
CLEANUP_FREE struct per_thread_state *per_thread = NULL;
CLEANUP_FREE pthread_t *thread = NULL;
unsigned u, nr_errors;
int err;
void *status;
per_thread = malloc (sizeof (struct per_thread_state) * nr_threads);
thread = malloc (sizeof (pthread_t) * nr_threads);
if (per_thread == NULL || thread == NULL)
caml_raise_out_of_memory ();
lzma_index_iter_init (&global.iter, idx);
global.iter_finished = 0;
err = pthread_mutex_init (&global.iter_mutex, NULL);

View File

@@ -39,8 +39,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
let cmd = sprintf "%s --homedir %s --status-file %s --import %s%s"
gpg gpghome (quote status_file) (quote keyfile)
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
let r = shell_command cmd in
if r <> 0 then
error (f_"could not import public key\nUse the '-v' option and look for earlier error messages.");
let status = read_whole_file status_file in
@@ -59,8 +58,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
let cmd = sprintf "%s --homedir %s --trusted-key %s --list-keys%s"
gpg gpghome (quote !key_id)
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not trust the imported key\nUse the '-v' option and look for earlier error messages.");
);
@@ -69,7 +67,6 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
* fingerprint of the subkeys. *)
let cmd = sprintf "%s --homedir %s --with-colons --with-fingerprint --with-fingerprint --list-keys %s"
gpg gpghome !fingerprint in
if verbose () then printf "%s\n%!" cmd;
let lines = external_command cmd in
let current = ref None in
let subkeys = ref [] in
@@ -83,9 +80,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
(match !current with
| None -> ()
| Some k ->
if String.is_suffix id k then (
subkeys := id :: !subkeys;
);
if String.is_suffix id k then push_front id subkeys;
current := None
)
| _ -> ()
@@ -109,8 +104,7 @@ let rec create ~gpg ~gpgkey ~check_signature =
*)
let cmd = sprintf "%s --homedir %s --list-keys%s"
gpg tmpdir (if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not run GPG the first time\nUse the '-v' option and look for earlier error messages.");
match gpgkey with
@@ -124,8 +118,7 @@ let rec create ~gpg ~gpgkey ~check_signature =
let cmd = sprintf "%s --yes --armor --output %s --export %s%s"
gpg (quote filename) (quote fp)
(if verbose () then "" else " >/dev/null 2>&1") in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
let r = shell_command cmd in
if r <> 0 then
error (f_"could not export public key\nUse the '-v' option and look for earlier error messages.");
import_keyfile gpg tmpdir filename
@@ -188,9 +181,8 @@ and verify_and_remove_signature t filename =
* so gpg recognises that format. *)
let asc_file = Filename.temp_file "vbfile" ".asc" in
unlink_on_exit asc_file;
let cmd = sprintf "cp %s %s" (quote filename) (quote asc_file) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1;
let cmd = [ "cp"; filename; asc_file ] in
if run_command cmd <> 0 then exit 1;
let out_file = Filename.temp_file "vbfile" "" in
unlink_on_exit out_file;
let args = sprintf "--yes --output %s %s" (quote out_file) (quote filename) in
@@ -208,8 +200,7 @@ and do_verify ?(verify_only = true) t args =
(if verify_only then "--verify" else "")
(if verbose () then "" else " --batch -q --logger-file /dev/null")
(quote status_file) args in
if verbose () then printf "%s\n%!" cmd;
let r = Sys.command cmd in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not verify digital signature of file\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!");

View File

@@ -26,7 +26,7 @@ type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
format : source_format;
}
and source_format =
@@ -36,9 +36,7 @@ and source_format =
module StringSet = Set.Make (String)
let parse_conf file =
if verbose () then (
printf (f_"%s: trying to read %s\n") prog file;
);
debug "trying to read %s" file;
let sections = Ini_reader.read_ini ~error_suffix:"[ignored]" file in
let sources = List.fold_right (
@@ -55,47 +53,34 @@ let parse_conf file =
try Some (URI.parse_uri (List.assoc ("gpgkey", None) fields)) with
| Not_found -> None
| Invalid_argument "URI.parse_uri" as ex ->
if verbose () then (
printf (f_"%s: '%s' has invalid gpgkey URI\n") prog n;
);
raise ex in
debug "'%s' has invalid gpgkey URI" n;
raise ex in
match k with
| None -> Utils.No_Key
| Some uri ->
(match uri.URI.protocol with
| "file" -> Utils.KeyFile uri.URI.path
| _ ->
if verbose () then (
printf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
);
Utils.No_Key
debug "'%s' has non-local gpgkey URI" n;
Utils.No_Key
) in
let proxy =
try
(match (List.assoc ("proxy", None) fields) with
| "no" | "off" -> Downloader.UnsetProxy
| "system" -> Downloader.SystemProxy
| _ as proxy -> Downloader.ForcedProxy proxy
| "no" | "off" -> Curl.UnsetProxy
| "system" -> Curl.SystemProxy
| _ as proxy -> Curl.ForcedProxy proxy
)
with
Not_found -> Downloader.SystemProxy in
Not_found -> Curl.SystemProxy in
let format =
try
(match (List.assoc ("format", None) fields) with
| "native" | "" -> FormatNative
| "simplestreams" as fmt ->
if not (Yajl.yajl_is_available ()) then (
if verbose () then (
eprintf (f_"%s: repository type '%s' not supported (missing YAJL support), skipping it\n") prog fmt;
);
invalid_arg fmt
) else
FormatSimpleStreams
| "simplestreams" -> FormatSimpleStreams
| fmt ->
if verbose () then (
eprintf (f_"%s: unknown repository type '%s' in %s, skipping it\n") prog fmt file;
);
invalid_arg fmt
debug "unknown repository type '%s' in %s, skipping it" fmt file;
invalid_arg fmt
)
with
Not_found -> FormatNative in
@@ -108,9 +93,7 @@ let parse_conf file =
with Not_found | Invalid_argument _ -> acc
) sections [] in
if verbose () then (
printf (f_"%s: ... read %d sources\n") prog (List.length sources);
);
debug "read %d sources" (List.length sources);
sources
@@ -151,14 +134,10 @@ let read_sources () =
s
) with
| Unix_error (code, fname, _) ->
if verbose () then (
printf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
);
acc
debug "file error: %s: %s\n" fname (error_message code);
acc
| Invalid_argument msg ->
if verbose () then (
printf (f_"%s: internal error: invalid argument: %s\n") prog msg
);
acc
debug "internal error: invalid argument: %s" msg;
acc
) acc files
) [] dirs

View File

@@ -20,7 +20,7 @@ type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
format : source_format;
}
and source_format =

View File

@@ -0,0 +1,25 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
$srcdir/../podcheck.pl virt-builder.pod virt-builder \
--insert $srcdir/../customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $srcdir/../customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--ignore=--check-signatures,--no-check-signatures

View File

@@ -24,6 +24,11 @@ abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
if [ -z "$SLOW" ]; then
echo "$0: use 'make check-slow' to run this test"
exit 77
fi
if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
echo "$0: test skipped because there is no fedora.xz, fedora.qcow2 or fedora.qcow2.xz in the build directory"
exit 77

View File

@@ -16,7 +16,7 @@ virt-builder - Build virtual machine images quickly
[--arch ARCHITECTURE] [--attach ISOFILE]
__CUSTOMIZE_SYNOPSIS__
virt-builder -l|--list [--long] [--list-format short|long|json]
virt-builder -l|--list [--long] [--list-format short|long|json] [os-version]
virt-builder --notes os-version
@@ -241,6 +241,15 @@ Using I<--no-check-signature> bypasses this check.
See also I<--fingerprint>.
=item B<--colors>
=item B<--colours>
Use ANSI colour sequences to colourize messages. This is the default
when the output is a tty. If the output of the program is redirected
to a file, ANSI colour sequences are disabled unless you use this
option.
=item B<--curl> CURL
Specify an alternate L<curl(1)> binary. You can also use this to add
@@ -311,15 +320,16 @@ alternate home directory:
virt-builder --gpg "gpg --homedir /tmp" [...]
=item B<-l>
=item B<-l> [os-version]
=item B<--list>
=item B<--list> [os-version]
=item B<--list --list-format> format
=item B<--list> B<--list-format> format [os-version]
=item B<--list --long>
=item B<--list> B<--long> [os-version]
List available templates.
List all the available templates if no guest is specified, or only for the
specified one.
It is possible to choose with I<--list-format> the output format for the list
templates:
@@ -495,6 +505,15 @@ Note that you should not point I<--source> to sources that you don't
trust (unless the source is signed by someone you do trust). See also
the I<--no-network> option.
=item B<--no-warn-if-partition>
Do not emit a warning if the output device is a partition. This
warning avoids a common user error when writing to a USB key or
external drive, when you should normally write to the whole device
(S<I<--output /dev/sdX>>), not to a partition on the device
(S<I<--output /dev/sdX1>>). Use this option to I<suppress> this
warning.
=item B<-v>
=item B<--verbose>
@@ -839,16 +858,17 @@ F<~root/virt-sysprep-firstboot.log>.
=item Windows
F<rhsrvany.exe>, available from sources at
L<https://github.com/rwmjones/rhsrvany>, is installed to run the
L<https://github.com/rwmjones/rhsrvany>, or F<pvvxsvc.exe>, available
with SUSE VMDP is installed to run the
first boot scripts. It is required, and the setup of first boot
scripts will fail if it is not present.
F<rhsrvany.exe> is copied from the location pointed to by the
F<rhsrvany.exe> or F<pvvxsvc.exe> is copied from the location pointed to by the
C<VIRT_TOOLS_DATA_DIR> environment variable; if not set, a compiled-in
default will be used (something like F</usr/share/virt-tools>).
The output of the first boot scripts is available in the guest as
F<C:\Program Files\Red Hat\Firstboot\log.txt>.
F<C:\Program Files\Guestfs\Firstboot\log.txt>.
=back
@@ -1736,20 +1756,19 @@ two possible strategies it can use to ensure correct labelling:
=item Using I<--selinux-relabel>
This runs L<fixfiles(8)> just before finalizing the guest, which sets
This runs L<setfiles(8)> just before finalizing the guest, which sets
SELinux labels correctly in the disk image.
Sometimes fixfiles is not possible during installation, in which case
this option falls back on:
This is the recommended method.
=item Touching F</.autorelabel>
=item I<--touch> F</.autorelabel>
Guest templates may already contain a file called F</.autorelabel>, or
it is touched if I<--selinux-relabel> cannot run fixfiles.
Guest templates may already contain a file called F</.autorelabel> or
you may touch it.
For guests that use SELinux, this causes fixfiles to run at first
boot. Guests will reboot themselves once the first time you use them,
which is normal and harmless.
For guests that use SELinux, this causes L<restorecon(8)> to run at
first boot. Guests will reboot themselves once the first time you use
them, which is normal and harmless.
=back
@@ -1819,6 +1838,12 @@ I<--firstboot> or I<--firstboot-command> options with Windows guests.
See also: C<https://github.com/rwmjones/rhsrvany>
=item F<pvvxsvc.exe>
This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot"
script in Windows guests. It is required if you intend to use the
I<--firstboot> or I<--firstboot-command> options with Windows guests.
=back
=item C<XDG_CACHE_HOME>
@@ -1858,7 +1883,6 @@ L<gpg(1)>,
L<curl(1)>,
L<virt-make-fs(1)>,
L<genisoimage(1)>,
L<fixfiles(8)>,
L<http://libguestfs.org/>.
=head1 AUTHOR

View File

@@ -26,6 +26,7 @@ EXTRA_DIST = \
index \
index.asc \
centos.sh \
centos-aarch64.sh \
debian.preseed \
debian.sh \
fedora.sh \
@@ -40,7 +41,8 @@ EXTRA_DIST = \
rhel-ppc64le.sh \
scientificlinux.sh \
ubuntu.preseed \
ubuntu.sh
ubuntu.sh \
ubuntu-ppc64le.sh
CLEANFILES = *~

View File

@@ -0,0 +1,93 @@
#!/bin/bash -
# virt-builder
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -ne 1 ]; then
echo "$0 VERSION"
exit 1
fi
version=$1
output=centos-$version-aarch64
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
case $version in
7.*)
major=7
# XXX This always points to the latest CentOS 7, so
# effectively the minor number is always ignored.
tree=http://mirror.centos.org/altarch/$major/os/aarch64/
;;
esac
rm -f $output $output.old $output.xz
# Generate the kickstart to a temporary file.
ks=$(mktemp)
cat > $ks <<'EOF'
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
autopart --type=plain
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
EOF
# Clean up function.
cleanup ()
{
rm -f $ks
virsh undefine $tmpname ||:
}
trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=2048 \
--cpu=cortex-a57 --vcpus=2 \
--os-type=linux --os-variant=centos$major.0 \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` earlyprintk=pl011,0x9000000 ignore_loglevel console=ttyAMA0 no_timer_check printk.time=1 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6,format=raw \
--serial pty \
--location=$tree \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -96,4 +96,6 @@ virt-install \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -20,10 +20,14 @@
output=$1
relabel_args=()
if [ -n "$DO_RELABEL" ]; then
relabel_args="--selinux-relabel"
fi
# Sysprep (removes logfiles and so on).
# Note this also touches /.autorelabel so the further installation
# changes that we make will be labelled properly at first boot.
virt-sysprep -a $output
virt-sysprep -a $output $relabel_args
# Sparsify.
mv $output $output.old

View File

@@ -64,6 +64,9 @@ poweroff
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -79,14 +82,14 @@ trap cleanup INT QUIT TERM EXIT ERR
# https://bugzilla.redhat.com/show_bug.cgi?id=1189143
# work around it:
vars=$(mktemp)
cp /usr/share/edk2.git/aarch64/vars-template-pflash.raw $vars
cp /usr/share/edk2/aarch64/vars-template-pflash.raw $vars
virt-install \
--name=$tmpname \
--ram=4096 \
--cpu=host --vcpus=2 \
--os-type=linux --os-variant=fedora21 \
--boot loader=/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=$vars \
--boot loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=$vars \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` earlyprintk=pl011,0x9000000 ignore_loglevel console=ttyAMA0 no_timer_check printk.time=1 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6,format=raw \
@@ -100,4 +103,6 @@ virt-install \
cp $vars $output-nvram
xz --best $output-nvram
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -29,7 +29,7 @@ if [ $# -ne 1 ]; then
fi
version=$1
tree=http://mirror.ox.ac.uk/sites/download.fedora.redhat.com/pub/fedora/linux/releases/$version/Server/armhfp/os/
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Server/armhfp/os/
output=fedora-$version-armv7l
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
@@ -64,6 +64,9 @@ poweroff
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -78,8 +81,9 @@ trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=1024 \
--cpu=host --vcpus=2 \
--os-type=linux --os-variant=fedora21 \
--vcpus=1 \
--arch armv7l \
--os-type=linux --os-variant=fedora22 \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyAMA0,115200 proxy=$http_proxy" \
--disk $(pwd)/$output,size=6,format=raw \
@@ -88,4 +92,6 @@ virt-install \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -73,6 +73,9 @@ popd
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -97,10 +100,6 @@ virt-install \
--nographics \
--noreboot
# https://bugzilla.redhat.com/show_bug.cgi?id=1280029
# (Only for Fedora 23)
if [ "$version" = "23" ]; then
virt-customize -a $output --install "https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-conf-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-yum-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/python3-dnf-1.1.4-2.fc23.noarch.rpm"
fi
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -64,6 +64,9 @@ poweroff
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -89,4 +92,6 @@ virt-install \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -64,6 +64,9 @@ poweroff
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -89,4 +92,6 @@ virt-install \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -73,6 +73,9 @@ popd
# Rerun dracut for the installed kernel (not the running kernel):
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
# Ensure the installation is up-to-date:
dnf -y --best upgrade
%end
EOF
@@ -97,10 +100,6 @@ virt-install \
--nographics \
--noreboot
# https://bugzilla.redhat.com/show_bug.cgi?id=1280029
# (Only for Fedora 23)
if [ "$version" = "23" ]; then
virt-customize -a $output --install "https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-conf-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/dnf-yum-1.1.4-2.fc23.noarch.rpm,https://kojipkgs.fedoraproject.org//packages/dnf/1.1.4/2.fc23/noarch/python3-dnf-1.1.4-2.fc23.noarch.rpm"
fi
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -78,6 +78,25 @@ notes=CentOS 7.2
builder/website/centos.sh
[centos-7.2]
name=CentOS 7.2 (aarch64)
osinfo=centos7.2
arch=aarch64
file=centos-7.2-aarch64.xz
checksum=e61c5381026c419110ec42626c1cbb0e081240ae4d8c70f5bac2c80d771d5159b72dd3723068cf3cc9339e095b05b62d29ba9c22ef199f53a4e89c07e5615ca3
format=raw
size=6442450944
compressed_size=248167668
expand=/dev/sda4
notes=CentOS 7.2 (aarch64)
This CentOS image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/centos-aarch64.sh
[cirros-0.3.1]
name=CirrOS 0.3.1
arch=x86_64
@@ -500,11 +519,11 @@ name=Fedora® 23 Server
osinfo=fedora23
arch=x86_64
file=fedora-23.xz
revision=2
checksum=c93e2e8e3b95f63743f87f891c605a6bbd02ccdf84c4fba776c8f2e55484b98f1bf10c46ea1429b2cbb3ce95dec1a7940479d068dca932cdf50c39e0f12af95f
revision=3
checksum=90cd606923e16e2c01a08eaa360e213cdd49462e259a04cc6efb1d2516215fb4ac3c62811dfd1646d89650f717da030fa6dec693571e027a644eee589accb78d
format=raw
size=6442450944
compressed_size=260381256
compressed_size=317209280
expand=/dev/sda3
notes=Fedora 23 Server.
@@ -523,10 +542,11 @@ name=Fedora® 23 Server (i686)
osinfo=fedora23
arch=i686
file=fedora-23-i686.xz
checksum=b3142d8330f68870e986bd2861e6ad8bda27a6fe3eede3dc6bfc3c841fcc87caed98c829da9a2e7f5d866fedbbc8eccfff83bbc9cda0246cd57486e462a9f3c9
revision=2
checksum=4b1badbb92f40ca1b3336e70b2564755d643bc00005fd6364c389a1f3078952968a6887c36c4f79fe3873cf42d41cb36dd226521fee32ed6e08c65d6d059af3c
format=raw
size=6442450944
compressed_size=259261944
compressed_size=322831152
expand=/dev/sda3
notes=Fedora 23 Server (i686)
@@ -565,6 +585,28 @@ notes=Fedora 23 Server (aarch64)
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-23]
name=Fedora® 23 Server (armv7l)
osinfo=fedora23
arch=armv7l
file=fedora-23-armv7l.xz
checksum=e2c74544b3e9d25c92724536875a3cbcee0c4c4774bb3956ce6938fdbf1588781a1eb3b54a5fad8cc0d63f0af0c699f7e322c613e13552591eec641edf401d78
format=raw
size=6442450944
compressed_size=241758696
expand=/dev/sda3
notes=Fedora 23 Server (armv7l)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-armv7l.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-23]
name=Fedora® 23 Server (ppc64)
osinfo=fedora23
@@ -610,6 +652,97 @@ notes=Fedora 23 Server (ppc64le)
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server
osinfo=fedora24
arch=x86_64
file=fedora-24.xz
checksum=907656be1f0bb4ed221a54f4339660d02071bdf79acd1644087e5ca20e315ba8e4b9008d7f0814a840904198a54499556f226db8b32f96a01ecd20370da8d03d
format=raw
size=6442450944
compressed_size=321359432
expand=/dev/sda3
notes=Fedora 24 Server.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (i686)
osinfo=fedora24
arch=i686
file=fedora-24-i686.xz
checksum=1461da1557327e0641987654919698a6b7c2df1c58f76a4a4d61fb66476dac1b19fe6e3650b82a246df7d241037725c7b8e57e73d3312e370dfb132f54b5cbf4
format=raw
size=6442450944
compressed_size=319087504
expand=/dev/sda3
notes=Fedora 24 Server (i686)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-i686.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (armv7l)
osinfo=fedora24
arch=armv7l
file=fedora-24-armv7l.xz
checksum=7d9a5ce8e10c13e8d07ace42555183bfee5e561464e9fc439d0fefc3e85048bdc0c14d44d5584029d4015d0f3316c7583af8ae6d4c0ff8bcfcdb9037a37cacc0
format=raw
size=6442450944
compressed_size=324231484
expand=/dev/sda3
notes=Fedora 24 Server (armv7l)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-armv7l.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (aarch64)
osinfo=fedora24
arch=aarch64
file=fedora-24-aarch64.xz
checksum=d17a0ee0e5f661f9d2cbffe12dae306f295a0716ef440a12944d3d2805f5a5c637766c98267e914f588502d7ba7eca888edd93ae34a15e30faf907d8c55f4689
format=raw
size=6442450944
compressed_size=287727544
expand=/dev/sda4
notes=Fedora 24 Server (aarch64)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-aarch64.sh
You may need to use the associated EFI NVRAM variables:
http://libguestfs.org/download/builder/fedora-24-aarch64-nvram.xz
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.5
osinfo=centos6.5
@@ -713,3 +846,34 @@ notes=Ubuntu 14.04 (Trusty).
image contains a user account 'builder'. I have disabled it, so that
people who don't read release notes don't get caught out, but you might
still wish to delete it completely.
[ubuntu-16.04]
name=Ubuntu 16.04 (Xenial)
osinfo=ubuntuxenial
arch=x86_64
file=ubuntu-16.04.xz
checksum=56f9f7621fc5f60a01d0c2471fcddaa449979871aeaacb4d936b733f031dd40bb3c29fe73f8636dcaceb6c1413ebb1feff7381f1b24695e9750d106e243884d1
format=raw
size=4294967296
compressed_size=232828552
expand=/dev/sda1
notes=Ubuntu 16.04 (Xenial).
This is a minimal Ubuntu 16.04 (Xenial) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
IMPORTANT NOTE: It seems to be impossible to create an Ubuntu >= 14.04
image using preseed without creating a user account. Therefore this
image contains a user account 'builder'. I have disabled it, so that
people who don't read release notes don't get caught out, but you might
still wish to delete it completely.

View File

@@ -81,6 +81,25 @@ notes=CentOS 7.2
builder/website/centos.sh
[centos-7.2]
name=CentOS 7.2 (aarch64)
osinfo=centos7.2
arch=aarch64
file=centos-7.2-aarch64.xz
checksum=e61c5381026c419110ec42626c1cbb0e081240ae4d8c70f5bac2c80d771d5159b72dd3723068cf3cc9339e095b05b62d29ba9c22ef199f53a4e89c07e5615ca3
format=raw
size=6442450944
compressed_size=248167668
expand=/dev/sda4
notes=CentOS 7.2 (aarch64)
This CentOS image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/centos-aarch64.sh
[cirros-0.3.1]
name=CirrOS 0.3.1
arch=x86_64
@@ -503,11 +522,11 @@ name=Fedora® 23 Server
osinfo=fedora23
arch=x86_64
file=fedora-23.xz
revision=2
checksum=c93e2e8e3b95f63743f87f891c605a6bbd02ccdf84c4fba776c8f2e55484b98f1bf10c46ea1429b2cbb3ce95dec1a7940479d068dca932cdf50c39e0f12af95f
revision=3
checksum=90cd606923e16e2c01a08eaa360e213cdd49462e259a04cc6efb1d2516215fb4ac3c62811dfd1646d89650f717da030fa6dec693571e027a644eee589accb78d
format=raw
size=6442450944
compressed_size=260381256
compressed_size=317209280
expand=/dev/sda3
notes=Fedora 23 Server.
@@ -526,10 +545,11 @@ name=Fedora® 23 Server (i686)
osinfo=fedora23
arch=i686
file=fedora-23-i686.xz
checksum=b3142d8330f68870e986bd2861e6ad8bda27a6fe3eede3dc6bfc3c841fcc87caed98c829da9a2e7f5d866fedbbc8eccfff83bbc9cda0246cd57486e462a9f3c9
revision=2
checksum=4b1badbb92f40ca1b3336e70b2564755d643bc00005fd6364c389a1f3078952968a6887c36c4f79fe3873cf42d41cb36dd226521fee32ed6e08c65d6d059af3c
format=raw
size=6442450944
compressed_size=259261944
compressed_size=322831152
expand=/dev/sda3
notes=Fedora 23 Server (i686)
@@ -568,6 +588,28 @@ notes=Fedora 23 Server (aarch64)
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-23]
name=Fedora® 23 Server (armv7l)
osinfo=fedora23
arch=armv7l
file=fedora-23-armv7l.xz
checksum=e2c74544b3e9d25c92724536875a3cbcee0c4c4774bb3956ce6938fdbf1588781a1eb3b54a5fad8cc0d63f0af0c699f7e322c613e13552591eec641edf401d78
format=raw
size=6442450944
compressed_size=241758696
expand=/dev/sda3
notes=Fedora 23 Server (armv7l)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-armv7l.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-23]
name=Fedora® 23 Server (ppc64)
osinfo=fedora23
@@ -613,6 +655,97 @@ notes=Fedora 23 Server (ppc64le)
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server
osinfo=fedora24
arch=x86_64
file=fedora-24.xz
checksum=907656be1f0bb4ed221a54f4339660d02071bdf79acd1644087e5ca20e315ba8e4b9008d7f0814a840904198a54499556f226db8b32f96a01ecd20370da8d03d
format=raw
size=6442450944
compressed_size=321359432
expand=/dev/sda3
notes=Fedora 24 Server.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (i686)
osinfo=fedora24
arch=i686
file=fedora-24-i686.xz
checksum=1461da1557327e0641987654919698a6b7c2df1c58f76a4a4d61fb66476dac1b19fe6e3650b82a246df7d241037725c7b8e57e73d3312e370dfb132f54b5cbf4
format=raw
size=6442450944
compressed_size=319087504
expand=/dev/sda3
notes=Fedora 24 Server (i686)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-i686.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (armv7l)
osinfo=fedora24
arch=armv7l
file=fedora-24-armv7l.xz
checksum=7d9a5ce8e10c13e8d07ace42555183bfee5e561464e9fc439d0fefc3e85048bdc0c14d44d5584029d4015d0f3316c7583af8ae6d4c0ff8bcfcdb9037a37cacc0
format=raw
size=6442450944
compressed_size=324231484
expand=/dev/sda3
notes=Fedora 24 Server (armv7l)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-armv7l.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[fedora-24]
name=Fedora® 24 Server (aarch64)
osinfo=fedora24
arch=aarch64
file=fedora-24-aarch64.xz
checksum=d17a0ee0e5f661f9d2cbffe12dae306f295a0716ef440a12944d3d2805f5a5c637766c98267e914f588502d7ba7eca888edd93ae34a15e30faf907d8c55f4689
format=raw
size=6442450944
compressed_size=287727544
expand=/dev/sda4
notes=Fedora 24 Server (aarch64)
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/fedora-aarch64.sh
You may need to use the associated EFI NVRAM variables:
http://libguestfs.org/download/builder/fedora-24-aarch64-nvram.xz
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.5
osinfo=centos6.5
@@ -711,6 +844,37 @@ notes=Ubuntu 14.04 (Trusty).
--firstboot-command "dpkg-reconfigure openssh-server"
IMPORTANT NOTE: It seems to be impossible to create an Ubuntu >= 14.04
image using preseed without creating a user account. Therefore this
image contains a user account 'builder'. I have disabled it, so that
people who don't read release notes don't get caught out, but you might
still wish to delete it completely.
[ubuntu-16.04]
name=Ubuntu 16.04 (Xenial)
osinfo=ubuntuxenial
arch=x86_64
file=ubuntu-16.04.xz
checksum=56f9f7621fc5f60a01d0c2471fcddaa449979871aeaacb4d936b733f031dd40bb3c29fe73f8636dcaceb6c1413ebb1feff7381f1b24695e9750d106e243884d1
format=raw
size=4294967296
compressed_size=232828552
expand=/dev/sda1
notes=Ubuntu 16.04 (Xenial).
This is a minimal Ubuntu 16.04 (Xenial) install.
Only the openssh-server package is selected in tasksel.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/ubuntu.preseed
builder/website/ubuntu.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
IMPORTANT NOTE: It seems to be impossible to create an Ubuntu >= 14.04
image using preseed without creating a user account. Therefore this
image contains a user account 'builder'. I have disabled it, so that
@@ -719,17 +883,17 @@ notes=Ubuntu 14.04 (Trusty).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJWdcxuAAoJEJFzj3Pht2igOjQP/1HkiZAlbRp21cKzZMzidGRt
23UExFQCn+drvXWTcp07iAKfM7UUqMgnRt7ixRVJfz8TIOqc6PpazoxQAsXLhxm+
8PrM/nSlH9Ei96jdaoaq2vbEacFp0T8Nina2eVc57CwQm+qBsEO+BJOXtAfP3ov7
msSotWDQxRD+fJ9lfpSigh00sGuuMRI8l3WYU9Ed2dVAAn4OBDRyviEfZJgzur+M
fuQunRUVsoXZtMi5u68PXgM5ineGbmeNisoo7fN76qdAFm6/2/zpwXhrEMasAQqD
P9xUikrysY393Fh5x9sdkppWSlcvAI+Fy1hSDG1fRmLMZ3cBHAtE7pvdFq0EIT+J
fz4UYlZzseXq7lbYDqa19G+fx+QN1TfMQ7TMKpuBbmWb07b6HMZYDqG+Ylv4bZAO
w3Nzld9lPuOCuuCqyF0cnzBwr+d+4+MTQxWIfsCaANCOE3woLZUzXRCaEq5DmJXH
TepWKjvzRbx2TZJ94rmhE3prvzif7tjHiQDB2Y+xjgmCfkcwNUjqN6unHwL2ok8A
geS+rsvLtpBRogDsNss+9xbES0mDNlWYcIH8a+AKa3V3Bij+CEka4tqfh4pmda+6
UcmDftez5Nr00vIIKWFTk8o8cqBXw58pg6oKTrS/DVZmeG5dou3VKQ80ud5sIUYn
MggZT1FA49hd9I/Qe2sd
=Nm6w
iQIcBAEBAgAGBQJXhizFAAoJEJFzj3Pht2igUIQQAKga2A4gL9wAaJbYCb6AS3+7
ngWN5coZdbu2FUj1I1xd10Ozjzid25UzdmzEZmSs1menwMeUyUJZtI2SXW8MWAor
KvkFr9iPWVfLXPMzPTrPZZRTWkryae3JFthcGWW1pHErZU6Icv/Vz0oNDKm7ZQoo
3fgYNM/19mVSskIrcqMTsKCY3DJaokRt7LfWuEL8gf47+KQQ4qaRQ+iuqqU4/sFx
pFbCHBhYqnnNDUCQI6FwiOCegR8Tsf36BvXCWYMb5FltE0IggcrwraRdCa67DpjJ
3D2W+Wvt4sk7TMWJCz6ZiO8GdAqR9+WGEeKxQQLRxX8k8fagZHw/+tdMkLGuHhPr
Ys2yofR+5vCvA9RDMqObolvmFvyUaUmjH3UFMZM3P8N0mAzlAuBOIFKq2RWhcVll
+EUc0B7UmrusMe76czAqOpltAlrIOJXfxnvTremZixRA2svWMntSuU52fe+TxWuj
aZVbJdwvDfQ0yrHKneoP/v9/EXUCfgwvjHTIbZEG8b8TI4VbF8//9K+JEjJz8zlF
QeqvWwBu9AlDF0RnSTNEFNDvqbfgs5E26ZGg/cDQv+x8UePkiETuAfH8E5ePIp0f
U6NYmlxVvL4sjE6mU4KmEVuYgL12QbaRJCCFYiP6/XuZ4MnoD/w+ko5as2W7OpaR
LrXbWO32TZL8n6RHFlog
=HADO
-----END PGP SIGNATURE-----

View File

@@ -134,14 +134,14 @@ trap cleanup INT QUIT TERM EXIT ERR
# https://bugzilla.redhat.com/show_bug.cgi?id=1189143
# work around it:
vars=$(mktemp)
cp /usr/share/edk2.git/aarch64/vars-template-pflash.raw $vars
cp /usr/share/edk2/aarch64/vars-template-pflash.raw $vars
virt-install \
--name=$tmpname \
--ram=2048 \
--cpu=cortex-a57 --vcpus=1 \
--os-type=linux --os-variant=rhel$major \
--boot loader=/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=$vars \
--boot loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=$vars \
--initrd-inject=$ks \
--extra-args="ks=file:/`basename $ks` earlyprintk=pl011,0x9000000 ignore_loglevel console=ttyAMA0 no_timer_check printk.time=1" \
--disk $(pwd)/$output,size=6,format=raw \
@@ -159,4 +159,6 @@ cp $vars $output-nvram
guestfish --rw -a $output -m $guestroot \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -140,4 +140,6 @@ virt-install \
guestfish --rw -a $output -m $guestroot \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -32,12 +32,12 @@ fi
version=$1
output=rhel-$version-ppc64le
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
guestroot=/dev/rhel-l/root
guestroot=/dev/rhel/root
case $version in
7.*)
major=7
topurl=http://download.devel.redhat.com/released/RHEL-LE-$major/$version
topurl=http://download.devel.redhat.com/released/RHEL-$major/$version
tree=$topurl/Server/ppc64le/os
baseurl=$tree
srpms=$topurl/Server/source/tree
@@ -140,4 +140,6 @@ virt-install \
guestfish --rw -a $output -m $guestroot \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -225,4 +225,6 @@ guestfish --rw -a $output -m $guestroot \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
fi
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -86,4 +86,6 @@ virt-install \
--nographics \
--noreboot
DO_RELABEL=1
source $(dirname "$0")/compress.sh $output

View File

@@ -0,0 +1,76 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# The basic plan comes from:
# http://honk.sigxcpu.org/con/Preseeding_Debian_virtual_machines_with_virt_install.html
# https://wiki.debian.org/DebianInstaller/Preseed
# https://help.ubuntu.com/10.04/installation-guide/i386/preseed-using.html
unset CDPATH
export LANG=C
set -e
set -x
if [ $# -lt 2 -o $# -gt 3 ]; then
echo "$0 VERSION DIST [OSVARIANT]"
exit 1
fi
# Some configuration.
version=$1
dist=$2
osvariant=$3
if [ -z "$osvariant" ]; then osvariant=ubuntu$dist; fi
location=http://ports.ubuntu.com/ubuntu-ports/dists/$dist/main/installer-ppc64el
output=ubuntu-$version-ppc64le
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
rm -f $output $output.old $output.xz
# Make sure it's being run from the correct directory.
if [ ! -f ubuntu.preseed ]; then
echo "You are running this script from the wrong directory."
exit 1
fi
# Note that the injected file must be called "/preseed.cfg" in order
# for d-i to pick it up.
sed -e "s,@CACHE@,$http_proxy,g" < ubuntu.preseed > preseed.cfg
# Clean up function.
cleanup ()
{
rm -f preseed.cfg
virsh undefine $tmpname ||:
}
trap cleanup INT QUIT TERM EXIT ERR
virt-install \
--name=$tmpname \
--ram=1024 \
--os-type=linux --os-variant=$osvariant \
--arch ppc64le --machine pseries \
--initrd-inject=$(pwd)/preseed.cfg \
--extra-args="auto console=tty0 console=hvc0" \
--disk=$(pwd)/$output,size=4,format=raw \
--serial pty \
--location=$location \
--nographics \
--noreboot
source $(dirname "$0")/compress.sh $output

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ version=$1
dist=$2
osvariant=$3
if [ -z "$osvariant" ]; then osvariant=ubuntu$dist; fi
location=http://archive.ubuntu.net/ubuntu/dists/$dist/main/installer-amd64
location=http://archive.ubuntu.com/ubuntu/dists/$dist/main/installer-amd64
output=ubuntu-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
@@ -72,4 +72,9 @@ virt-install \
--nographics \
--noreboot
# In Ubuntu >= 14.04 you can't complete the install without creating
# a user account. We create one called 'builder', but we also
# disable it.
virt-customize -a $output --password builder:disabled
source $(dirname "$0")/compress.sh $output

View File

@@ -23,18 +23,20 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#if HAVE_YAJL
#include <yajl/yajl_tree.h>
#endif
#include <stdio.h>
#include <string.h>
/* GCC can't work out that the YAJL_IS_<foo> test is sufficient to
* ensure that YAJL_GET_<foo> later doesn't return NULL.
*/
#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 6 */
#pragma GCC diagnostic ignored "-Wnull-dereference"
#endif
#define Val_none (Val_int (0))
value virt_builder_yajl_is_available (value unit);
#if HAVE_YAJL
value virt_builder_yajl_tree_parse (value stringv);
static value
@@ -47,7 +49,7 @@ convert_yajl_value (yajl_val val, int level)
caml_invalid_argument ("too many levels of object/array nesting");
if (YAJL_IS_OBJECT (val)) {
size_t len = YAJL_GET_OBJECT(val)->len;
const size_t len = YAJL_GET_OBJECT(val)->len;
size_t i;
rv = caml_alloc (1, 3);
lv = caml_alloc_tuple (len);
@@ -61,7 +63,7 @@ convert_yajl_value (yajl_val val, int level)
}
Store_field (rv, 0, lv);
} else if (YAJL_IS_ARRAY (val)) {
size_t len = YAJL_GET_ARRAY(val)->len;
const size_t len = YAJL_GET_ARRAY(val)->len;
size_t i;
rv = caml_alloc (1, 4);
lv = caml_alloc_tuple (len);
@@ -94,13 +96,6 @@ convert_yajl_value (yajl_val val, int level)
CAMLreturn (rv);
}
value
virt_builder_yajl_is_available (value unit)
{
/* NB: noalloc */
return Val_true;
}
value
virt_builder_yajl_tree_parse (value stringv)
{
@@ -124,21 +119,3 @@ virt_builder_yajl_tree_parse (value stringv)
CAMLreturn (rv);
}
#else
value virt_builder_yajl_tree_parse (value stringv) __attribute__((noreturn));
value
virt_builder_yajl_is_available (value unit)
{
/* NB: noalloc */
return Val_false;
}
value
virt_builder_yajl_tree_parse (value stringv)
{
caml_invalid_argument ("virt-builder was compiled without yajl support");
}
#endif

View File

@@ -25,6 +25,4 @@ type yajl_val =
| Yajl_array of yajl_val array
| Yajl_bool of bool
external yajl_is_available : unit -> bool = "virt_builder_yajl_is_available" "noalloc"
external yajl_tree_parse : string -> yajl_val = "virt_builder_yajl_tree_parse"

View File

@@ -25,9 +25,5 @@ type yajl_val =
| Yajl_array of yajl_val array
| Yajl_bool of bool
val yajl_is_available : unit -> bool
(** Is YAJL built in? If not, calling any of the other yajl_*
functions will result in an error. *)
val yajl_tree_parse : string -> yajl_val
(** Parse the JSON string. *)

View File

@@ -134,6 +134,4 @@ let suite =
]
let () =
if not (yajl_is_available ()) then
exit 77;
run_test_tt_main suite

View File

@@ -18,6 +18,7 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
test-docs.sh \
test-virt-cat.sh \
virt-cat.pod \
test-virt-filesystems.sh \
@@ -160,6 +161,7 @@ stamp-virt-cat.pod: virt-cat.pod
--man virt-cat.1 \
--html $(top_builddir)/website/virt-cat.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -170,6 +172,7 @@ stamp-virt-filesystems.pod: virt-filesystems.pod
--man virt-filesystems.1 \
--html $(top_builddir)/website/virt-filesystems.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -180,6 +183,7 @@ stamp-virt-log.pod: virt-log.pod
--man virt-log.1 \
--html $(top_builddir)/website/virt-log.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -190,6 +194,7 @@ stamp-virt-ls.pod: virt-ls.pod
--man virt-ls.1 \
--html $(top_builddir)/website/virt-ls.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -197,8 +202,11 @@ stamp-virt-ls.pod: virt-ls.pod
TESTS_ENVIRONMENT = $(top_builddir)/run --test
if ENABLE_APPLIANCE
TESTS = \
test-docs.sh
if ENABLE_APPLIANCE
TESTS += \
test-virt-cat.sh \
test-virt-filesystems.sh \
test-virt-log.sh \
@@ -210,5 +218,5 @@ check-valgrind:
check-valgrind-local-guests:
for g in $(GUESTS); do \
$(top_builddir)/run --test @VG@ ./virt-filesystems -c "$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit $$?; \
$(top_builddir)/run --test @VG@ virt-filesystems -c "$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit $$?; \
done

View File

@@ -25,6 +25,7 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
@@ -87,7 +88,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:m:vVx";
static const char options[] = "a:c:d:m:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
@@ -115,10 +116,8 @@ main (int argc, char *argv[])
int option_index;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -136,12 +135,10 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name,
long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
@@ -190,24 +187,18 @@ main (int argc, char *argv[])
if (strchr (argv[optind], '/') ||
access (argv[optind], F_OK) == 0) { /* simulate -a option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("calloc");
exit (EXIT_FAILURE);
}
if (!drv)
error (EXIT_FAILURE, errno, "calloc");
drv->type = drv_a;
drv->a.filename = strdup (argv[optind]);
if (!drv->a.filename) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (!drv->a.filename)
error (EXIT_FAILURE, errno, "strdup");
drv->next = drvs;
drvs = drv;
} else { /* simulate -d option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("calloc");
exit (EXIT_FAILURE);
}
if (!drv)
error (EXIT_FAILURE, errno, "calloc");
drv->type = drv_d;
drv->d.guest = argv[optind];
drv->next = drvs;
@@ -233,8 +224,11 @@ main (int argc, char *argv[])
CHECK_OPTION_format_consumed;
/* User must have specified some drives. */
if (drvs == NULL)
if (drvs == NULL) {
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
guestfs_int_program_name);
usage (EXIT_FAILURE);
}
/* Add drives, inspect and mount. */
add_drives (drvs, 'a');

View File

@@ -25,6 +25,7 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <string.h>
@@ -136,7 +137,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:hlvVx";
static const char options[] = "a:c:d:hlvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "all", 0, 0, 0 },
@@ -184,10 +185,8 @@ main (int argc, char *argv[])
int title;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -237,12 +236,10 @@ main (int argc, char *argv[])
STREQ (long_options[option_index].name, "volgroups") ||
STREQ (long_options[option_index].name, "volume-groups")) {
output |= OUTPUT_VGS;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name,
long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
@@ -294,19 +291,22 @@ main (int argc, char *argv[])
assert (live == 0);
/* Must be no extra arguments on the command line. */
if (optind != argc)
if (optind != argc) {
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
"Make sure to specify the argument for --format "
"like '--format=%s'.\n"),
guestfs_int_program_name, argv[optind], argv[optind]);
usage (EXIT_FAILURE);
}
CHECK_OPTION_format_consumed;
/* -h and --csv doesn't make sense. Spreadsheets will corrupt these
* fields. (RHBZ#600977).
*/
if (human && csv) {
fprintf (stderr, _("%s: you cannot use -h and --csv options together.\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
if (human && csv)
error (EXIT_FAILURE, 0,
_("you cannot use -h and --csv options together."));
/* Nothing selected for output, means --filesystems is implied. */
if (output == 0)
@@ -334,8 +334,11 @@ main (int argc, char *argv[])
title = 0;
/* User must have specified some drives. */
if (drvs == NULL)
if (drvs == NULL) {
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
guestfs_int_program_name);
usage (EXIT_FAILURE);
}
/* Add drives. */
add_drives (drvs, 'a');
@@ -458,10 +461,8 @@ do_output_filesystems (void)
guestfs_pop_error_handler (g);
if (vfs_label == NULL) {
vfs_label = strdup ("");
if (!vfs_label) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (!vfs_label)
error (EXIT_FAILURE, errno, "strdup");
}
}
if ((columns & COLUMN_UUID)) {
@@ -470,16 +471,33 @@ do_output_filesystems (void)
guestfs_pop_error_handler (g);
if (vfs_uuid == NULL) {
vfs_uuid = strdup ("");
if (!vfs_uuid) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (!vfs_uuid)
error (EXIT_FAILURE, errno, "strdup");
}
}
if ((columns & COLUMN_SIZE)) {
size = guestfs_blockdev_getsize64 (g, fses[i]);
if (size == -1)
CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
CLEANUP_FREE char *subvolume = NULL;
guestfs_push_error_handler (g, NULL, NULL);
subvolume = guestfs_mountable_subvolume (g, fses[i]);
if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
fprintf (stderr,
_("%s: cannot determine the subvolume for %s: %s: %s\n"),
guestfs_int_program_name, fses[i],
guestfs_last_error (g),
strerror (guestfs_last_errno (g)));
exit (EXIT_FAILURE);
}
guestfs_pop_error_handler (g);
if (!device || !subvolume) {
size = guestfs_blockdev_getsize64 (g, fses[i]);
if (size == -1)
exit (EXIT_FAILURE);
}
}
if (is_md (fses[i]))
@@ -518,10 +536,8 @@ do_output_lvs (void)
}
if ((columns & COLUMN_PARENTS)) {
parent_name = strdup (lvs[i]);
if (parent_name == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (parent_name == NULL)
error (EXIT_FAILURE, errno, "strdup");
char *p = strrchr (parent_name, '/');
if (p)
*p = '\0';
@@ -549,10 +565,8 @@ do_output_vgs (void)
char uuid[33];
CLEANUP_FREE_STRING_LIST char **parents = NULL;
if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) {
perror ("asprintf");
exit (EXIT_FAILURE);
}
if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1)
error (EXIT_FAILURE, errno, "asprintf");
memcpy (uuid, vgs->val[i].vg_uuid, 32);
uuid[32] = '\0';
@@ -719,10 +733,8 @@ no_parents (void)
char **ret;
ret = malloc (sizeof (char *));
if (!ret) {
perror ("malloc");
exit (EXIT_FAILURE);
}
if (!ret)
error (EXIT_FAILURE, errno, "malloc");
ret[0] = NULL;
@@ -760,10 +772,8 @@ parents_of_md (char *device)
exit (EXIT_FAILURE);
ret = malloc ((stats->len + 1) * sizeof (char *));
if (!ret) {
perror ("malloc");
exit (EXIT_FAILURE);
}
if (!ret)
error (EXIT_FAILURE, errno, "malloc");
for (i = 0; i < stats->len; ++i) {
ret[i] = guestfs_canonical_device_name (g, stats->val[i].mdstat_device);
@@ -814,10 +824,8 @@ parents_of_vg (char *vg)
n = guestfs_int_count_strings (pvuuids);
ret = malloc ((n + 1) * sizeof (char *));
if (!ret) {
perror ("malloc");
exit (EXIT_FAILURE);
}
if (!ret)
error (EXIT_FAILURE, errno, "malloc");
/* Resolve each PV UUID back to a PV. */
for (i = 0; i < n; ++i) {
@@ -834,10 +842,8 @@ parents_of_vg (char *vg)
else {
fprintf (stderr, "%s: warning: unknown PV UUID ignored\n", __func__);
ret[i] = strndup (pvuuids[i], 32);
if (!ret[i]) {
perror ("strndup");
exit (EXIT_FAILURE);
}
if (!ret[i])
error (EXIT_FAILURE, errno, "strndup");
}
}
@@ -978,18 +984,14 @@ add_row (char **strings, size_t len)
assert (len <= NR_COLUMNS);
row = malloc (sizeof (char *) * len);
if (row == NULL) {
perror ("malloc");
exit (EXIT_FAILURE);
}
if (row == NULL)
error (EXIT_FAILURE, errno, "malloc");
for (i = 0; i < len; ++i) {
if (strings[i]) {
row[i] = strdup (strings[i]);
if (row[i] == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (row[i] == NULL)
error (EXIT_FAILURE, errno, "strdup");
/* Keep a running total of the max width of each column. */
slen = strlen (strings[i]);
@@ -1003,10 +1005,8 @@ add_row (char **strings, size_t len)
}
rows = realloc (rows, sizeof (char **) * (nr_rows + 1));
if (rows == NULL) {
perror ("realloc");
exit (EXIT_FAILURE);
}
if (rows == NULL)
error (EXIT_FAILURE, errno, "realloc");
rows[nr_rows] = row;
nr_rows++;
}

View File

@@ -26,6 +26,7 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
@@ -94,7 +95,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:vVx";
static const char options[] = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
@@ -117,10 +118,8 @@ main (int argc, char *argv[])
int option_index;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -138,12 +137,10 @@ main (int argc, char *argv[])
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
OPTION_format;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name,
long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
@@ -187,14 +184,22 @@ main (int argc, char *argv[])
assert (live == 0);
/* User must not specify more arguments on the command line. */
if (optind != argc)
if (optind != argc) {
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
"Make sure to specify the argument for --format "
"like '--format=%s'.\n"),
guestfs_int_program_name, argv[optind], argv[optind]);
usage (EXIT_FAILURE);
}
CHECK_OPTION_format_consumed;
/* User must have specified some drives. */
if (drvs == NULL)
if (drvs == NULL) {
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
guestfs_int_program_name);
usage (EXIT_FAILURE);
}
/* Add drives, inspect and mount. Note that inspector is always true,
* and there is no -m option.

158
cat/ls.c
View File

@@ -26,6 +26,7 @@
#include <getopt.h>
#include <fcntl.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <time.h>
@@ -131,7 +132,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:c:d:hlm:RvVx";
static const char options[] = "a:c:d:hlm:RvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "checksum", 2, 0, 0 },
@@ -177,10 +178,8 @@ main (int argc, char *argv[])
int mode = 0;
g = guestfs_create ();
if (g == NULL) {
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
exit (EXIT_FAILURE);
}
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -226,11 +225,10 @@ main (int argc, char *argv[])
} else if (STREQ (long_options[option_index].name, "uid") ||
STREQ (long_options[option_index].name, "uids")) {
enable_uids = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
guestfs_int_program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
@@ -291,24 +289,18 @@ main (int argc, char *argv[])
if (strchr (argv[optind], '/') ||
access (argv[optind], F_OK) == 0) { /* simulate -a option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("calloc");
exit (EXIT_FAILURE);
}
if (!drv)
error (EXIT_FAILURE, errno, "calloc");
drv->type = drv_a;
drv->a.filename = strdup (argv[optind]);
if (!drv->a.filename) {
perror ("strdup");
exit (EXIT_FAILURE);
}
if (!drv->a.filename)
error (EXIT_FAILURE, errno, "strdup");
drv->next = drvs;
drvs = drv;
} else { /* simulate -d option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
perror ("calloc");
exit (EXIT_FAILURE);
}
if (!drv)
error (EXIT_FAILURE, errno, "calloc");
drv->type = drv_d;
drv->d.guest = argv[optind];
drv->next = drvs;
@@ -332,28 +324,27 @@ main (int argc, char *argv[])
/* Many flags only apply to -lR mode. */
if (mode != MODE_LS_LR &&
(csv || human || enable_uids || enable_times || enable_extra_stats ||
checksum)) {
fprintf (stderr, _("%s: used a flag which can only be combined with -lR mode\nFor more information, read the virt-ls(1) man page.\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
checksum))
error (EXIT_FAILURE, 0,
_("used a flag which can only be combined with -lR mode\nFor more information, read the virt-ls(1) man page."));
/* CSV && human is unsafe because spreadsheets fail to parse these
* fields correctly. (RHBZ#600977).
*/
if (human && csv) {
fprintf (stderr, _("%s: you cannot use -h and --csv options together.\n"),
guestfs_int_program_name);
exit (EXIT_FAILURE);
}
if (human && csv)
error (EXIT_FAILURE, 0,
_("you cannot use -h and --csv options together."));
/* User must specify at least one directory name on the command line. */
if (optind >= argc || argc - optind < 1)
usage (EXIT_FAILURE);
/* User must have specified some drives. */
if (drvs == NULL)
if (drvs == NULL) {
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
guestfs_int_program_name);
usage (EXIT_FAILURE);
}
/* Add drives, inspect and mount. */
add_drives (drvs, 'a');
@@ -559,15 +550,13 @@ static int field;
static void
next_field (void)
{
int c = csv ? ',' : ' ';
const int c = csv ? ',' : ' ';
field++;
if (field == 1) return;
if (putchar (c) == EOF) {
perror ("putchar");
exit (EXIT_FAILURE);
}
if (putchar (c) == EOF)
error (EXIT_FAILURE, errno, "putchar");
}
static void
@@ -579,10 +568,8 @@ output_start_line (void)
static void
output_end_line (void)
{
if (printf ("\n") < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("\n") < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
@@ -592,10 +579,8 @@ output_string (const char *s)
if (!csv) {
print_no_quoting:
if (printf ("%s", s) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("%s", s) < 0)
error (EXIT_FAILURE, errno, "printf");
}
else {
/* Quote CSV string without requiring an external module. */
@@ -616,27 +601,19 @@ output_string (const char *s)
goto print_no_quoting;
/* Quoting for CSV fields. */
if (putchar ('"') == EOF) {
perror ("putchar");
exit (EXIT_FAILURE);
}
if (putchar ('"') == EOF)
error (EXIT_FAILURE, errno, "putchar");
for (i = 0; i < len; ++i) {
if (s[i] == '"') {
if (putchar ('"') == EOF || putchar ('"') == EOF) {
perror ("putchar");
exit (EXIT_FAILURE);
}
if (putchar ('"') == EOF || putchar ('"') == EOF)
error (EXIT_FAILURE, errno, "putchar");
} else {
if (putchar (s[i]) == EOF) {
perror ("putchar");
exit (EXIT_FAILURE);
}
if (putchar (s[i]) == EOF)
error (EXIT_FAILURE, errno, "putchar");
}
}
if (putchar ('"') == EOF) {
perror ("putchar");
exit (EXIT_FAILURE);
}
if (putchar ('"') == EOF)
error (EXIT_FAILURE, errno, "putchar");
}
}
@@ -648,10 +625,8 @@ output_string_link (const char *link)
else {
next_field ();
if (printf ("-> %s", link) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("-> %s", link) < 0)
error (EXIT_FAILURE, errno, "printf");
}
}
@@ -660,17 +635,16 @@ output_int64 (int64_t i)
{
next_field ();
/* csv doesn't need escaping */
if (printf ("%" PRIi64, i) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("%" PRIi64, i) < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
output_int64_size (int64_t size)
{
char buf[LONGEST_HUMAN_READABLE];
int hopts = human_round_to_nearest|human_autoscale|human_base_1024|human_SI;
const int hopts =
human_round_to_nearest|human_autoscale|human_base_1024|human_SI;
int r;
next_field ();
@@ -690,10 +664,8 @@ output_int64_size (int64_t size)
human_readable ((uintmax_t) size, buf, hopts, 1, 1));
}
if (r < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (r < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
@@ -701,10 +673,8 @@ output_int64_perms (int64_t i)
{
next_field ();
/* csv doesn't need escaping */
if (printf ("%04" PRIo64, (uint64_t) i) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("%04" PRIo64, (uint64_t) i) < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
@@ -735,23 +705,17 @@ output_int64_time (int64_t secs, int64_t nsecs)
struct tm *tm;
tm = localtime (&t);
if (tm == NULL) {
perror ("localtime");
exit (EXIT_FAILURE);
}
if (tm == NULL)
error (EXIT_FAILURE, errno, "localtime");
if (strftime (buf, sizeof buf, "%F %T", tm) == 0) {
perror ("strftime");
exit (EXIT_FAILURE);
}
if (strftime (buf, sizeof buf, "%F %T", tm) == 0)
error (EXIT_FAILURE, errno, "strftime");
r = printf ("%s", buf);
}
if (r < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (r < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
@@ -759,10 +723,8 @@ output_int64_uid (int64_t i)
{
next_field ();
/* csv doesn't need escaping */
if (printf ("%4" PRIi64, i) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
if (printf ("%4" PRIi64, i) < 0)
error (EXIT_FAILURE, errno, "printf");
}
static void
@@ -774,8 +736,6 @@ output_int64_dev (int64_t i)
/* csv doesn't need escaping */
if (printf ("%ju:%ju",
(uintmax_t) major (dev), (uintmax_t) minor (dev)) < 0) {
perror ("printf");
exit (EXIT_FAILURE);
}
(uintmax_t) major (dev), (uintmax_t) minor (dev)) < 0)
error (EXIT_FAILURE, errno, "printf");
}

26
cat/test-docs.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
$srcdir/../podcheck.pl virt-cat.pod virt-cat
$srcdir/../podcheck.pl virt-filesystems.pod virt-filesystems
$srcdir/../podcheck.pl virt-log.pod virt-log
$srcdir/../podcheck.pl virt-ls.pod virt-ls \
--ignore=--checksums,--extra-stat,--time,--uid

View File

@@ -20,11 +20,11 @@ export LANG=C
set -e
# Read out the test files from the image using virt-cat.
if [ "$($VG virt-cat ../test-data/phony-guests/fedora.img /etc/test1)" != "abcdefg" ]; then
if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test1)" != "abcdefg" ]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
if [ "$($VG virt-cat ../test-data/phony-guests/fedora.img /etc/test2)" != "" ]; then
if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test2)" != "" ]; then
echo "$0: error: mismatch in file test2"
exit 1
fi

View File

@@ -19,7 +19,7 @@
export LANG=C
set -e
output="$($VG virt-filesystems -a ../test-data/phony-guests/fedora.img | sort)"
output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img | sort)"
expected="/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
@@ -32,7 +32,7 @@ if [ "$output" != "$expected" ]; then
exit 1
fi
output="$($VG virt-filesystems -a ../test-data/phony-guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
expected="/dev/VG
/dev/VG/LV1
/dev/VG/LV2

View File

@@ -47,7 +47,7 @@ for f in ../test-data/phony-guests/{fedora,debian,ubuntu}.img; do
echo
continue
fi
$VG virt-log -a "$f" &> $tmpfile
$VG virt-log --format=raw -a "$f" &> $tmpfile
cat $tmpfile
echo
done

View File

@@ -20,7 +20,7 @@ export LANG=C
set -e
# Read out the test directory using virt-ls.
if [ "$($VG virt-ls ../test-data/phony-guests/fedora.img /bin)" != "ls
if [ "$($VG virt-ls --format=raw -a ../test-data/phony-guests/fedora.img /bin)" != "ls
test1
test2
test3
@@ -33,7 +33,7 @@ test7" ]; then
fi
# Try the -lR option.
output="$($VG virt-ls -lR ../test-data/phony-guests/fedora.img /boot | awk '{print $1 $2 $4}')"
output="$($VG virt-ls -lR --format=raw -a ../test-data/phony-guests/fedora.img /boot | awk '{print $1 $2 $4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf

View File

@@ -126,9 +126,9 @@ security problem with malicious guests (CVE-2010-3851).
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening F</dev/tty>.
=item B<-m dev[:mountpoint[:options[:fstype]]]>
=item B<-m> dev[:mountpoint[:options[:fstype]]]
=item B<--mount dev[:mountpoint[:options[:fstype]]]>
=item B<--mount> dev[:mountpoint[:options[:fstype]]]
Mount the named partition or logical volume on the given mountpoint.

View File

@@ -370,7 +370,7 @@ work reliably. This example has one row:
"foo
bar",baz
For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
For shell scripts, use C<csvtool> (L<https://github.com/Chris00/ocaml-csv>
also packaged in major Linux distributions).
For other languages, use a CSV processing library (eg. C<Text::CSV>

View File

@@ -357,9 +357,9 @@ L</RECURSIVE LONG LISTING> above.
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening F</dev/tty>.
=item B<-m dev[:mountpoint[:options[:fstype]]]>
=item B<-m> dev[:mountpoint[:options[:fstype]]]
=item B<--mount dev[:mountpoint[:options[:fstype]]]>
=item B<--mount> dev[:mountpoint[:options[:fstype]]]
Mount the named partition or logical volume on the given mountpoint.
@@ -502,7 +502,7 @@ work reliably. This example has one row:
"foo
bar",baz
For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
For shell scripts, use C<csvtool> (L<https://github.com/Chris00/ocaml-csv>
also packaged in major Linux distributions).
For other languages, use a CSV processing library (eg. C<Text::CSV>

View File

@@ -16,9 +16,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Adapted from
https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/
*/
/**
* This file contains a recursive function for visiting all files and
* directories in a guestfs filesystem.
*
* Adapted from
* L<https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/>
*/
#include <config.h>
@@ -36,6 +40,29 @@ https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files
static int _visit (guestfs_h *g, int depth, const char *dir, visitor_function f, void *opaque);
/**
* Visit every file and directory in a guestfs filesystem, starting
* at C<dir>.
*
* C<dir> may be C<"/"> to visit the entire filesystem, or may be some
* subdirectory. Symbolic links are not followed.
*
* The visitor function C<f> is called once for every directory and
* every file. The parameters passed to C<f> include the current
* directory name, the current file name (or C<NULL> when we're
* visiting a directory), the C<guestfs_statns> (file permissions
* etc), and the list of extended attributes of the file. The visitor
* function may return C<-1> which causes the whole recursion to stop
* with an error.
*
* Also passed to this function is an C<opaque> pointer which is
* passed through to the visitor function.
*
* Returns C<0> if everything went OK, or C<-1> if there was an error.
* Error handling is not particularly well defined. It will either
* set an error in the libguestfs handle or print an error on stderr,
* but there is no way for the caller to tell the difference.
*/
int
visit (guestfs_h *g, const char *dir, visitor_function f, void *opaque)
{
@@ -89,6 +116,7 @@ _visit (guestfs_h *g, int depth, const char *dir,
/* Call function on everything in this directory. */
for (i = 0, xattrp = 0; names[i] != NULL; ++i, ++xattrp) {
CLEANUP_FREE char *path = NULL;
CLEANUP_FREE char *attrval = NULL;
struct guestfs_xattr_list file_xattrs;
size_t nr_xattrs;
@@ -104,7 +132,11 @@ _visit (guestfs_h *g, int depth, const char *dir,
return -1;
}
/* attrval is not \0-terminated. */
char attrval[xattrs->val[xattrp].attrval_len+1];
attrval = malloc (xattrs->val[xattrp].attrval_len + 1);
if (attrval == NULL) {
perror ("malloc");
return -1;
}
memcpy (attrval, xattrs->val[xattrp].attrval,
xattrs->val[xattrp].attrval_len);
attrval[xattrs->val[xattrp].attrval_len] = '\0';

View File

@@ -19,14 +19,14 @@
# add extra information using --with-extra="..." which may be any
# freeform string.
m4_define([libguestfs_major], [1])
m4_define([libguestfs_minor], [32])
m4_define([libguestfs_release], [0])
m4_define([libguestfs_minor], [33])
m4_define([libguestfs_release], [46])
AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
dnl The date that the above version was released. This is used in
dnl the website 'index.html' file.
AC_SUBST([RELEASE_DATE], [2016-01-06])
AC_SUBST([RELEASE_DATE], [2016-07-27])
AC_CONFIG_AUX_DIR([build-aux])
AC_REQUIRE_AUX_FILE([guestfs-test-driver])
@@ -124,10 +124,8 @@ m4_include([m4/guestfs_gobject.m4])
dnl Bash completion.
m4_include([m4/guestfs_bash_completion.m4])
dnl Replace libtool with a wrapper that clobbers dependency_libs in *.la files
dnl http://lists.fedoraproject.org/pipermail/devel/2010-November/146343.html
LIBTOOL='bash $(top_srcdir)/libtool-kill-dependency_libs.sh $(top_builddir)/libtool'
AC_SUBST([LIBTOOL])
dnl Miscellaneous configuration that doesn't fit anywhere else.
m4_include([m4/guestfs_misc.m4])
dnl Work around autoconf's lack of expanded variables.
eval my_sysconfdir="\"[$]sysconfdir\""
@@ -159,6 +157,8 @@ AC_CONFIG_FILES([p2v/virt-p2v-make-disk],
[chmod +x,-w p2v/virt-p2v-make-disk])
AC_CONFIG_FILES([p2v/virt-p2v-make-kickstart],
[chmod +x,-w p2v/virt-p2v-make-kickstart])
AC_CONFIG_FILES([p2v/virt-p2v-make-kiwi],
[chmod +x,-w p2v/virt-p2v-make-kiwi])
AC_CONFIG_FILES([php/extension/php-for-tests.sh],
[chmod +x,-w php/extension/php-for-tests.sh])
AC_CONFIG_FILES([pick-guests.pl],
@@ -260,6 +260,7 @@ AC_CONFIG_FILES([Makefile
tests/disks/test-qemu-drive-libvirt.xml
tests/disk-labels/Makefile
tests/events/Makefile
tests/gdisk/Makefile
tests/hotplug/Makefile
tests/http/Makefile
tests/journal/Makefile
@@ -270,19 +271,25 @@ AC_CONFIG_FILES([Makefile
tests/mountable/Makefile
tests/nbd/Makefile
tests/network/Makefile
tests/ntfsclone/Makefile
tests/ntfs/Makefile
tests/parallel/Makefile
tests/protocol/Makefile
tests/qemu/Makefile
tests/regressions/Makefile
tests/relabel/Makefile
tests/relative-paths/Makefile
tests/rsync/Makefile
tests/selinux/Makefile
tests/syslinux/Makefile
tests/tmpdirs/Makefile
tests/tsk/Makefile
tests/xfs/Makefile
tests/xml/Makefile
tools/Makefile
utils/boot-analysis/Makefile
utils/boot-benchmark/Makefile
utils/qemu-boot/Makefile
utils/qemu-speed-test/Makefile
v2v/Makefile
v2v/test-harness/Makefile
v2v/test-harness/META

View File

@@ -20,11 +20,13 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
$(generator_built) \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
customize_main.ml \
test-virt-customize.sh \
test-virt-customize-docs.sh \
virt-customize.pod
CLEANFILES = \
*~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o \
*~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o dll*.so \
stamp-virt-customize.pod \
virt-customize virt-customize.1
@@ -43,6 +45,7 @@ SOURCES_MLI = \
password.mli \
perl_edit.mli \
random_seed.mli \
SELinux_relabel.mli \
ssh_key.mli \
subscription_manager.mli \
timezone.mli \
@@ -58,47 +61,59 @@ SOURCES_ML = \
password.ml \
perl_edit.ml \
random_seed.ml \
SELinux_relabel.ml \
ssh_key.ml \
subscription_manager.ml \
timezone.ml \
customize_cmdline.ml \
customize_run.ml \
customize_main.ml
customize_run.ml
SOURCES_C = \
../fish/uri.c \
../fish/file-edit.c \
../fish/file-edit.h \
../mllib/uri-c.c \
crypt-c.c \
perl_edit-c.c
if HAVE_OCAML
bin_PROGRAMS = virt-customize
# Build the virt-customize objects into a library, since these are
# reused by virt-builder and virt-sysprep. We pretend we are building
# a C library. automake handles the compilation of C sources for us.
# At the end we take the C objects and OCaml objects and link them
# into the OCaml library. This C library is never used.
noinst_LIBRARIES = libcustomize.a
virt_customize_SOURCES = $(SOURCES_C)
virt_customize_CPPFLAGS = \
if !HAVE_OCAMLOPT
CUSTOMIZE_CMA = customize.cma
else
CUSTOMIZE_CMA = customize.cmxa
endif
noinst_DATA = $(CUSTOMIZE_CMA)
libcustomize_a_SOURCES = $(SOURCES_C)
libcustomize_a_CPPFLAGS = \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish
virt_customize_CFLAGS = \
libcustomize_a_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBVIRT_CFLAGS) \
$(LIBXML2_CFLAGS)
$(LIBXML2_CFLAGS) \
-fPIC
BOBJECTS = \
$(top_builddir)/mllib/guestfs_config.cmo \
$(top_builddir)/mllib/common_gettext.cmo \
$(top_builddir)/mllib/common_utils.cmo \
$(top_builddir)/mllib/regedit.cmo \
$(top_builddir)/mllib/uRI.cmo \
$(SOURCES_ML:.ml=.cmo)
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
else
OBJECTS = $(XOBJECTS)
endif
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
# option to be passed to gcc, so we don't try linking against an
# installed copy of libguestfs.
@@ -107,11 +122,34 @@ OCAMLPACKAGES = \
-I $(top_builddir)/src/.libs \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib
-I $(top_builddir)/mllib \
-I $(builddir)
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
libcustomize_a_DEPENDENCIES = $(OBJECTS)
$(CUSTOMIZE_CMA): $(OBJECTS) libcustomize.a
$(OCAMLFIND) mklib $(OCAMLPACKAGES) \
$(OBJECTS) $(libcustomize_a_OBJECTS) -o customize
# Build the virt-customize program.
bin_PROGRAMS = virt-customize
virt_customize_SOURCES = dummy.c
CUSTOMIZE_BOBJECTS = customize_main.cmo
CUSTOMIZE_XOBJECTS = $(CUSTOMIZE_BOBJECTS:.cmo=.cmx)
if !HAVE_OCAMLOPT
CUSTOMIZE_THEOBJECTS = $(CUSTOMIZE_BOBJECTS)
else
CUSTOMIZE_THEOBJECTS = $(CUSTOMIZE_XOBJECTS)
endif
OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) customize.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY)
OCAMLCLIBS = \
-lutils \
$(LIBTINFO_LIBS) \
@@ -123,34 +161,19 @@ OCAMLCLIBS = \
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
OCAMLLINKFLAGS = mlguestfs.cma -custom
else
OBJECTS = $(XOBJECTS)
BEST = opt
OCAMLLINKFLAGS = mlguestfs.cmxa
endif
virt_customize_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
virt_customize_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh \
$(CUSTOMIZE_THEOBJECTS) \
$(CUSTOMIZE_CMA) \
../mllib/mllib.$(MLARCHIVE)
virt_customize_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(OBJECTS) -o $@
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
if HAVE_OCAMLOPT
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
endif
$(CUSTOMIZE_THEOBJECTS) -o $@
# Manual pages and HTML files for the website.
man_MANS = virt-customize.1
noinst_DATA = $(top_builddir)/website/virt-customize.1.html
noinst_DATA += $(top_builddir)/website/virt-customize.1.html
virt-customize.1 $(top_builddir)/website/virt-customize.1.html: stamp-virt-customize.pod
@@ -161,6 +184,7 @@ stamp-virt-customize.pod: virt-customize.pod $(top_srcdir)/customize/customize-s
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning general \
$<
touch $@
@@ -168,8 +192,12 @@ stamp-virt-customize.pod: virt-customize.pod $(top_srcdir)/customize/customize-s
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = \
test-virt-customize-docs.sh
if ENABLE_APPLIANCE
TESTS = test-virt-customize.sh
TESTS += \
test-virt-customize.sh
endif
check-valgrind:

View File

@@ -0,0 +1,57 @@
(* virt-customize
* Copyright (C) 2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
open Common_utils
open Printf
module G = Guestfs
let relabel (g : G.guestfs) =
(* Is the guest using SELinux? *)
if g#is_file ~followsymlinks:true "/usr/sbin/load_policy" &&
g#is_file ~followsymlinks:true "/etc/selinux/config" then (
(* Is setfiles / SELinux relabelling functionality available? *)
if g#feature_available [| "selinuxrelabel" |] then (
(* Use Augeas to parse /etc/selinux/config. *)
g#aug_init "/" (16+32) (* AUG_SAVE_NOOP | AUG_NO_LOAD *);
(* See: https://bugzilla.redhat.com/show_bug.cgi?id=975412#c0 *)
ignore (g#aug_rm "/augeas/load/*[\"/etc/selinux/config/\" !~ regexp('^') + glob(incl) + regexp('/.*')]");
g#aug_load ();
debug_augeas_errors g;
(* Get the SELinux policy name, eg. "targeted", "minimum". *)
let policy = g#aug_get "/files/etc/selinux/config/SELINUXTYPE" in
g#aug_close ();
(* Get the spec file name. *)
let specfile =
sprintf "/etc/selinux/%s/contexts/files/file_contexts" policy in
(* Relabel everything. *)
g#selinux_relabel ~force:true specfile "/";
(* If that worked, we don't need to autorelabel. *)
g#rm_f "/.autorelabel"
)
else (
(* SELinux guest, but not SELinux host. Fallback to this. *)
g#touch "/.autorelabel"
)
)

View File

@@ -0,0 +1,29 @@
(* virt-customize
* Copyright (C) 2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** SELinux-relabel the filesystem. *)
val relabel : Guestfs.guestfs -> unit
(** Relabel the mounted guestfs filesystem using the current SELinux
policy that applies to the guest.
If the guest does not look like it uses SELinux, this does nothing.
In case relabelling is not possible (since it is an optional
feature which requires the setfiles(8) program), instead we
fall back to touching [/.autorelabel]. *)

View File

@@ -29,7 +29,7 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
virt_sysprep_crypt (value keyv, value saltv)
virt_customize_crypt (value keyv, value saltv)
{
CAMLparam2 (keyv, saltv);
CAMLlocal1 (rv);

View File

@@ -16,4 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
external crypt : string -> string -> string = "virt_sysprep_crypt"
external crypt : string -> string -> string = "virt_customize_crypt"

View File

@@ -18,6 +18,7 @@
open Common_gettext.Gettext
open Common_utils
open Getopt.OptionName
open Customize_utils
open Customize_cmdline
@@ -38,7 +39,7 @@ let main () =
| "auto" -> attach_format := None
| s -> attach_format := Some s
in
let attach_disk s = attach := (!attach_format, s) :: !attach in
let attach_disk s = push_front (!attach_format, s) attach in
let domain = ref None in
let dryrun = ref false in
let files = ref [] in
@@ -62,7 +63,7 @@ let main () =
error (f_"error parsing URI '%s'. Look for error messages printed above.")
arg in
let format = match !format with "auto" -> None | fmt -> Some fmt in
files := (uri, format) :: !files;
push_front (uri, format) files;
format_consumed := true
and set_domain dom =
if !domain <> None then
@@ -71,33 +72,24 @@ let main () =
in
let argspec = [
"-a", Arg.String add_file, s_"file" ^ " " ^ s_"Add disk image file";
"--add", Arg.String add_file, s_"file" ^ " " ^ s_"Add disk image file";
"--attach", Arg.String attach_disk, "iso" ^ " " ^ s_"Attach data disk/ISO during install";
"--attach-format", Arg.String set_attach_format,
"format" ^ " " ^ s_"Set attach disk format";
"-c", Arg.Set_string libvirturi, s_"uri" ^ " " ^ s_"Set libvirt URI";
"--connect", Arg.Set_string libvirturi, s_"uri" ^ " " ^ s_"Set libvirt URI";
"-d", Arg.String set_domain, s_"domain" ^ " " ^ s_"Set libvirt guest name";
"--domain", Arg.String set_domain, s_"domain" ^ " " ^ s_"Set libvirt guest name";
"-n", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--dryrun", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--dry-run", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--format", Arg.String set_format, s_"format" ^ " " ^ s_"Set format (default: auto)";
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
[ S 'a'; L"add" ], Getopt.String (s_"file", add_file), s_"Add disk image file";
[ L"attach" ], Getopt.String ("iso", attach_disk), s_"Attach data disk/ISO during install";
[ L"attach-format" ], Getopt.String ("format", set_attach_format),
s_"Set attach disk format";
[ S 'c'; L"connect" ], Getopt.Set_string (s_"uri", libvirturi), s_"Set libvirt URI";
[ S 'd'; L"domain" ], Getopt.String (s_"domain", set_domain), s_"Set libvirt guest name";
[ S 'n'; L"dryrun"; L"dry-run" ], Getopt.Set dryrun, s_"Perform a dry run";
[ L"format" ], Getopt.String (s_"format", set_format), s_"Set format (default: auto)";
[ S 'm'; L"memsize" ], Getopt.Int ("mb", set_memsize), s_"Set memory size";
[ L"network" ], Getopt.Set network, s_"Enable appliance network (default)";
[ L"no-network" ], Getopt.Clear network, s_"Disable appliance network";
[ L"smp" ], Getopt.Int ("vcpus", set_smp), s_"Set number of vCPUs";
] in
let customize_argspec, get_customize_ops =
Customize_cmdline.argspec () in
let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
let argspec = set_standard_options argspec in
let anon_fun _ = raise (Arg.Bad (s_"extra parameter on the command line")) in
let usage_msg =
sprintf (f_"\
%s: customize a virtual machine
@@ -110,7 +102,8 @@ A short summary of the options is given below. For detailed help please
read the man page virt-customize(1).
")
prog in
Arg.parse argspec anon_fun usage_msg;
let opthandle = create_standard_options argspec usage_msg in
Getopt.parse opthandle;
if not !format_consumed then
error (f_"--format parameter must appear before -a parameter");
@@ -135,9 +128,9 @@ read the man page virt-customize(1).
~readonly ?discard
?libvirturi ~allowuuid ~readonlydisk
dom)
| _, Some _ ->
| _::_, Some _ ->
error (f_"you cannot give -a and -d options together. Read virt-customize(1) man page for further information.")
| files, None ->
| (_::_) as files, None ->
fun g readonly ->
List.iter (
fun (uri, format) ->
@@ -169,11 +162,6 @@ read the man page virt-customize(1).
may g#set_memsize memsize;
may g#set_smp smp;
g#set_network network;
(* Make sure to turn SELinux off to avoid awkward interactions
* between the appliance kernel and applications/libraries interacting
* with SELinux xattrs.
*)
g#set_selinux false;
(* Add disks. *)
add g dryrun;
@@ -197,14 +185,7 @@ read the man page virt-customize(1).
(* Mount up the disks, like guestfish -i.
* See [ocaml/examples/inspect_vm.ml].
*)
let mps = g#inspect_get_mountpoints root in
let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
List.iter (
fun (mp, dev) ->
try g#mount dev mp;
with Guestfs.Error msg -> warning (f_"%s (ignored)") msg
) mps;
inspect_mount_root g root;
(* Do the customization. *)
Customize_run.run g root ops;

View File

@@ -50,7 +50,7 @@ let run (g : Guestfs.guestfs) root (ops : ops) =
warning (f_"log file %s: %s (ignored)") logfile (Printexc.to_string exn) in
(* Useful wrapper for scripts. *)
let do_run ~display cmd =
let do_run ~display ?(warn_failed_no_network = false) cmd =
if not guest_arch_compatible then
error (f_"host cpu (%s) and guest arch (%s) are not compatible, so you cannot use command line options that involve running commands in the guest. Use --firstboot scripts instead.")
Guestfs_config.host_cpu guest_arch;
@@ -85,18 +85,28 @@ exec >>%s 2>&1
%s
" (quote logfile) env_vars cmd in
if verbose () then printf "running command:\n%s\n%!" cmd;
debug "running command:\n%s" cmd;
try ignore (g#sh cmd)
with
Guestfs.Error msg ->
debug_logfile ();
if warn_failed_no_network && not (g#get_network ()) then (
prerr_newline ();
warning (f_"the command may have failed because the network is disabled. Try either removing '--no-network' or adding '--network' on the command line.");
prerr_newline ()
);
error (f_"%s: command exited with an error") display
in
(* http://distrowatch.com/dwres.php?resource=package-management *)
let guest_install_command packages =
let rec guest_install_command packages =
let quoted_args = String.concat " " (List.map quote packages) in
match g#inspect_get_package_management root with
| "apk" ->
sprintf "
apk update
apk add %s
" quoted_args
| "apt" ->
(* http://unix.stackexchange.com/questions/22820 *)
sprintf "
@@ -105,49 +115,77 @@ exec >>%s 2>&1
apt-get $apt_opts update
apt-get $apt_opts install %s
" quoted_args
| "dnf" ->
sprintf "dnf -y install %s" quoted_args
| "pisi" ->
sprintf "pisi it %s" quoted_args
| "pacman" ->
sprintf "pacman -S %s" quoted_args
| "urpmi" ->
sprintf "urpmi %s" quoted_args
| "yum" ->
sprintf "yum -y install %s" quoted_args
| "zypper" ->
sprintf "zypper -n in -l %s" quoted_args
| "dnf" -> sprintf "dnf -y install %s" quoted_args
| "pisi" -> sprintf "pisi it %s" quoted_args
| "pacman" -> sprintf "pacman -S --noconfirm %s" quoted_args
| "urpmi" -> sprintf "urpmi %s" quoted_args
| "xbps" -> sprintf "xbps-install -Sy %s" quoted_args
| "yum" -> sprintf "yum -y install %s" quoted_args
| "zypper" -> sprintf "zypper -n in -l %s" quoted_args
| "unknown" ->
error (f_"--install is not supported for this guest operating system")
error_unknown_package_manager (s_"--install")
| pm ->
error (f_"sorry, don't know how to use --install with the '%s' package manager") pm
error_unimplemented_package_manager (s_"--install") pm
and guest_update_command () =
match g#inspect_get_package_management root with
| "apk" ->
"
apk update
apk upgrade
"
| "apt" ->
(* http://unix.stackexchange.com/questions/22820 *)
sprintf "
"
export DEBIAN_FRONTEND=noninteractive
apt_opts='-q -y -o Dpkg::Options::=--force-confnew'
apt-get $apt_opts update
apt-get $apt_opts upgrade
"
| "dnf" ->
sprintf "dnf -y --best upgrade"
| "pisi" ->
sprintf "pisi upgrade"
| "pacman" ->
sprintf "pacman -Su"
| "urpmi" ->
sprintf "urpmi --auto-select"
| "yum" ->
sprintf "yum -y update"
| "zypper" ->
sprintf "zypper -n update -l"
| "dnf" -> "dnf -y --best upgrade"
| "pisi" -> "pisi upgrade"
| "pacman" -> "pacman -Su"
| "urpmi" -> "urpmi --auto-select"
| "xbps" -> "xbps-install -Suy"
| "yum" -> "yum -y update"
| "zypper" -> "zypper -n update -l"
| "unknown" ->
error (f_"--update is not supported for this guest operating system")
error_unknown_package_manager (s_"--update")
| pm ->
error (f_"sorry, don't know how to use --update with the '%s' package manager") pm
error_unimplemented_package_manager (s_"--update") pm
and guest_uninstall_command packages =
let quoted_args = String.concat " " (List.map quote packages) in
match g#inspect_get_package_management root with
| "apk" -> sprintf "apk del %s" quoted_args
| "apt" ->
(* http://unix.stackexchange.com/questions/22820 *)
sprintf "
export DEBIAN_FRONTEND=noninteractive
apt_opts='-q -y -o Dpkg::Options::=--force-confnew'
apt-get $apt_opts remove %s
" quoted_args
| "dnf" -> sprintf "dnf -y remove %s" quoted_args
| "pisi" -> sprintf "pisi rm %s" quoted_args
| "pacman" -> sprintf "pacman -R %s" quoted_args
| "urpmi" -> sprintf "urpme %s" quoted_args
| "xbps" -> sprintf "xbps-remove -Sy %s" quoted_args
| "yum" -> sprintf "yum -y remove %s" quoted_args
| "zypper" -> sprintf "zypper -n rm -l %s" quoted_args
| "unknown" ->
error_unknown_package_manager (s_"--uninstall")
| pm ->
error_unimplemented_package_manager (s_"--uninstall") pm
(* Windows has package_management == "unknown". *)
and error_unknown_package_manager flag =
error (f_"cannot use '%s' because no package manager has been detected for this guest OS.\n\nIf this guest OS is a common one with ordinary package management then this may have been caused by a failure of libguestfs inspection.\n\nFor OSes such as Windows that lack package management, this is not possible. Try using one of the '--firstboot*' flags instead (described in the manual).") flag
and error_unimplemented_package_manager flag pm =
error (f_"sorry, '%s' with the '%s' package manager has not been implemented yet.\n\nYou can work around this by using one of the '--run*' or '--firstboot*' options instead (described in the manual).") flag pm
in
(* Set the random seed. *)
@@ -193,7 +231,7 @@ exec >>%s 2>&1
| `Delete path ->
message (f_"Deleting: %s") path;
g#rm_rf path
Array.iter g#rm_rf (g#glob_expand ~directoryslash:false path)
| `Edit (path, expr) ->
message (f_"Editing: %s") path;
@@ -230,7 +268,7 @@ exec >>%s 2>&1
| `InstallPackages pkgs ->
message (f_"Installing packages: %s") (String.concat " " pkgs);
let cmd = guest_install_command pkgs in
do_run ~display:cmd cmd
do_run ~display:cmd ~warn_failed_no_network:true cmd
| `Link (target, links) ->
List.iter (
@@ -267,11 +305,11 @@ exec >>%s 2>&1
| Subscription_manager.PoolAuto ->
message (f_"Attaching to compatible subscriptions");
let cmd = "subscription-manager attach --auto" in
do_run ~display:cmd cmd
do_run ~display:cmd ~warn_failed_no_network:true cmd
| Subscription_manager.PoolId id ->
message (f_"Attaching to the pool %s") id;
let cmd = sprintf "subscription-manager attach --pool=%s" (quote id) in
do_run ~display:cmd cmd
do_run ~display:cmd ~warn_failed_no_network:true cmd
)
| `SMRegister ->
@@ -284,17 +322,18 @@ exec >>%s 2>&1
let cmd = sprintf "subscription-manager register --username=%s --password=%s"
(quote creds.Subscription_manager.sm_username)
(quote creds.Subscription_manager.sm_password) in
do_run ~display:"subscription-manager register" cmd
do_run ~display:"subscription-manager register"
~warn_failed_no_network:true cmd
| `SMRemove ->
message (f_"Removing all the subscriptions");
let cmd = "subscription-manager remove --all" in
do_run ~display:cmd cmd
do_run ~display:cmd ~warn_failed_no_network:true cmd
| `SMUnregister ->
message (f_"Unregistering with subscription-manager");
let cmd = "subscription-manager unregister" in
do_run ~display:cmd cmd
do_run ~display:cmd ~warn_failed_no_network:true cmd
| `SSHInject (user, selector) ->
(match g#inspect_get_type root with
@@ -321,11 +360,16 @@ exec >>%s 2>&1
message (f_"Running touch: %s") path;
g#touch path
| `Update ->
message (f_"Updating core packages");
let cmd = guest_update_command () in
| `UninstallPackages pkgs ->
message (f_"Uninstalling packages: %s") (String.concat " " pkgs);
let cmd = guest_uninstall_command pkgs in
do_run ~display:cmd cmd
| `Update ->
message (f_"Updating packages");
let cmd = guest_update_command () in
do_run ~display:cmd ~warn_failed_no_network:true cmd
| `Upload (path, dest) ->
message (f_"Uploading: %s to %s") path dest;
let dest =
@@ -370,19 +414,7 @@ exec >>%s 2>&1
if ops.flags.selinux_relabel then (
message (f_"SELinux relabelling");
if guest_arch_compatible then (
let cmd = sprintf "
if load_policy && fixfiles restore; then
rm -f /.autorelabel
else
touch /.autorelabel
echo '%s: SELinux relabelling failed, will relabel at boot instead.'
fi
" prog in
do_run ~display:"load_policy && fixfiles restore" cmd
) else (
g#touch "/.autorelabel"
)
SELinux_relabel.relabel g
);
(* Clean up the log file:
@@ -408,6 +440,6 @@ exec >>%s 2>&1
(try ignore (g#debug "sh" [| "fuser"; "-k"; "/sysroot" |])
with exn ->
if verbose () then
printf (f_"%s: %s (ignored)\n") prog (Printexc.to_string exn)
warning (f_"%s (ignored)") (Printexc.to_string exn)
);
g#ping_daemon () (* tiny delay after kill *)

2
customize/dummy.c Normal file
View File

@@ -0,0 +1,2 @@
/* Dummy source, to be used for OCaml-based tools with no C sources. */
enum { foo = 1 };

View File

@@ -185,19 +185,19 @@ module Windows = struct
try Sys.getenv "VIRT_TOOLS_DATA_DIR"
with Not_found -> Guestfs_config.datadir // "virt-tools" in
(* rhsrvany.exe must exist.
(* Either rhsrvany.exe or pvvxsvc.exe must exist.
*
* (Check also that it's not a dangling symlink but a real file).
*)
let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in
(try
let chan = open_in rhsrvany_exe in
close_in chan
with
Sys_error msg ->
error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s")
rhsrvany_exe msg
);
let services = ["rhsrvany.exe"; "pvvxsvc.exe"] in
let srvany =
try
List.find (
fun service -> Sys.file_exists (virt_tools_data_dir // service)
) services
with Not_found ->
error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)")
virt_tools_data_dir in
(* Create a directory for firstboot files in the guest. *)
let firstboot_dir, firstboot_dir_win =
@@ -211,12 +211,12 @@ module Windows = struct
g#mkdir_p firstboot_dir;
loop firstboot_dir firstboot_dir_win path
in
loop "" "C:" ["Program Files"; "Red Hat"; "Firstboot"] in
loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"] in
g#mkdir_p (firstboot_dir // "scripts");
(* Copy rhsrvany to the guest. *)
g#upload rhsrvany_exe (firstboot_dir // "rhsrvany.exe");
(* Copy pvvxsvc or rhsrvany to the guest. *)
g#upload (virt_tools_data_dir // srvany) (firstboot_dir // srvany);
(* Write a firstboot.bat control script which just runs the other
* scripts in the directory. Note we need to use CRLF line endings
@@ -232,7 +232,7 @@ set log=%%firstboot%%\\log.txt
set scripts=%%firstboot%%\\scripts
set scripts_done=%%firstboot%%\\scripts-done
call :main > \"%%log%%\" 2>&1
call :main >> \"%%log%%\" 2>&1
exit /b
:main
@@ -244,17 +244,17 @@ if not exist \"%%scripts_done%%\" (
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
call \"%%%%f\"
move \"%%%%f\" \"%%scripts_done%%\"
pushd \"%%scripts_done%%\"
call \"%%%%~nf\"
set elvl=!errorlevel!
echo .... exit code !elvl!
if !elvl! equ 0 (
move \"%%%%f\" \"%%scripts_done%%\"
)
popd
)
echo uninstalling firstboot service
rhsrvany.exe -s firstboot uninstall
" firstboot_dir_win in
%s -s firstboot uninstall
" firstboot_dir_win srvany in
g#write (firstboot_dir // "firstboot.bat") (unix2dos firstboot_script);
@@ -283,7 +283,7 @@ rhsrvany.exe -s firstboot uninstall
"Start", REG_DWORD 0x2_l;
"ErrorControl", REG_DWORD 0x1_l;
"ImagePath",
REG_SZ (firstboot_dir_win ^ "\\rhsrvany.exe -s firstboot");
REG_SZ (sprintf "%s\\%s -s firstboot" firstboot_dir_win srvany);
"DisplayName", REG_SZ "Virt tools firstboot service";
"ObjectName", REG_SZ "LocalSystem" ];

View File

@@ -165,6 +165,9 @@ and default_crypto g root =
| ("opensuse"|"sles"), v when v >= 11 -> `SHA512
| ("opensuse"|"sles"), _ -> `MD5
(* Rolling distributions, which hopefully should be updated enough. *)
| ("archlinux"|"voidlinux"), _ -> `SHA512
| _, _ ->
let minor = g#inspect_get_minor_version root in
warning (f_"password: using insecure md5 password encryption for guest of type %s version %d.%d.

View File

@@ -25,30 +25,24 @@
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/fail.h>
#include "file-edit.h"
/**
* We try to reuse the internals of the OCaml binding (for extracting
* the guestfs handle, and raising errors); hopefully this should be safe,
* as long as it's kept internal within the libguestfs sources.
*/
#include "../ocaml/guestfs-c.h"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
virt_customize_edit_file_perl (value verbosev, value gv, value filev,
value exprv)
virt_customize_edit_file_perl (value verbosev, value gv, value gpv,
value filev, value exprv)
{
CAMLparam4 (verbosev, gv, filev, exprv);
CAMLparam5 (verbosev, gv, gpv, filev, exprv);
int r;
guestfs_h *g = Guestfs_val (gv);
guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gpv);
r = edit_file_perl (g, String_val (filev), String_val (exprv), NULL,
Bool_val (verbosev));
if (r == -1)
ocaml_guestfs_raise_error (g, "edit_file_perl");
caml_failwith (guestfs_last_error (g) ? : "edit_file_perl: unknown error");
CAMLreturn (Val_unit);
}

View File

@@ -18,6 +18,12 @@
open Common_utils
external c_edit_file : verbose:bool -> Guestfs.t -> string -> string -> unit
external c_edit_file : verbose:bool -> Guestfs.t -> int64 -> string -> string -> unit
= "virt_customize_edit_file_perl"
let edit_file g file expr = c_edit_file (verbose ()) g file expr
let edit_file g file expr =
(* Note we pass original 'g' even though it is not used by the
* callee. This is so that 'g' is kept as a root on the stack, and
* so cannot be garbage collected while we are in the c_edit_file
* function.
*)
c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr

View File

@@ -35,7 +35,7 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
List.iter (
fun file ->
if g#is_file file then (
make_random_seed_file g file;
make_random_seed_file g file ~exists:true;
created := true
)
) files;
@@ -71,8 +71,11 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
!created
and make_random_seed_file g file =
let file_exists = g#is_file file in
and make_random_seed_file ?exists g file =
let file_exists =
match exists with
| None -> g#is_file file
| Some b -> b in
let n =
if file_exists then (
let n = Int64.to_int (g#filesize file) in

View File

@@ -106,27 +106,33 @@ let do_ssh_inject_unix (g : Guestfs.guestfs) user selector =
(* Get user's home directory. *)
g#aug_init "/" 0;
let home_dir =
let read_user_detail what =
try
let expr = sprintf "/files/etc/passwd/%s/home" user in
let expr = sprintf "/files/etc/passwd/%s/%s" user what in
g#aug_get expr
with G.Error _ ->
error (f_"ssh-inject: the user %s does not exist on the guest")
user in
user
in
let home_dir = read_user_detail "home" in
let uid = int_of_string (read_user_detail "uid") in
let gid = int_of_string (read_user_detail "gid") in
g#aug_close ();
(* Create ~user/.ssh if it doesn't exist. *)
let ssh_dir = sprintf "%s/.ssh" home_dir in
if not (g#exists ssh_dir) then (
g#mkdir ssh_dir;
g#chmod 0o700 ssh_dir
g#chmod 0o700 ssh_dir;
g#chown uid gid ssh_dir;
);
(* Create ~user/.ssh/authorized_keys if it doesn't exist. *)
let auth_keys = sprintf "%s/authorized_keys" ssh_dir in
if not (g#exists auth_keys) then (
g#touch auth_keys;
g#chmod 0o600 auth_keys
g#chmod 0o600 auth_keys;
g#chown uid gid auth_keys;
);
(* Append the key. *)

View File

@@ -0,0 +1,25 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
$srcdir/../podcheck.pl virt-customize.pod virt-customize \
--insert $srcdir/../customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $srcdir/../customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--ignore=--dryrun

Some files were not shown because too many files have changed in this diff Show More