Compare commits

...

1655 Commits

Author SHA1 Message Date
Richard W.M. Jones
74660366f6 Version 1.35.22. 2017-02-10 13:38:34 +00:00
Richard W.M. Jones
c99cf0caad v2v: Add result of qemu-img offset/size test to debug output.
Updates commit 3fc9520069.
2017-02-10 13:38:34 +00:00
Richard W.M. Jones
430604ef37 v2v: Fix quoting in external qemu-img command.
Fixes commit 3fc9520069.
2017-02-10 13:38:34 +00:00
Richard W.M. Jones
3a8e2babed contrib: Sort patches into alphabetical order and add to EXTRA_DIST.
We also have to use AM_INIT_AUTOMAKE(tar-pax), since otherwise
automake uses some ancient tar format that doesn't support a filename
this long.  (See: https://noiselabs.io/2010/02/27/tar-file-name-is-too-long-max-99/
for a clear explanation)

Fixes commit b702ec19e8.
2017-02-10 13:08:03 +00:00
Richard W.M. Jones
0a8f95a222 v2v: ova: Further fix test cases.
Updates commit 7461a8fab1.
Fixes and partly reverts commit 8f91d3a9b0.
2017-02-10 12:56:08 +00:00
Richard W.M. Jones
2c340682b5 daemon: selinux: Document cases where setfiles takes a long time to run.
Just adding a comment pointed back to the bug.
2017-02-10 10:14:15 +00:00
Richard W.M. Jones
b702ec19e8 contrib: p2v: Add scripts to build and test virt-p2v ISOs with RHEL 5, 6.
This adds a contrib script which can be used to build the virt-p2v ISO
on top of RHEL 5 or RHEL 6, i686 (32 bit) or x86-64 (64 bit) base.

There is also a script for testing the ISOs produced this way.
2017-02-09 17:52:45 +00:00
Richard W.M. Jones
4ab07a9949 builder: templates: Call sync after running virt-install.
I don't think this will really make any difference.  However there is
some puzzling disk corruption in the recently built RHEL 5 & 6 i686
images, and I want to make absolutely sure they are not caused by an
unsynchronized disk image.
2017-02-09 17:52:45 +00:00
Richard W.M. Jones
eeb3f42d1f builder: templates: Add 32 bit (i386) templates for RHEL 5 and 6. 2017-02-09 13:54:46 +00:00
Richard W.M. Jones
d74ed7b122 p2v: Fix RHEL URLs in kickstart.
Also make the repo directives use the --proxy flag if specified and
supported.
2017-02-09 13:54:46 +00:00
Richard W.M. Jones
3e7e6d95c1 p2v: Fix virt-p2v-make-kickstart when run from local directory.
It was looking for the binary in p2v/virt-p2v/virt-p2v.xz.  This fix
makes it look for the correct path p2v/virt-p2v.xz.
2017-02-08 17:44:47 +00:00
Richard W.M. Jones
3fc9520069 v2v: ova: Don't rely on qemu-img version, test "offset" and "size" features.
See:

https://www.redhat.com/archives/libguestfs/2017-February/msg00064.html
2017-02-08 12:47:17 +00:00
Richard W.M. Jones
a1bc37d673 p2v: Document sources of ssh/session timeout problems. 2017-02-08 12:47:17 +00:00
Richard W.M. Jones
2f97cd5517 p2v: Send ping packets every 5 minutes to sshd.
Also drop the connection if no response at all has been received after
30 minutes.

This action should prevent firewall timeouts from causing virt-p2v to
fail (see this thread:
https://www.redhat.com/archives/libguestfs/2017-February/msg00010.html).

Thanks: Tomáš Golembiovský
2017-02-08 12:47:17 +00:00
Richard W.M. Jones
27b64f8227 p2v: Use the ADD_ARG macro to simplify ssh/scp parameters.
No functional change.
2017-02-08 12:47:17 +00:00
Richard W.M. Jones
0de08f6527 daemon: Allow ADD_ARG macro to be used everywhere.
This is a simple macro with no dependencies.  Allow it to be used from
any program.
2017-02-08 12:47:17 +00:00
Richard W.M. Jones
4983084b8c resize: tests: Remove comment.
Doesn't look like we'll handle extended partitions any time
soon, so remove comment.
2017-02-08 12:04:23 +00:00
Richard W.M. Jones
23878acbbd builder: tests: Disable valgrind for test with multi-line parameters.
Breaks libtool, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1420301

This updates commit 736a8465a6.
2017-02-08 11:58:34 +00:00
Richard W.M. Jones
736a8465a6 valgrind: Add libtool to the @VG@ macro.
There were still a few places where we were testing bash rather than
the intended program.  Add `libtool --mode=execute' to the beginning
of the @VG@ macro to try to get around this.
2017-02-08 10:30:58 +00:00
Richard W.M. Jones
6ec23eeac0 Version 1.35.21. 2017-02-07 22:01:07 +00:00
Richard W.M. Jones
0276b3e246 v2v: ova: Add various test data files to EXTRA_DIST.
Fixes commit 8f91d3a9b0.
2017-02-07 21:54:33 +00:00
Richard W.M. Jones
f73ac1fc9c v2v: Skip one test because virt-v2v -i ova can break with libvirt backend.
See:
https://www.redhat.com/archives/libguestfs/2017-February/msg00101.html
2017-02-07 21:13:57 +00:00
Richard W.M. Jones
74ded0dbc1 RHEL 5: tests: Don't use 'truncate' command.
The coreutils 'truncate' command does not exist in RHEL 5.  Replace
use of this command in tests with the guestfish 'disk-create' command.
2017-02-07 18:51:53 +00:00
Richard W.M. Jones
7461a8fab1 v2v: ova: Normalize the output in test case.
Fixes commit 8f91d3a9b0.
2017-02-07 18:51:52 +00:00
Richard W.M. Jones
fa6016af19 p2v: Use socket activation with qemu-nbd and nbdkit.
If supported, use socket activation to pass a pre-opened listening
socket to the NBD server.  This means we can guarantee to choose an
unused port even if there are multiple instances of virt-p2v running
(ie. when testing) or if there are unexpected services running on the
same machine.

This change applies to both NBD servers, since both now (or will
shortly) support this feature.
2017-02-07 15:57:04 +00:00
Richard W.M. Jones
2e0c33a7b9 p2v: Don't hard code "localhost" (NBD listening address) everywhere.
No functional change.
2017-02-07 15:57:04 +00:00
Richard W.M. Jones
4dd4a9b1a6 p2v: Move nbd_local_port to nbd.c.
In preparation for using socket activation, move the nbd_local_port
global inside nbd.c and make it private.

This is largely code motion.  However I rearranged the order in which
the ssh data connection and the NBD server are started up.  Previously
the ssh connection was made first, and the NBD server was then
started.  Now the NBD server starts first.  This happens so that nbd.c
can choose the local port, and when we implement socket activation it
will allow nbd.c to open the socket and choose a free port too.
2017-02-07 15:57:04 +00:00
Richard W.M. Jones
cdd8dc4145 p2v: Clean up ugly implementation of --nbd option.
The previous implementation was pretty ugly.  This reimplements things
a bit more cleanly.
2017-02-07 15:57:04 +00:00
Richard W.M. Jones
d9ab95ec16 p2v: Move NBD-related functions into a separate file.
This is almost pure code motion, but I changed the name and prototype
of the function 'wait_nbd' to make its purpose clearer, and to remove
the unnecessary timeout setting (which is hard-coded).
2017-02-07 15:57:04 +00:00
Pino Toscano
8a2b0738d1 resize: support non-local output disks (RHBZ#1404182)
Parse the output disk as URI, and use all its attributes just like
it is done for the input disk.  The only change is that the fsync of the
output disk is limited now for local URIs only, since it will not work
with remote protocols.
2017-02-06 16:36:29 +01:00
Richard W.M. Jones
10a5567dc7 lib: g->program is now never the empty string.
The getprogname module either sets g->program to a string derived from
argv[0] or fails at compile time.

Fixes commit eea210dbf7.
2017-02-06 12:22:49 +00:00
Pino Toscano
c1bd2c3e74 dib: add tgz output format
Implement the "tgz" output format, i.e. "tar" compressed as gzip.

This was implemented in diskimage-builder upstream as
commit da41ee6012b064aa6901c871a1104a3a3933117e.
2017-02-06 10:09:59 +01:00
Pino Toscano
91646e0bb6 dib: clarify "output:" lines in --machine-readable documentation 2017-02-06 10:09:59 +01:00
Pino Toscano
35f29deacc dib: refactor output formats handling
Implement a system similar to the operations in virt-sysprep, so each
output format has its own file and attributes (such as command line
arguments).

The result is that there is no more need to spread everywhere the job
required by each output format, such as checking for tools, or hooking
at the right point.
2017-02-06 10:09:58 +01:00
Pino Toscano
00ecda5d9c dib: pass custom mkfs options after the filesystem type
Make sure they are handled as options for the actual mkfs driver,
instead of mkfs itself.  Also, improve the documentation of
--mkfs-options accordingly.

This was fixed in diskimage-builder upstream as
commit 5e2330d89c6c0e55b270464abea7e99a4d3246ad.
2017-02-06 10:09:58 +01:00
Pino Toscano
380fd71dc8 dib: add --checksum
Add a new option to create files with the MD5 and SHA512 checksums of
all the disk image types produced.

This was implemented in diskimage-builder upstream as
commit 2ea5feca5c4b64867ac327736edfb20408f8840e and
commit 22952b7ea0543bb4f446752976d1d8ba232b021a.
2017-02-06 10:09:58 +01:00
Pino Toscano
bc06d59855 dib: clear up "already provided" message
Improve the error message that is shown when trying to selecting an
element, and another element provides it.

This was implemented in diskimage-builder upstream as
commit 452f7b8d5aaa6e85e3b01b970cd9cbc842b34b86.
2017-02-06 10:09:58 +01:00
Pino Toscano
ab0cf0012f fuse: use the configured program name
When initializing FUSE, use the program name as set (either
automatically or manually) in the guestfs handle.
2017-02-06 10:09:58 +01:00
Richard W.M. Jones
5657d4726d v2v: Use failwithf instead of failwith (sprintf ...) 2017-02-04 15:50:26 +00:00
Richard W.M. Jones
a11040d9cd v2v: Use failwith/failwithf instead of raise (Failure ...)
Minor refactoring of ommit d3c93e3320.
2017-02-04 15:47:43 +00:00
Tomáš Golembiovský
8f91d3a9b0 v2v: ova: don't extract files from OVA if it's not needed
We don't have to always extract all files from the OVA archive. The OVA,
as defined in the standard, is plain tar. We can work directly over the
tar archive if we use correct 'offset' and 'size' options when defining
the backing file for QEMU. This puts much lower requirement on available
disk space.

Since the virt-v2v behaviour for OVA input now depends on QEMU version
available this affects some of the tests. Expected result of the
affected also has to depend on the QEMU used thus such tests will have
two *.expected files.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-04 15:13:29 +00:00
Tomáš Golembiovský
d3c93e3320 v2v: add function find_file_in_tar to utils
The function looks up file in tar archive and returns a tuple containing
which at byte it starts and how long the file is.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-04 15:13:29 +00:00
Tomáš Golembiovský
3839b0be5b v2v: add function qemu_img_version to utils
The function returns version of qemu-img as a tuple (major, minor), or
the value (0,9) in case there was an error detecting the version.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-04 15:13:29 +00:00
Tomáš Golembiovský
e9eb3a79da mllib: add subdirectory function to common_utils
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-04 15:13:29 +00:00
Richard W.M. Jones
152657178d generator: Move failwithf to mllib.
A useful function.  This is just code motion.
2017-02-04 15:13:29 +00:00
Richard W.M. Jones
2b5173712b v2v: Further increase memory allocated to the appliance (RHBZ#1418283).
In commit 08f82f2e3d we increased the
memory size to 800MB (on x86) so that the semodule command would work.

However it has been discovered that another SELinux command takes
large amounts of RAM (setfiles during the SELinux relabel step).
Therefore increase the memory size again, this time to 2000MB.
2017-02-02 09:36:56 +00:00
Richard W.M. Jones
d5383ca066 docs: Document that virt-p2v can use qemu-nbd or nbdkit.
Fixes commit 4af9081e0d.
2017-02-01 12:24:21 +00:00
Richard W.M. Jones
889386f8c6 uefi: Remove references to kraxel's old edk2 builds.
As noted in the source code, these were due to be removed at
the end of 2016.
2017-01-31 19:26:07 +00:00
Tomáš Golembiovský
c465e794b2 v2v: ova: don't detect compressed disks, read the OVF instead
The information whether the disk is gzip compressed or not is stored
in the OVF. There is no reason to do the detection.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-01-31 12:01:12 +00:00
Richard W.M. Jones
2e5033349a configure: Fix release date of 1.35.20.
Fixes commit 7b6b9d9bea.
2017-01-31 11:01:26 +00:00
Richard W.M. Jones
d5752538bf common/miniexpect: Add README and miniexpect.pod from upstream. 2017-01-29 18:12:43 +00:00
Richard W.M. Jones
e79a2af219 generator: Make 'main.ml' clearer.
- Make module name explicit, so it's more obvious which module a
  function is defined in.

- Group lines of code by feature.

- Capitalize some module names properly.

Just code motion, no functional change.
2017-01-29 17:32:22 +00:00
Richard W.M. Jones
c9a51b2fd2 po: Really ignore perl/lib/Sys/Guestfs.c (RHBZ#1417444).
Incorrect grep expression meant this file was not being ignored
before.

Thanks: Marius Cirsta
2017-01-29 13:34:03 +00:00
Richard W.M. Jones
48d4117789 fish: Handle changed type of 'len' parameter in gperf 3.1 (RHBZ#1416941).
Commit 004de6cf45 was not sufficient to
solve this problem.  We are also using gperf in guestfish.  Rewrite
the code in the same way to avoid having to prototype the hash
function.
2017-01-28 13:23:40 +00:00
Richard W.M. Jones
7b6b9d9bea Version 1.35.20. 2017-01-27 13:02:36 +00:00
Richard W.M. Jones
4733cb6cea p2v: Add a test for virt-p2v with nbdkit. 2017-01-27 09:42:01 +00:00
Richard W.M. Jones
4af9081e0d p2v: Allow nbdkit as an alternative NBD server to qemu-nbd.
Add code in virt-p2v so that it can use nbdkit (with the file plugin)
as an alternative to qemu-nbd.

This is controlled through the virt-p2v --nbd command line option,
allowing you to select which server (out of qemu-nbd or nbdkit) you
prefer (with a fallback).  The default is: --nbd=qemu-nbd,nbdkit so
qemu-nbd will be used preferentially.
2017-01-27 09:42:01 +00:00
Richard W.M. Jones
57d1e55374 p2v: In non-ISO environment, don't use hard-coded port 50123.
When testing virt-p2v (eg. on the host machine) this prevents us from
testing two instances of virt-p2v at the same time because both will
try to use the same port.
2017-01-27 09:42:01 +00:00
Richard W.M. Jones
535e6f5ebb tests/mount-local, tests/parallel: Use srandom (time (NULL) + getpid ()).
If two instances of the test start at exactly the same time, they
would have the same random number seed.
2017-01-27 09:42:01 +00:00
Richard W.M. Jones
5d607f752b common/edit: Don't use random() function.
Generate the random filename using our utility function
guestfs_int_random_string.  This also means that we will not need to
call srandom() in guestfish or virt-edit.
2017-01-27 09:42:01 +00:00
Richard W.M. Jones
004de6cf45 errnostring: Handle changed type of 'len' parameter in gperf 3.1 (RHBZ#1416941).
The prototype of the hash function changed in gperf 3.1:

* The 'len' parameter of the hash function and of the lookup function is now
  of type 'size_t' instead of 'unsigned int'. This makes it safe to call these
  functions with strings of length > 4 GB, on 64-bit machines.

This commit moves the guestfs_int_string_to_errno function into the
third (functions) section of the gperf file so it is able to use the
lookup function without needing a prototype.

Thanks: Marius Cirsta
2017-01-27 09:36:50 +00:00
Richard W.M. Jones
00a2b689b3 Revert "errnostring: Handle changed type of 'len' parameter in gperf 3.1 (RHBZ#1416941)."
This reverts commit 3a2b89a09e.
2017-01-27 09:31:40 +00:00
Richard W.M. Jones
3a2b89a09e errnostring: Handle changed type of 'len' parameter in gperf 3.1 (RHBZ#1416941).
The prototype of the hash function changed in gperf 3.1:

* The 'len' parameter of the hash function and of the lookup function is now
  of type 'size_t' instead of 'unsigned int'. This makes it safe to call these
  functions with strings of length > 4 GB, on 64-bit machines.

This change tries to detect the required type in ./configure

Thanks: Marius Cirsta
2017-01-26 22:07:23 +00:00
Richard W.M. Jones
8ee97b8859 p2v: Move miniexpect library to common/miniexpect.
No change, just code motion.
2017-01-26 15:05:47 +00:00
Richard W.M. Jones
db48870cf3 df: Move framework for processing domains in parallel to common/parallel.
Just code motion.
2017-01-26 15:05:47 +00:00
Richard W.M. Jones
a8c5739fd2 fish: Move edit, progress, windows under common/
Three more pieces of common code are moved under the common/
subdirectory.  This is just code motion.

Note that windows.[ch] wasn't even being used by guestfish.  That code
was only used in other virt tools.
2017-01-26 15:05:47 +00:00
Richard W.M. Jones
a9199a46b1 fish: Move fishcommon library to common/options.
This is mostly code motion but:

(1) I had to remove the compile-time COMPILING_GUESTFISH and
COMPILING_VIRT_RESCUE macros and replace them with runtime constants
and checks.

(2) I moved the fish/config.c file into this library.
2017-01-26 15:05:47 +00:00
Richard W.M. Jones
779bc1de23 cat: Move visit library to new directory common/visit.
Just code motion.
2017-01-26 15:05:46 +00:00
Richard W.M. Jones
f161c9ea57 Rename src/ to lib/ 2017-01-26 15:05:46 +00:00
Richard W.M. Jones
b53cec584d lib: Move utilities to new directory common/utils.
Just code motion.

This commit makes it clearer what is a utility and what is part of the
library.  It also makes it clear that we should rename:

  guestfs-internal-frontend.h -> utils.h
  guestfs-internal-frontend-cleanups.h -> cleanups.h (?)

but this commit does not make that change.
2017-01-26 15:05:46 +00:00
Richard W.M. Jones
88c0ce2397 lib: Share common protocol and errnostring libraries with the library and daemon.
This commit, which is just code motion, moves the common XDR protocol
code (libprotocol) and the common errno handling (liberrnostring) into
libraries which are each built once and shared between the library and
daemon.
2017-01-26 15:05:46 +00:00
Richard W.M. Jones
e285566369 gobject: Avoid multiply defined CLEANFILES.
The error is:

gobject/docs/gtk-doc.make:52: warning: CLEANFILES multiply defined in condition TRUE ...
gobject/docs/Makefile.am:95:   'gobject/docs/gtk-doc.make' included from here
common-rules.mk:28: ... 'CLEANFILES' previously defined here
gobject/docs/Makefile.am:18:   'subdir-rules.mk' included from here
subdir-rules.mk:20:   'common-rules.mk' included from here
2017-01-26 15:05:46 +00:00
Richard W.M. Jones
84254bf739 p2v: Don't inhibit D-Bus support for modern systems.
Fixes commit c526afbe95.
2017-01-26 14:39:03 +00:00
Richard W.M. Jones
c90baa812a p2v: gtk: Update docs/C_SOURCE_FILES.
Updates commit 17cc502d9b.
2017-01-25 12:30:25 +00:00
Pino Toscano
571269bf72 p2v: log also environment on conversion server
Save the content of the environment on the conversion server, so it is
one additional help when debugging failed conversions.
2017-01-23 09:44:32 +01:00
Richard W.M. Jones
718ce7964c RHEL 5: p2v: Ignore garbage when decoding base64 sections in kickstart.
RHEL 5 base64 utility requires this flag to ignore newlines in input.
2017-01-21 13:54:02 +00:00
Richard W.M. Jones
ae160215ca RHEL 5: p2v: Workarounds for limited partial match support in ancient PCRE.
In the ancient version of PCRE in RHEL 5, partial match support does
not support /.*/, returning PCRE_ERROR_BADPARTIAL.  However the
equivalent regular expression /(?:.)*/ works fine, so use that
instead.
2017-01-21 10:24:40 +00:00
Richard W.M. Jones
17cc502d9b p2v: gtk: Move Gtk compat macros into separate files.
Just code motion.
2017-01-21 09:56:21 +00:00
Richard W.M. Jones
9ceb0cca05 p2v: Include file and line number in internal errors. 2017-01-21 09:46:04 +00:00
Richard W.M. Jones
a77ef0e7c8 RHEL 5: p2v: Compile GUI for ancient Gtk 2.10.
RHEL 5 has ancient Gtk 2.10 which lacks several functions and whole
features we need (eg the spinner).  Add various macros and function
definitions to work around this.
2017-01-21 09:46:04 +00:00
Richard W.M. Jones
c526afbe95 RHEL 5: p2v: Don't compile inhibit support if dbus doesn't support FD passing.
Since RHEL 5 doesn't have systemd, inhibit isn't supported anyway, so
compiling it out is no problem.
2017-01-21 09:46:04 +00:00
Richard W.M. Jones
035d839601 RHEL 5: p2v: Skip partial match checking when PCRE_INFO_OKPARTIAL is not defined.
This test is only a sanity check, so skip it when pcre doesn't define
this symbol.
2017-01-21 09:46:04 +00:00
Richard W.M. Jones
4f102b6832 p2v: Document lscpu, lspci, lsscsi, lsusb files.
Updates commit 5f0bcc3057.
2017-01-20 13:48:56 +00:00
Richard W.M. Jones
5f0bcc3057 p2v: Add more debugging information: lscpu, lspci, lsscsi, lsusb.
Dump extra information from the source physical machine to help with
debugging.
2017-01-20 09:51:31 +00:00
Richard W.M. Jones
1aefcbcc9b daemon: Add comment explaining why we remove 'p' character.
No code change, just a comment.

Updates commit 6fd2ddb350.
2017-01-19 12:06:25 +00:00
Pino Toscano
5b02e7e6df daemon: Return MD partitions in guestfs_list_partitions (RHBZ#1414510). 2017-01-19 12:03:55 +00:00
Pino Toscano
6fd2ddb350 daemon: Fix part-to-dev when the partition name includes p<N>.
If the device name ends with a number, Linux uses partition names of
the form <device>p<N>.  Handle this case by knocking off the 'p'
character.
2017-01-19 11:00:21 +00:00
Richard W.M. Jones
5c350db94d tests: Add unit tests for guestfs_canonical_device_name. 2017-01-19 09:16:52 +00:00
Richard W.M. Jones
4fa7df3ed7 canonical_device_name: Don't rewrite /dev/mdX as /dev/sdX (RHBZ#1414682).
The guestfs_canonical_device_name API was rewriting /dev/mdX as
/dev/sdX.  This is wrong since (eg) /dev/sd0 is not a device name, so
if you pass the canonicalized name back to the API it will fail.
virt-v2v was one tool doing this.
2017-01-19 09:15:16 +00:00
Richard W.M. Jones
4a9af91e36 aarch64: launch: direct: Use virtio-pci devices.
qemu-system-aarch64 -M virt now supports virtio-pci devices.  These
are considerably faster than virtio-mmio so use them by default.
2017-01-18 14:26:46 +00:00
Richard W.M. Jones
faff6f23ff lib: uefi: Don't call access(NULL) if no UEFI debug file exists.
Bug found by valgrind on aarch64:

==21350== Syscall param faccessat(pathname) points to unaddressable byte(s)
==21350==    at 0x4F05274: access (access.c:29)
==21350==    by 0x4954DC3: guestfs_int_get_uefi (appliance-uefi.c:90)
==21350==    by 0x49752D7: launch_libvirt (launch-libvirt.c:413)
==21350==    by 0x496FD83: guestfs_impl_launch (launch.c:98)
==21350==    by 0x4902003: guestfs_launch (actions-3.c:145)
[...]
==21350==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
2017-01-18 14:26:46 +00:00
Richard W.M. Jones
d45986d21b lib: Use a common function to validate strings. 2017-01-18 13:35:25 +00:00
Richard W.M. Jones
e035d848f7 mllib: Avoid OCaml local roots corruption.
Because we used 'return' directly, the effect of the CAMLparam0()
macro was not undone, resulting in local roots corruption when the
visit callback throws an exception.

The visit_tests unit test picked this up, but the corruption was only
seen on aarch64.

Fixes commit 4a62e52111.
2017-01-18 10:25:02 +00:00
Richard W.M. Jones
3a160fe16b lib: Add missing <unistd.h> to appliance-uefi.c.
appliance-uefi.c: In function 'guestfs_int_get_uefi':
appliance-uefi.c:67:9: error: implicit declaration of function 'access' [-Werror=implicit-function-declaration]
     if (access (codefile, R_OK) == 0 && access (varsfile, R_OK) == 0) {
         ^~~~~~
appliance-uefi.c:67:5: error: nested extern declaration of 'access' [-Werror=nested-externs]
     if (access (codefile, R_OK) == 0 && access (varsfile, R_OK) == 0) {
     ^~
appliance-uefi.c:67:27: error: 'R_OK' undeclared (first use in this function)
     if (access (codefile, R_OK) == 0 && access (varsfile, R_OK) == 0) {
                           ^~~~
appliance-uefi.c:67:27: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors

Fixes commit dd519e8a8e.
2017-01-17 08:58:00 +00:00
Cédric Bosdonnat
b9f510328a builder: extract Yajl helper functions to yajl.ml
Extract the yajl object_get_* helpers in the Yajl module since this
could be useful for any Yajl user code.
2017-01-05 09:25:11 +01:00
Tomáš Golembiovský
c96bcb4e24 tests: rename guestfs-hashsums.sh to test-utils.sh
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-01-04 10:41:48 +01:00
Tomáš Golembiovský
8644ea7242 v2v: ova: move the untar function
Move the untar function so it can be used later in the code.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-01-04 10:41:48 +01:00
Tomáš Golembiovský
347e4b1648 mllib: compute checksum of file inside tar
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-01-04 10:41:48 +01:00
Pino Toscano
e86b36a31c appliance: add ldmtools/libldm packages on more distros (RHBZ#1409023)
Add them also for Debian and Mageia, where libldm is shipped, and
adjust the comment on the RedHat line.
2017-01-03 17:41:16 +01:00
Pino Toscano
55bf7de97c Update copyright dates for 2017
Run the following command over the source:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also in this change:

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

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

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

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

Therefore this patch does two things:

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

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

It also adds:

  vdsm-compat-option

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

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

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

Thanks to: Richard W.M. Jones.

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

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

The new enum has only "root" as known role, which replaces the is_root
flag.
2016-12-06 18:11:44 +01:00
Pino Toscano
b01416121f appliance: mount also /dev/pts
Tools could require the use of pseudo-terminals, so make sure we have
/dev/pts available in the appliance.  The "command" API already
bind-mounts it when running commands, so this is the only bit needed.
2016-12-06 18:11:44 +01:00
Richard W.M. Jones
601e05508b builder: Refactor command line parsing in make-template script.
This refactors command line parsing into a parse_cmdline function.
The function uses the Arg module to parse the command line instead of
ad hoc parsing.

This also enforces use of the ./run script to run the program, since
otherwise you can end up with mixed versions of the OCaml bindings and
the C library.

This updates commit 65a0570385.
2016-12-02 17:04:05 +00:00
Pino Toscano
8462b1ea32 environment: fix error message for LIBGUESTFS_DEBUG failure
Properly mention LIBGUESTFS_DEBUG as environment variable when it
cannot be parsed as boolean.
2016-12-01 16:01:57 +01:00
Richard W.M. Jones
c2f5330447 v2v: Remove bogus backslash in test. 2016-12-01 12:48:57 +00:00
Cédric Bosdonnat
cd78fa4c88 packagelist: add initviocons package on SUSE
initviocons package provides tools to resize the terminal. Having it
in the appliance will allow SUSE users to have proper line wrapping
in their terminal when using virt-rescue.
2016-11-30 17:06:06 +00:00
Richard W.M. Jones
e4b73d67f2 builder: Update Fedora 25 and RHEL 7.3 ppc64 and ppc64le images.
Rebuild these images with the new make-template.ml script.  This fixes
the lack of virtio-scsi driver and broken initramfs.

These images all use LVM because without that both Fedora and RHEL put
the root filesystem on an extended partition (/dev/sda5) which
virt-resize cannot handle.

(Note the RHEL images are not public.)
2016-11-30 14:21:13 +00:00
Richard W.M. Jones
7a9f9b7cdc builder: ppc64: Enable virtio-scsi in templates.
Workaround for dracut bug RHBZ#1396217.
2016-11-30 14:21:13 +00:00
Richard W.M. Jones
65a0570385 builder: Rearrange how template-building scripts work.
Create a new directory (builder/template).  Integrate all of the
scripts into a single program, so that templates are generated more
consistently.

This also changes how the index file is generated.  The script now
generates the index file fragment and saves it under version control,
and then generates the final index file by concatenating these.
(Previously the index was written by hand which was tedious and
error-prone.)

The new script also saves the generated kickstart under version
control so it can be referenced later.
2016-11-30 14:20:20 +00:00
Richard W.M. Jones
06dc0e52eb Revert "builder: ppc64, ppc64le: Force add virtio-scsi driver."
It turns out that adding the virtio-scsi driver does not help
to fix the dracut problem.

This partially reverts commit f766c84c39,
keeping the change to index.
2016-11-24 18:46:26 +00:00
Richard W.M. Jones
f766c84c39 builder: ppc64, ppc64le: Force add virtio-scsi driver.
Works around dracut bug RHBZ#1396217.

Also update new Fedora ppc64 & ppc64le images.
2016-11-24 17:25:33 +00:00
Richard W.M. Jones
0cd54ff45b builder: Add Fedora 25 templates. 2016-11-24 10:35:45 +00:00
Richard W.M. Jones
bad1059bc4 fish: Fix small typos in virt-copy-in and virt-copy-out man pages (RHBZ#1398070).
Thanks: Xianghua Chen
2016-11-24 09:53:10 +00:00
Richard W.M. Jones
0ae56ad711 builder: fedora-armv7l: Increase RAM for installation.
In Fedora 25 the guest runs out of RAM when loading the
Anaconda initramfs.
2016-11-24 09:52:17 +00:00
Richard W.M. Jones
f45d9d3cd2 builder: fedora-ppc64le: Require POWER8 CPU.
This is the same as commit 4919f4f740
for Fedora.
2016-11-23 22:01:57 +00:00
Richard W.M. Jones
6c50cfd464 builder: fedora-aarch64: Add --arch flag.
This is the same thing as
commit 4a5605e7be, but for Fedora.
2016-11-23 21:57:02 +00:00
Richard W.M. Jones
4919f4f740 builder: ppc64le: Require POWER8 CPU.
RHEL 7.3 requires POWER8 instructions.
2016-11-17 14:51:10 +00:00
Richard W.M. Jones
4a5605e7be builder: aarch64: Add --arch flag.
This allows us to cross-build the image from x86_64 which is
more convenient than doing it on aarch64 host.
2016-11-17 14:51:10 +00:00
Richard W.M. Jones
c08788ef1b filearch: Add s390 and s390x detection and tests.
Unfortunately I was unable to build s390 binaries since multilib was
dropped in Fedora 24 on s390x.  Going from the source of the 'file'
command it seems as if it prints "32-bit" (the architecture is really
31 bit).
2016-11-13 18:32:21 +00:00
Richard W.M. Jones
6d805f3b33 docs: Fix man pages references to incorrect section numbers. 2016-11-13 18:32:21 +00:00
Richard W.M. Jones
fc73cdc014 Fix HACKING file in top level directory. 2016-11-13 18:28:38 +00:00
Richard W.M. Jones
cf0967542f installcheck: p2v: Make virt-p2v binary executable after uncompressing it.
Fixes commit 4152388530
and commit face52f62e.
2016-11-10 11:39:43 +00:00
Matteo Cafasso
5d36f5ae82 upload: improve file write callback
As noted by Pino in another patch, the logic passes the first member of
the struct which happens to be the right address to the callback
function.

This will break the callback if order of the members of the struct will
change.

As the callback is using the entire struct, better to pass the pointer
to the struct itself.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-11-09 21:09:24 +00:00
Richard W.M. Jones
4152388530 installcheck: p2v: Fix tests of virt-p2v.
Fixes commit face52f62e.
2016-11-09 17:54:52 +00:00
Pino Toscano
086be00aca v2v: add "colours-option" to machine readable sample output (RHBZ#1390876) 2016-11-02 11:00:39 +01:00
Pino Toscano
49dd176974 builder: distribute fedora-s390x.sh
Followup of commit c25a898710.
2016-11-02 11:00:39 +01:00
Richard W.M. Jones
0acdc83736 v2v: glance: Set hw_video_model property to qxl|cirrus (RHBZ#1374651).
Thanks: Vladik Romanovsky, Ming Xie.
2016-11-01 17:24:19 +00:00
Pino Toscano
1c51773b09 v2v: update again URL with glance metadata
Finally got the (hopefully stable) right URL for them.
2016-11-01 18:15:25 +01:00
Richard W.M. Jones
c25a898710 builder: Add script for starting Fedora/s390x.
However it does not currently work because of a bug in libvirt:

https://bugzilla.redhat.com/show_bug.cgi?id=1376547
2016-11-01 11:50:22 +00:00
Richard W.M. Jones
c7ce5e47fa handle: Improve error messaging if XDG_RUNTIME_DIR path does not exist.
If an environment variable such as XDG_RUNTIME_DIR or one of the
tmpdirs or cachedir is set to a non-existent directory, improve the
error message that the user will see so that (where possible) it
includes the environment variable or API call.

This is still not bullet-proof because it's hard to display the
environment variable if it is LIBGUESTFS_TMPDIR or
LIBGUESTFS_CACHEDIR, but the main problem is with XDG_RUNTIME_DIR
(because of systemd bugs).

Thanks: Hilko Bengen for identifying the bug.
2016-11-01 10:20:28 +00:00
Pino Toscano
a8b206234c docs: fix link to guestfs-golang(3) 2016-10-31 13:08:40 +01:00
Hilko Bengen
eecb1d8177 run.in: Quote contents of @VAR@ substitutions 2016-10-27 21:35:57 +02:00
Richard W.M. Jones
d411cd6127 Version 1.35.14. 2016-10-25 22:53:15 +01:00
Richard W.M. Jones
e73763de1f docs: Ignore ruby/ext/guestfs/extconf.h
Updates commit bd21993d77.
2016-10-25 22:30:30 +01:00
Richard W.M. Jones
67cc867da8 docs: Ignore php/extension/config.h.
Updates commit bd21993d77.
2016-10-25 21:59:19 +01:00
Richard W.M. Jones
7d85796466 Version 1.35.13. 2016-10-25 21:43:32 +01:00
Richard W.M. Jones
4f3269ac23 docs: Ignore java/com_redhat_et_libguestfs_GuestFS.h
Updates commit bd21993d77.
2016-10-25 21:37:37 +01:00
Richard W.M. Jones
d76d916501 Version 1.35.12. 2016-10-25 21:19:18 +01:00
Richard W.M. Jones
0875989384 docs: Ignore more generated headers.
Updates commit bd21993d77.
2016-10-25 21:12:56 +01:00
Richard W.M. Jones
959ed964b8 Version 1.35.11. 2016-10-25 20:49:21 +01:00
Richard W.M. Jones
7855c8e4a8 docs: Ignore errnostring.h files too.
Updates commit bd21993d77.
2016-10-25 20:42:40 +01:00
Richard W.M. Jones
f68388eec5 Version 1.35.10. 2016-10-25 20:02:59 +01:00
Richard W.M. Jones
bd21993d77 docs: Remove builder/index-parse.h from documented files.
Breaks things when building from clean.
2016-10-25 19:14:06 +01:00
Richard W.M. Jones
0e1f8c4de7 p2v: Add dbus dependency to dependencies.m4.
Probably not necessary since dbus is part of most base distros, but
added for completeness.

Fixes commit 54979e8842.
2016-10-25 19:05:15 +01:00
Richard W.M. Jones
851f1771bc docs: Document some more internal library structs. 2016-10-25 15:47:39 +01:00
Richard W.M. Jones
4d535c7038 docs: internal: Allow headers and structs to be documented.
This makes a number of small changes to how the internal documentation
is generated and what can be documented.

Header files are now permitted to contain internal documentation.
This works in the same wasy as .c files.

Also documentation can be added for structs as well as functions.

This commit also adds documentation to some header files and structs,
and fixes a few places which contained broken header documentation.
2016-10-25 13:38:01 +01:00
Richard W.M. Jones
8823247bd5 docs: building: Document additional deps needed to build from git.
Also document the gettext (C library) dependency which was missing.
2016-10-25 11:57:47 +01:00
Richard W.M. Jones
54979e8842 p2v: Inhibit power saving during the conversion.
We do this by sending an Inhibit() message to logind and receiving a
file descriptor back, which we hold open until the conversion
completes (or fails).  This is described here:
https://www.freedesktop.org/wiki/Software/systemd/inhibit/

This adds an additional optional dependency on DBus since we use DBus
to call the Inhibit() method.

Reported-by: Chris Cowley.
2016-10-25 10:54:31 +01:00
Pino Toscano
75fbe4511e builder: consolidate handling of temporary files/dirs
Create a single temporary directory for all the files created during the
virt-builder run (except big disk images, which already use the
libguestfs cache directory).  A single directory means there is no need
to manually schedule all the temporary files and directories for removal
when the application quits.
2016-10-25 10:15:04 +02:00
Pino Toscano
0a5954f4f7 mllib: curl: add optional tmpdir parameter
Add a new optional parameter for the Curl ADT, so temporary files can be
created in a specified directory (which is supposed to be temporary, and
disposed only when the application quits).
2016-10-25 10:15:04 +02:00
Richard W.M. Jones
79e9c87d56 customize: Check SLOW flag is set before running password tests.
Fixes commit 2f57eb181f.

Thanks: Pino Toscano for finding the bug and suggesting the fix.
2016-10-24 15:56:57 +01:00
Pino Toscano
ab8007ecda inspect: map "sled" in /etc/os-release as "sles" distro
Map SLED as "sles" when parsing /etc/os-release, just like it is done
already when using /etc/SuSE-release.

Thanks to Cédric Bosdonnat for testing.
2016-10-21 16:53:12 +02:00
Richard W.M. Jones
7822d4dccb FAQ: Document how to switch kernel and qemu. 2016-10-21 12:30:56 +01:00
Richard W.M. Jones
1d5cd15e3a Version 1.35.9. 2016-10-20 18:27:02 +01:00
Richard W.M. Jones
2f57eb181f customize: Test that the --root-password parameter works.
Add a slow test to ensure that the --root-password option
doesn't regress.
2016-10-20 13:50:50 +01:00
Richard W.M. Jones
05f201a6e6 builder: Add test that a serial console is set up for guest templates we supply. 2016-10-19 14:50:36 +01:00
Richard W.M. Jones
a01c828f0c builder: Add virt-builder --notes for enabling serial console.
On debian-8 and ubuntu-16.04.
2016-10-19 14:50:36 +01:00
Richard W.M. Jones
fc35cfe361 builder: Allow test-virt-builder-planner to be skipped. 2016-10-19 12:19:44 +01:00
Richard W.M. Jones
8d19c1a08f customize, v2v: Use script name instead of $0 in test-*-<guestname>.sh scripts.
$0 is set to the name of the test script, eg. test-settings.sh, and in
bash there is no way to change that.

Create a new environment variable, $script, which is set to the name
of the wrapper script (eg. test-settings-fedora-24.sh).

This should give more accurate error messages.
2016-10-19 12:19:43 +01:00
Richard W.M. Jones
d61e9df151 Add a test for virt-tail. 2016-10-12 13:49:46 +01:00
Richard W.M. Jones
8b076d87a1 New tool: virt-tail.
This follows (tails) a log file within a guest, rather like
the regular 'tail -f' command.  For example:

  virt-tail -d guest /var/log/messages
2016-10-12 13:49:46 +01:00
Richard W.M. Jones
19332919a2 p2v: Fix virt-p2v-make-kickstart for new location of virt-p2v.xz.
Fixes commit face52f62e.
2016-10-12 13:49:46 +01:00
Richard W.M. Jones
bb782a9dd5 Version 1.35.8. 2016-10-11 19:05:22 +01:00
Richard W.M. Jones
d6c42a6c58 valgrind: Don't use "nested" run scripts.
When TESTS_ENVIRONMENT already uses 'run', the VG variable
doesn't also need to use 'run'.

The specific problem is that if the command contains newlines
then double invocations of the 'run' script fails (in libtool).
ie the following command failed causing errors in check-valgrind:

  $VG virt-builder phony-fedora \
      -v --no-cache --no-check-signature $no_network \
  ...
      --write '/etc/append4:line1
  ' \
  ...
2016-10-11 18:08:49 +01:00
Richard W.M. Jones
9bcdffc2bb Version 1.35.7. 2016-10-11 14:19:08 +01:00
Richard W.M. Jones
4c8fc40d66 p2v: Fix EXTRA_DIST.
Fixes commit face52f62e.
2016-10-11 14:17:06 +01:00
Richard W.M. Jones
face52f62e p2v: Compress virt-p2v binary and store it in $libdir/virt-p2v (RHBZ#1382275).
Currently 'make install' installs the virt-p2v binary in
/usr/libexec/virt-p2v on the host.  It is never supposed to be run
from there, even by another program, so use of /usr/libexec is
incorrect.  It is only supposed to be copied into USB keys / ISOs /
etc created by virt-p2v-make-* scripts.

The other problem with shipping a "naked" binary on the host is that
packages built from that get all the dependencies of virt-p2v, for
example Gtk.  This is unnecessary just for running the command line
scripts mentioned above.

This changes the Makefile and scripts so that the binary is stored
compressed in $libdir/virt-p2v/virt-p2v.xz.  It is compressed to avoid
exposing the dependencies.  It is stored under $libdir since the
binary is still architecture-dependent.

A further change is that when we copy the binary into the virt-p2v
ISO, it is now installed in /usr/bin instead of /usr/libexec.  (And
note that we always use /usr/bin, not $bindir, since this path should
not need to be affected by the configuration of libguestfs).
2016-10-11 13:43:12 +01:00
Tomáš Golembiovský
2bed3e4801 appliance: add/remove some packages for Arch Linux
Added:
- cdrtools: added as alternative to cdrkit
- multipath-tools: contains kpartx (in AUR)

Removed:
- ntfsprogs: the package is no longer available, it has been completely
  replaced by ntfs-3g (already in packagelist.in)
- zfs-fuse: no longer in AUR

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-10-11 13:17:25 +01:00
Richard W.M. Jones
d9b2a16c71 v2v: ova: Make OVA directory public readable to work around libvirt bug (RHBZ#1375157).
Only do this if running as root and if the backend is set
to libvirt.
2016-10-11 10:48:24 +01:00
Richard W.M. Jones
9ab8b1bebd launch: libvirt: Remove unused USB and memballoon devices.
Thanks: Laine Stump.

See also:
https://www.redhat.com/archives/libvir-list/2016-October/msg00246.html
2016-10-11 10:39:02 +01:00
Tomáš Golembiovský
d0c86f287d v2v: test Debian/Ubuntu conversion
Enable testing of Debian and Ubuntu guest conversion.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-10-07 16:54:58 +02:00
Pino Toscano
162fe71b8d v2v: linux: enable conversion of Debian guests
A basic conversion of Debian-based guests works now; it needs more
thorough testing for all the operations done with different sources.
2016-10-07 14:55:51 +02:00
Tomáš Golembiovský
52a8202635 v2v: ova: support SHA256 hashes in manifest
The OVF standard allows the use of SHA256 hashes in the manifest file.
Adding support for this.

One of the tests was updated to put SHA256 into manifest file.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-10-07 14:33:48 +02:00
Tomáš Golembiovský
6b7ea3c681 v2v: ova: fix checking of the manifest file
The regular expression for parsing the manifest line was wrong. There is
a mandatory space between '=' and the hash.

Another problem was that only the first line of the manifest file was
actually processed.

Also added some debugging info and warning to catch problems with
parsing.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-10-07 14:33:44 +02:00
Pino Toscano
b9f6eb5132 po: manually update POTFILES-ml
Followup/fix of commit 5681db5ed8 and
commit 7a09db5e48.
2016-10-06 09:22:51 +02:00
Pino Toscano
be8ad60b8e v2v: linux: try to fix removal of VMware tools
Try to improve the way packages of VMware tools are removed from
YUM-based guests:

- when filtering the package itself from its providers, do a stricter
  check so either the provide is the unversioned package, or it is
  exactly its own name

- if the package has no other providers, then going further will cause
  the invocation of 'yum install' with no packages, and thus the package
  itself will not be added to the list of packages to be removed; to
  overcome this issue, just mark the package as "to be removed" in that
  case

Related to: RHBZ#1155150
2016-10-04 14:45:18 +02:00
Pino Toscano
664842763c v2v: linux kernels: remove unused parameter
Remove an unused paramter of the internal check_config function.

Followup of commit 7eb219d193.
2016-10-04 09:40:54 +02:00
Richard W.M. Jones
ca4a679400 appliance: Add ExFAT packages.
Thanks: Miles Wolbe
2016-10-03 14:06:15 +01:00
Pino Toscano
7eb219d193 v2v: linux: check also kernel config for modules
When checking whether a kernel supports virtio or it is Xen-based, it is
assumed that the feature has the kernel module for it; this will fail if
the feature is built-in in the kernel, misrepresenting it.

The solution is to check the kernel configuration whether the feature
is built-in, in case there is no module available.

This fixes the virtio detection on Ubuntu kernels, where virtio is
built in and not as module.
2016-10-03 14:33:20 +02:00
Pino Toscano
52b63e6b33 v2v: linux kernels: detect config file
Add a simple detection for the config file of each kernel, so that can
be used later to get more information on what a kernel provides.
2016-10-03 14:33:20 +02:00
Pino Toscano
19b7495d46 v2v: bootloaders: improve detection of Grub2 default method
Detect only once which method must be used to get and set the default
Grub2 kernel in the guest: this avoids the same checks in list_kernels
and set_default_kernel.

Also, add a "no method" option as well: Debian/Ubuntu guests do not have
neither grubby nor Perl's Bootloader::Tools, so there is no way to know
what is the default kernel, nor to change it.  In this case, add a
warning about this situation.
2016-10-03 14:33:20 +02:00
Pino Toscano
d3736eb0a3 v2v: linux kernels: set type of 'g'
Make sure the type checker can detect the real type of 'g', even when
adding more code using it in detect_kernels.
2016-10-03 10:47:18 +02:00
Pino Toscano
b548c41951 v2v: -i ova: use Checksums
Make use of the Checksums module to ease the verification of the SHA1
checksums in manifests.
2016-10-03 10:41:26 +02:00
Pino Toscano
484c64c29f mllib: add SHA1 support in Checksums
This way Checksums can be used in v2v.
2016-10-03 10:41:26 +02:00
Pino Toscano
a58dff49c5 mllib, builder: add and use Checksums.of_string
Add a simple way to turn a combination of checksum type and value into a
csum_t.  Use it in builder, even if still constrained.
2016-10-03 10:41:26 +02:00
Pino Toscano
7a09db5e48 mllib: move Checksums from builder
Move the Checksums module from virt-builder mostly as it is; the only
change is that on checksum mismatch an exception is raised rather than
invoking "error" directly: this way users of verify_checksum &
verify_checksums can do their own handling of the situation.
2016-10-03 10:41:26 +02:00
Richard W.M. Jones
5681db5ed8 customize: Add --append-line.
This appends a single line to a file, with some cleverness
involving guessing the right line endings to use.

Also adds a test.
2016-10-01 13:08:32 +01:00
Richard W.M. Jones
a31f657db0 daemon: Choose /usr/sbin first for the daemon (debian bug 838995).
Debian is also doing a UsrMove/UsrMerge:
https://wiki.debian.org/UsrMerge

However it is not finalized that Debian will actually make this
change.

Since some Debian systems have /sbin as a symlink and other have /sbin
as a real directory, and we should avoid choosing a symlinked
directory for the daemon, the easiest fix is simply to probe /usr/sbin
before /sbin since under all scenarios (and Fedora too) /usr/sbin is a
real directory.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838995
2016-09-28 11:06:09 +01:00
Pino Toscano
7f236d2201 p2v: add mnemonics to labels and buttons (RHBZ#1379289)
Set mnemonics for all the labels with a text entry or combo box next to
them, and for all the buttons, and check boxes.
2016-09-26 16:04:10 +02:00
Pino Toscano
e3f681e1b8 tools: build common fish sources in a static library
Create a new libfishcommon convenience static library to build just once
(instead of 12 times!) the majority of the guestfish sources used in the
rest of the C tools (mostly for command line stuff, inspection, and
mount).

The notable exceptions not using libfishcommon are guestfish itself, and
virt-rescue: both need to build at least one of the common sources using
additional CPPFLAGS.
2016-09-26 14:16:44 +02:00
Pino Toscano
23ca442f63 fish, inspector: get rid of COMPILING_VIRT_INSPECTOR
All the define was doing in options.h was masking the declaration of
inspect_mount_root, which was always built-in in inspect.c (because of
the unconditional #define there) anyway.

Since this is common code used by all the C tools, try to avoid extra
knobs which add different code paths for no benefit.
2016-09-26 11:45:07 +02:00
Pino Toscano
284c6e1078 build: remove extra libconfig linkage
Some of the C tools were building also config.c as part of the shared
sources from guestfish, and thus bringing a dependency on libconfig.
Since none of them actually read the libguestfs configuration at all,
then exclude fish/config.c from their build, and stop linking to
libconfig.
2016-09-26 11:13:17 +02:00
Pino Toscano
f057086b60 dib: use remove_duplicates instead of own code
Use a common function to remove duplicates in an unsorted list.

Just refactoring, with no behaviour change.
2016-09-23 17:43:07 +02:00
Pino Toscano
d7551ec39b mllib: move remove_duplicates from v2v
Simple code motion.
2016-09-23 17:40:09 +02:00
Richard W.M. Jones
b5d57baf3d Version 1.35.6. 2016-09-23 10:33:20 +01:00
Tomáš Golembiovský
967280566d v2v: linux: correctly reconfigure the initrd on Debian
Using update-initramfs is the native way of updating initrd on Debian
based systems.

To add some modules to the image we can list them in file
/etc/initramfs-tools/modules.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-09-22 18:41:16 +02:00
Pino Toscano
4c3968f262 libvirt: read disk paths from pools (RHBZ#1366049)
A disk of type 'volume' is stored as
  <source pool='pool_name' volume='volume_name'/>
and its real location is inside the 'volume_name', as 'pool_name': in
this case, query libvirt for the actual path of the specified volume in
the specified pool.

Adjust the code so that:
- for_each_disk gets the virConnectPtr, needed to do operations with
  libvirt
- when extracting the disk filename depending on the type, the code
  snippet doing it can directly set 'filename', without setting an XPath
  result variable

Only file-based volumes are supported for now; more types can be added
(with proper testing) later on.
2016-09-22 17:36:09 +02:00
Richard W.M. Jones
a4adf48915 v2v: Support <listen type='socket'> and <listen type='none'> (RHBZ#1378022).
Since libvirt 2.0.0, these two new <listen/> types have been
supported: https://libvirt.org/formatdomain.html#elementsGraphics

This change just copies that configuration over from the source to the
destination if the destination is also libvirt.

Since we previously used 'LNone' to mean "no parseable <listen/>
element" I also had to change previous uses of 'LNone' to 'LNoListen',
so we can use 'LNone' to mean "<listen type='none'>".

Thanks: Ming Xie.
2016-09-21 14:03:23 +01:00
Matteo Cafasso
79fdc9ad47 find_inode: added API tests
NTFS file system always has the MFT file at inode 0. This reliable
information helps testing the API.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-09-19 19:53:07 +02:00
Matteo Cafasso
9eb21ca54a New API: find_inode
Library's counterpart of the daemon's internal_find_inode 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_find_inode command.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-09-19 19:53:07 +02:00
Matteo Cafasso
eccce186a3 New API: internal_find_inode
The internal_find_inode command searches all entries referring to the
given inode and returns a tsk_dirent structure for each of them.

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-09-19 19:53:07 +02:00
Matteo Cafasso
76a2bdd0f1 lib: logic refactoring
Code changes in preparation for new APIs.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-09-19 19:53:07 +02:00
Pino Toscano
6b26a0cce4 OCaml tools: add crypto support (RHBZ#1362649)
Make use of the additional command line arguments, and API needed to
decrypt LUKS partitions.

This affects only virt-customize, virt-get-kernel, virt-sparsify, and
virt-sysprep, as they are the main OCaml tools interacting with
user-provided images.
2016-09-19 19:49:51 +02:00
Pino Toscano
5281e08802 mllib: expose disk decrypt functionalities
Expose via Common_utils the C functions & variables (part of guestfish)
that handle decryption of LUKS partitions, and the additional command
line arguments to tune the way they work.  This way it will be easy to
provide (basic) crypto support also in OCaml-based tools.

Related to: RHBZ#1362649
2016-09-19 19:49:51 +02:00
Pino Toscano
0920b805fd fish: move disk decryption helpers in own file
This way it is easier to use them outside the rest of the code in
guestfish for inspection & mount.

Just code motion, no behaviour changes.
2016-09-19 14:48:19 +02:00
Richard W.M. Jones
21a201051d p2v: Add C<...> around XTerm button string.
Thanks: Pino Toscano.

Fixes commit 2e9d058881.
2016-09-19 12:54:13 +01:00
Richard W.M. Jones
2e9d058881 p2v: Update virt-p2v docs to describe XTerm button (RHBZ#1377081).
Thanks: Tingting Zheng.

Fixes commit bf434bdb35.
2016-09-19 12:32:31 +01:00
Matteo Cafasso
a1b5bbfced daemon: refactor tsk code
Refactor logic in preparation for new APIs.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-09-19 11:12:48 +02:00
Matteo Cafasso
011f29f506 filesystem_walk: fixed root inode listing
With the current implementation, the root inode of the given partition
is ignored.

The root inode is now reported. Its name will be a single dot '.'
reproducing the TSK API.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-09-19 11:12:42 +02:00
Richard W.M. Jones
59999f055b filearch: Return 'i386' instead of 'i486' (as documented).
And some incidental code refactoring.
2016-09-15 16:07:57 +01:00
Richard W.M. Jones
7907abcdc0 filearch: Add architectures missing from the documentation.
Updates commit 68d9b04735
and commit 33d2b4a734.
2016-09-15 16:07:57 +01:00
Richard W.M. Jones
536338ee93 filearch: Sort architectures into alphabetical order in documentation. 2016-09-15 16:07:57 +01:00
Tomáš Golembiovský
85327319ad v2v: linux: detect name of grub2-mkconfig
On Debian family of OSes Grub2 tools are prefixed with 'grub-', not with
'grub2-'. We have to detect the correct name of the tool to use it.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-09-15 16:21:43 +02:00
Richard W.M. Jones
c3bbd129ab Add riscv64 test binaries, and new tests of guestfs_file_architecture. 2016-09-15 15:19:11 +01:00
Richard W.M. Jones
68d9b04735 filearch: Add RISC-V architecture. 2016-09-15 15:19:11 +01:00
Pino Toscano
775e9cbd2a v2v: -o libvirt: always write pool names (RHBZ#1141631)
When creating the XML for the new guest, always put the name of the pool
containing the disks, even when -os specified a pool UUID: libvirt does
not handle pool UUIDs for storage, but only names.
2016-09-15 13:46:25 +02:00
Pino Toscano
f4ca4de207 v2v: -o glance: log glance client version in verbose mode
When running in verbose mode for debugging, run `glance --version` to
print the version of the glance client.  This helps when dealing with
failures, or making its output actionable.
2016-09-14 09:59:12 +02:00
Pino Toscano
04fe77c519 v2v: -i libvirtxml: tweak warning message
Use a placeholder for the type of disk, so the message becomes exactly
like another warning message used already in this function.
2016-09-14 09:56:04 +02:00
Pino Toscano
1497a9f722 v2v: -o glance: set all properties during creation (RHBZ#1374405)
The glance client v1.0.0 defaults to the Image v2 API: this means that
an image can be referenced only by its UUID, and not anymore by the name
as well (which does not need to be unique).  This caused our glance
invocation to set the properties for the newly created image to fail,
since we are using the name as identifier.

Instead of first creating the image and then setting all the properties
for it, set all the properties when creating the image: other than being
simpler, it also avoid parsing the output of the 'glance image-create'
command for the UUID ('id') of the image.
2016-09-13 16:31:27 +02:00
Richard W.M. Jones
5714439d94 perl: Guestfs.c file is not translatable, don't include it in po/POTFILES.
Reported by Nikos Skalkotos
https://aur.archlinux.org/packages/libguestfs/
2016-09-13 15:27:29 +01:00
Richard W.M. Jones
65e1c66bb9 Version 1.35.5. 2016-09-09 17:46:23 +01:00
Richard W.M. Jones
089f54b0d3 v2v: linux: Use /etc/modprobe.conf.local if it exists.
On SUSE (only) there is /etc/modprobe.conf which is generated from a
/usr/share file.  Local changes are meant to be added to
/etc/modprobe.conf.local.
2016-09-09 17:07:34 +01:00
Richard W.M. Jones
0e1b1ccfb2 v2v: linux: Avoid recursive functions.
Just code motion.
2016-09-09 17:07:34 +01:00
Richard W.M. Jones
15661d8760 v2v: linux: Don't use duck typing in interface of Linux_kernels.
On reflection we want the precise bootloaders type, not some other
object that happens to implement a #list_kernels method.

Fixes commit 2d7fa1db6a.
2016-09-09 17:07:34 +01:00
Richard W.M. Jones
2d7fa1db6a v2v: linux: Move kernel detection to a separate module.
Create a new module [Linux_kernels] which does all kernel detection,
and also provides a place to define the kernel_info data structure.

This is essentially just code motion.
2016-09-09 16:59:28 +01:00
Richard W.M. Jones
171bc5374e v2v: utils: Move external functions together.
Just a small code movement.
2016-09-09 16:09:39 +01:00
Richard W.M. Jones
b7a8247b5a v2v: Move xpath* functions to new module Xpath_helpers.
Just code motion.
2016-09-09 16:09:39 +01:00
Richard W.M. Jones
1ec78f34d8 v2v: Split up 'amend_source' function.
Just code motion.
2016-09-09 16:09:39 +01:00
Richard W.M. Jones
98619f9c26 v2v: -i ova: Derive the name from the OVA filename.
If the guest has no <Name> element in the OVF, previously we chose
"default" as the name.  This changes that so it uses a name derived
from the basename of the OVA file instead.

For example:

  virt-v2v -i ova /path/to/myguest.ova [...]

would use "myguest" as the name (assuming no <Name> was present).

Modifies the behaviour of
commit 1ae4252c93.
2016-09-09 16:09:39 +01:00
Richard W.M. Jones
312379c8a6 v2v: -i disk: Move code that creates name from disk to separate module.
Simple code motion.
2016-09-09 16:09:39 +01:00
Pino Toscano
8335af37fa tests: do not assume '.' is in Perl's @INC
Upstream Perl is going to remove '.' from @INC (the include path for
modules) by default for the next major release (= 5.26) [1], as measure
to fix security issues.  Debian already started backporting the fixes
for this [2], thus behaving this way in current Sid installations.

Since the affected Perl sources are only the local daemon testing
scripts, a simple fix is to force the 'requires' for the local
captive-daemon.pm module to start from the current directory: this way
there is no need to manually augment @INC, and only our local module is
loaded automatically.

[1] https://rt.perl.org/Public/Bug/Display.html?id=127810
[2] https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html
2016-09-09 14:42:05 +02:00
Richard W.M. Jones
839fe4997b daemon: Use reply_with_error instead of *_perror for setfiles command.
Fixes commit 9d205f1c28.
2016-09-09 08:59:46 +01:00
Shahar Havivi
1ae4252c93 virt-v2v: Support for ova exported from AWS (RHBZ#1371843).
1. AWS the name tag is not mandatory - using default as a name
2. AWD doesn't prefix 'ovf:' as prefix to disk path

There is an open bug for oVirt:
https://bugzilla.redhat.com/show_bug.cgi?id=1371843

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
2016-09-08 10:24:56 +01:00
Pino Toscano
12c605f8fa daemon: drop program_name definition
It was previously needed by the 'error' module of gnulib; recent
versions are able to get the name of the current program on their own.
2016-09-08 09:57:15 +02:00
Pino Toscano
eea210dbf7 Use the getprogname gnulib module
Make use of the recently added 'getprogname' module in gnulib: replace
our guestfs_int_program_name with the getprogname() provided by the
module, since it does the same thing, and in a portable way.
As consequence of the above, use gnulib in a couple of tests that use
getprogname().

Since guestfs_int_program_name is gone, drop the configure checks
associated with it.
2016-09-08 09:57:15 +02:00
Pino Toscano
1f65143a42 Update gnulib to latest 2016-09-08 09:57:14 +02:00
Pino Toscano
03032e2419 tests: make test-noexec-stack.pl work in non-English locales
Set C as language when running the script, as the output of readelf is
parsed: this way the parsing works also when the system locale is not
English.
2016-09-08 09:57:14 +02:00
Richard W.M. Jones
be737c9574 Version 1.35.4. 2016-09-02 23:32:01 +01:00
Richard W.M. Jones
c4b7b5d615 erlang: Split up large Erlang extension into smaller C files.
Reduce build times in this directory from about 10s to about 2s.
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
76eee79a65 java: Split up large Java extension into smaller C files. 2016-09-02 23:14:08 +01:00
Richard W.M. Jones
63db9ae81f python: Split up large Python extension into smaller C files.
Reduces build time in this directory from 11s to 3s.
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
d95f1d7102 build: Check generated files are included in the tarball.
When running 'make maintainer-check-extra-dist', check also that all
generated files are included in the tarball.  This is done so that end
users will not need OCaml to compile from tarball releases.
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
20aa0f6496 ruby: Split up large Ruby extension into smaller C files. 2016-09-02 23:14:08 +01:00
Richard W.M. Jones
20f190617a daemon: Split up very large daemon/stubs.c file. 2016-09-02 23:14:08 +01:00
Richard W.M. Jones
a749b5d93a fish: Split up the very large fish/cmds.c file.
Make parallel compiles faster in this directory (about 8s down to 3s).
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
4730f4a918 generator: Generalize the code used to split actions across files.
Previously we used an awkward hack to split up the large src/actions.c
into smaller files (which can benefit from being compiled in
parallel).  This commit generalizes that code, so that we pass a
subsetted actions list to certain generator functions.

The output of the generator is identical after this commit and the
previous commit, except for the UUID encoded into tests/c-api/tests.c
since that is derived from the MD5 hash of generator/actions.ml.
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
f8978239e3 generator: Move all actions into a single list and add filter functions.
This mostly mechanical change moves all of the libguestfs API
lists of functions into a struct in the Actions module.

It also adds filter functions to be used elsewhere to get
subsets of these functions.

Original code         Replacement

all_functions         actions

daemon_functions      actions |> daemon_functions
non_daemon_functions  actions |> non_daemon_functions
external_functions    actions |> external_functions
internal_functions    actions |> internal_functions
documented_functions  actions |> documented_functions
fish_functions        actions |> fish_functions

*_functions_sorted    ... replacement as above ... |> sort
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
71a95becbd generator: Add |> (revapply) operator for compat with OCaml < 4.01. 2016-09-02 23:14:08 +01:00
Richard W.M. Jones
13e47b1218 customize: Add a slow test of --hostname and --timezone settings.
Run these in real guests to ensure they really work.
2016-09-02 23:14:08 +01:00
Richard W.M. Jones
cbb70f1dee customize: Update "unassigned-hostname" etc in Debian/Ubuntu /etc/hosts (RHBZ#1372269).
Commit ab2df2e659 attempted to rewrite
/etc/hosts if it contained the old hostname.

However this wasn't done reliably for a couple of reasons:

(1) Certain Debian/Ubuntu /etc/hostname contains
"localhost.localdomain" but still has "unassigned-hostname" or
"unassigned-hostname.unassigned-domain" in /etc/hosts.

(2) Even if (1) doesn't apply, you still need to split out the
hostname and domainname parts and deal with them separately.
2016-09-02 23:14:08 +01:00
Pino Toscano
e6d9c1b328 build: improve distro check
Use /etc/os-release as first option, translating the distro name to the
current identifier used.  The other options (the release files) are left
as following checks, avoiding them if any matches.
2016-09-02 16:26:38 +02:00
Richard W.M. Jones
56e566af38 v2v: Don't remove Processor and Intelppm nodes (RHBZ#1372668).
Don't remove the Processor and Intelppm nodes since that just breaks
the device driver.

The only remaining node being removed by the original code was
"rhelscsi" (the xenpv-win driver).  I changed this so that instead of
deleting the whole node, it simply disables that driver.  If you look
at RHBZ#737600, it's not even clear that deleting nodes was the right
fix for anything.  I also renamed the function.

Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2016-09-02 14:01:49 +01:00
Richard W.M. Jones
97cbddac12 build: In silent rules, differentiate between .cmi and ocamlc.
Although we happen to use 'ocamlc' to compile .mli files to .cmi,
it is used in a different mode from bytecode compilation.
2016-09-02 12:40:12 +01:00
Roman Kagan
09eb831e8d v2v:windows: prevent conflicts with PnP on firstboot
When put on new virtual hardware Windows will start driver installation
for newly discovered devices.

The problem is that it happens asynchronously and concurrently with
other activities, in particular, the firstboot scripts.  This may result
in conflicts (because a firstboot script may want to install or
uninstall a driver, etc.) and eventually in the system left in
inconsistent state.

In order to prevent it, add another firstboot script which calls a
special utility, pnp_wait, whose sole purpose is to wait until all
PnP-related activities are finished.  (It does so via a WinAPI call
which isn't available from a script so it has to be a compiled .exe.
The source code for it can be found in the corresponding directory in
https://github.com/rwmjones/rhsrvany).  This firstboot script is put
first, so that other firstboot scripts do not have to worry about
interactions with PnP manager any more.

One caveat is that on Windows XP and Windows 2003 the PnP manager always
fires the "Found New Hardware" wizard, which doesn't allow PnP to make
any progress until the user closes it.  As a result, this firstboot
script would never finish.

To work it around, follow the Microsoft KB
(https://support.microsoft.com/en-us/kb/938596) and set up a registry
key to make the the PnP manager not fire the wizard; the key is restored
to its initial state upon PnP completion.  Unfortunately this only works
on systems having the mentioned update installed; otherwise the user
will have to interact with the UI.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-09-01 11:46:13 +03:00
Roman Kagan
5eb9ea489e v2v:windows: factor out getting CurrentControlSet
It will be used in new code in a followup patch.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-09-01 11:46:12 +03:00
Richard W.M. Jones
ed607984ad Version 1.35.3. 2016-09-01 08:51:06 +01:00
Richard W.M. Jones
2efd8d0b1d v2v: Use a random pool name in the test to avoid conflicts.
If multiple tests (eg. from different branches) are running in
parallel, they will attempt to use and delete the same temporary pool.
Use a random pool name to avoid this.
2016-09-01 08:41:06 +01:00
Richard W.M. Jones
0797427807 valgrind: Add suppression for another --run-libc-freeres=no non-leak. 2016-08-31 23:16:48 +01:00
Richard W.M. Jones
6e547abe43 lib: Fix incorrect example in comment. 2016-08-31 19:36:34 +01:00
Richard W.M. Jones
092ef3234d v2v: xml: Fix misleading error message.
Other functions, such as ``-i ova'', also call Xml.parse_memory.
Therefore the error is not always from XML generated by libvirt, the
XML might be generated from other sources too.

Thanks: Ming Xie.
2016-08-31 11:24:44 +01:00
Richard W.M. Jones
8f6103d87d Version 1.35.2. 2016-08-30 23:04:57 +01:00
Pino Toscano
57c327538e Include <sys/sysmacros.h> for major()/minor()
GNU libc pulls them implicitly from <sys/types.h>, but it will not do
that at some point in the future.  Hence, include <sys/sysmacros.h>
explicitly.
2016-08-29 18:13:57 +02:00
Pino Toscano
f14dd26d36 tests: add rhbz1370424.xml to EXTRA_DIST
Fixes commit 98aa78f288.
2016-08-29 10:18:00 +02:00
Richard W.M. Jones
823ecfef39 v2v: Use separate scripts for the slow tests of real guests.
Following the same style used for the firstboot tests in the
customize/ subdirectory, use a separate test script for each real
guest that we test.  This has two advantages: (a) the tests run in
parallel (and are thus faster) and (b) automake "knows" about each
test and reports the results separately.
2016-08-27 14:07:48 +01:00
Richard W.M. Jones
58c1f7f7e6 customize: Add a slow test that firstboot works on a variety of real guests. 2016-08-27 13:53:14 +01:00
Richard W.M. Jones
c2d21340db customize: Fix firstboot scripts on Debian 6 & 7 (RHBZ#1019388). 2016-08-27 12:59:14 +01:00
Richard W.M. Jones
2e2a0264ae lib: Remove some unnecessary translation of debugging messages. 2016-08-27 12:59:14 +01:00
Richard W.M. Jones
98aa78f288 tests: Add a regression test for RHBZ#1370424.
Regression test for previous commit which just tests that
guestfs_add_domain doesn't assert-fail on guests with no port
attribute.
2016-08-27 12:59:14 +01:00
Richard W.M. Jones
9e7b564fc1 lib: Don't assert fail if port is missing in XML (RHBZ#1370424).
Thanks: Xiaodai Wang
2016-08-27 12:59:14 +01:00
Richard W.M. Jones
43e078abc0 v2v: Use unitless methods for methods which don't change the internal state.
Methods in OCaml which don't take any parameters don't require the
dummy unit arg, ie writing:

  method foo = ...

is fine.  The reason you might need the unit arg is if you need to
create a closure from the method without calling it, for example if
you need to use the method in a callback.

In lablgtk2 the convention is to use unitless methods if either: the
method shouldn't be used as a callback; or: (conceptually) the method
doesn't change the object's internal state.  Let's do that here.
2016-08-26 15:54:04 +01:00
Pino Toscano
7882fb7247 v2v: linux: adapt initrd name for Debian
The name of the initrd image on Debian-based systems is different from
what used on Fedora/RHEL/SUSE and derived; set a different regexp to
avoid making the current regexp even more complex.
2016-08-26 15:22:54 +02:00
Pino Toscano
bb3da3b074 v2v: linux: check the kernel package name for Debian
On Debian-based systems, the kernel packages are named like
"linux-image-$kver", so check for them.
2016-08-26 15:21:34 +02:00
Pino Toscano
03b9f2b967 v2v: add /boot/grub/grub.cfg as Grub2 config
This is the location of the Grub2 configuration in Debian-based systems.
2016-08-26 15:21:34 +02:00
Pino Toscano
bfa2f140d2 v2v: linux: identify Debian-based distros as `Debian_family
Identify these distributions, so it is possible to add specific code
for them.

This does not allow them as supported distributions, yet.
2016-08-26 15:21:34 +02:00
Pino Toscano
0dc0e78340 v2v: add basic support for the "deb" package manager
Implement the 'remove', 'file_list_of_package', and 'file_owner' methods
of the Linux module for the "deb" package manager (dpkg basically, on
Debian and derived distributions).

Also allow it for the main conversion code.
2016-08-26 15:21:34 +02:00
Pino Toscano
dc9e6c39f7 v2v: refactor Linux.remove
Move the actual job in an helper function, so the common bits (like the
check of the size of 'packages' and the reload of Augeas) can be done
for all the package manager implementations.

This should be code motion with no behaviour change.
2016-08-26 15:21:34 +02:00
Richard W.M. Jones
7141afd190 v2v: Use our definitions of iteri and mapi.
OCaml 3.12 (in Debian Wheezy) did not have these functions.
2016-08-26 12:52:27 +01:00
Richard W.M. Jones
bde35ca809 v2v: Small fix to POD documentation for old perl/POD.
Old perl/POD from Debian Wheezy has a bug where <name>NAME</name>
gives the error:

 Unknown E content in E</name>

even though this is in a verbatim section.  Fudge the documentation to
avoid this.
2016-08-26 12:52:27 +01:00
Richard W.M. Jones
619905ac5d builder: Rename cmdline 'ops' field.
In OCaml 3.12, type inference was not as smart and could not use local
information to disambiguate same-named fields in different structures.
The easiest fix for this is just to rename the field so it doesn't
have the same name as a field in the Customize_cmdline.ops struct.
2016-08-26 12:52:27 +01:00
Richard W.M. Jones
2c69865a70 build: Check for minimum version of libvirt in the configure script.
In Debian Wheezy with libvirt 0.9.12.3, HAVE_LIBVIRT was defined, but
HAVE_LIBVIRT_BACKEND was undefined, so src/libvirt-auth.c failed to
compile.

It's easy, and better, to check the minimum version in the configure
script.
2016-08-26 12:15:08 +01:00
Richard W.M. Jones
79e2d44365 docs: Fix release notes, Citrix Xen -> SUSE Xen.
I got the wrong end of the stick.  Cédric tested SUSE Xen,
not Citrix (upstream) Xen.
2016-08-26 10:04:19 +01:00
Richard W.M. Jones
ffa28d8722 Revert "v2v: Citrix Xen has been tested, adapt the documentation"
This reverts commit 68ba0609c7.
2016-08-26 10:04:19 +01:00
Pino Toscano
6f2090099e v2v: factor out bootloader handling
Create an object hierarchy to represent different bootloaders for Linux
guests, moving the separate handling of grub1 and grub2 in different
classes: this isolates the code for each type of bootloader together,
instead of scattering it all around.

This is mostly code refactoring, with no actual behaviour change.
2016-08-26 10:13:33 +02:00
Richard W.M. Jones
5802c7750e mllib: Add String.map function for OCaml < 4.00.0.
String.map was added in OCaml 4.00.0.  However we use this function
to implement String.lowercase_ascii etc.

Therefore include a definition of the function for older versions of
OCaml.  (Debian Wheezy has OCaml 3.12.1.)
2016-08-25 22:44:15 +01:00
Richard W.M. Jones
76c0a67d30 build: Add common CLEANFILES and DISTCLEANFILES to common-rules.mk.
By adding common CLEANFILES and DISTCLEANFILES variables to
common-rules.mk, we can remove these from most other Makefiles, and
also clean files more consistently.

Note that bin_PROGRAMS are already cleaned by 'make clean', so I
removed cases where these were unnecessarily added to CLEANFILES.
2016-08-25 16:54:34 +01:00
Richard W.M. Jones
c39d5e89c3 java: Don't try to set -source 1.5 in options.
There was some code in configure.ac dating back to 2009
(commit b9014d6a0d) which attempted to
add the javac option `-source 1.5'.  I don't think this code ever
worked.

However, if -source 1.5 is added, then you get this warning:

warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.

and that's very hard to reliably fix because you have to know somehow
a magic path.  For more details, see:

https://blogs.oracle.com/darcy/entry/bootclasspath_older_source
https://blogs.oracle.com/darcy/entry/how_to_cross_compile_for

Anyway, remove the voodoo from configure.ac.

As a side effect, this allows you to set the EXTRA_JAVAC_FLAGS
environment variable before ./configure with any extra javac flags
that you want.
2016-08-25 16:54:34 +01:00
Richard W.M. Jones
473a753382 bash completion: Add a simple test that the 'complete' command is not missing. 2016-08-25 16:54:34 +01:00
Pino Toscano
035533d67a v2v: linux: handle UEFI path for Grub1 (RHBZ#1152369)
Add also /boot/efi/EFI/redhat/grub.conf as configuration of Grub 1;
since the "grub" lens of Augeas does not handle this path, add a
transformation so Augeas can parse it.
2016-08-25 15:22:23 +02:00
Pino Toscano
cf5915aee3 New API: aug_transform
Expose the aug_transform API through the library, so it's possible to
add/remove Augeas transformations to handle files in custom places using
existing lenses.
2016-08-25 15:22:23 +02:00
Richard W.M. Jones
50a3abb95f bash completion: Add missing bash completion scripts (RHBZ#1367738).
Add new scripts for:

- guestunmount
- virt-copy-in
- virt-copy-out
- virt-customize
- virt-dib
- virt-diff
- virt-get-kernel
- virt-p2v-make-disk
- virt-p2v-make-kickstart
- virt-p2v-make-kiwi
- virt-tar-in
- virt-tar-out

Also combine the separate virt-resize script into the general script
virt-alignment-scan.  There wasn't really any reason to have separate
scripts.
2016-08-25 13:51:33 +01:00
Richard W.M. Jones
6a5b08065c bash completions: Add tip for how to run bash completions locally to README. 2016-08-25 13:51:33 +01:00
Richard W.M. Jones
4df8a099ab p2v: Implement --short-options and --long-options in virt-p2v-make-* scripts. 2016-08-25 13:51:33 +01:00
Richard W.M. Jones
2af8d07af6 fuse: Implement --long-options and --short-options in guestunmount. 2016-08-25 13:51:33 +01:00
Richard W.M. Jones
c795d50af3 fish: Move display_*_options functions to a separate file.
By moving these two functions out of the common options parsing code,
it means we don't need to depend on all the other machinery of options
parsing, such as the global variables ("verbose"), libconfig, etc.
2016-08-25 12:52:42 +01:00
Richard W.M. Jones
738c3bf4fd inspection: Fix parsing of btrfs subvolumes in /etc/fstab.
The code to parse btrfs subvol entries in /etc/fstab failed if the
entry had more than one comma-separated option, for example:

/dev/sda4 /home btrfs rw,user,subvol=foo 0 0

This commit fixes that code to use Augeas correctly.

Fixes commit 7ba0e10501.

Reported by: Zhongfu Li
https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1615337
2016-08-25 11:08:15 +01:00
Richard W.M. Jones
ecbf093850 v2v: Allow libvirt >= 2.1.0 to be used for Xen and vCenter conversions.
Libvirt >= 2.1.0 now allows you to open files which have a "json:"
QEMU pseudo-URL as backingfile, whereas previously it would fail hard
in this case (RHBZ#1134878).

When virt-v2v performs conversions from Xen (over SSH) or vCenter
(over HTTPS) it uses these pseudo-URLs as backingfiles.  We had to
tell people to use LIBGUESTFS_BACKEND=direct to avoid libvirt in this
situation.

This commit narrows the check so it will now only print the error if
libvirt < 2.1.0 and LIBGUESTFS_BACKEND=direct is not set.  Also the
error is modified to tell users they can either upgrade libvirt or set
LIBGUESTFS_BACKEND=direct to work around the problem.

Note there is not an easy way apart from checking the version number
of libvirt to tell if the json pseudo-URL is supported.

As a side-effect, this commit also prints the libvirt version number
in debugging output when virt-v2v starts up, which is sometimes useful
information for narrowing down bugs (it is in fact already printed by
libguestfs, so this is duplicate information, but it's a bit easier to
find when it's at the top of the debug).

Thanks: Peter Krempa.
2016-08-25 09:02:01 +01:00
Richard W.M. Jones
6502a7b831 v2v: Separate out machine="q35" and <smm> properties.
This is a simple refactoring of
commit 913dd8a087.
2016-08-23 17:23:10 +01:00
Pino Toscano
e7e446c926 mllib: do not assume $PATH is set
Make 'which' gracefully handle the case where $PATH is not set
(it will raise Executable_not_found, but that is the expected thing to
do).

Related to RHBZ#1367839.
2016-08-23 16:11:30 +02:00
Richard W.M. Jones
c711b51709 aarch64: uefi: Fix the build on aarch64.
Fixes commit 0c396650b0.
2016-08-18 16:13:12 +01:00
Richard W.M. Jones
913dd8a087 v2v: Use OVMF secure boot file (RHBZ#1367615).
From RHEL 7.3, Red Hat have decided to only compile the secure boot
version of OVMF on x86-64, with flags -D SECURE_BOOT_ENABLE -D SMM_REQUIRE.

The filename has also changed to reflect this - it is now
/usr/share/OVMF/OVMF_CODE.secboot.fd.  The old file
/usr/share/OVMF/OVMF_CODE.fd is no longer shipped.

However switching to using this variant of OVMF for UEFI guests is not
just a matter of changing the filename.  The new OVMF variant won't
run unless we also change:

 - The qemu machine model, from the default ("pc" ==
   "pc-i440fx-rhel7.3.0" or later) to Q35 ("q35" == "pc-q35-rhel7.3.0"
   or later).

 - Add <smm> under <features>.

 - Set <loader ... secure="yes">.

NB: On RHEL the changes requires qemu-kvm-rhev.  It is no longer
possible to convert UEFI guests using the basic qemu-kvm.

Thanks: Laszlo Ersek, Ming Xie.
2016-08-18 14:48:51 +01:00
Richard W.M. Jones
0c396650b0 Generate the lists of UEFI firmware paths.
Previously we had a list of UEFI paths in src/uefi.c, which was
accessed in virt-v2v using a private (guestfs_int_*) API and some C
binding code.  This was clumsy and required the paths to be replicated
in the virt-v2v unit tests.

Instead just generate the list of paths from the generator, creating
src/uefi.c and v2v/uefi.ml with the same content.

Remove the C bindings and the virt-v2v unit tests associated with UEFI
paths.
2016-08-18 14:48:51 +01:00
Pino Toscano
17a9712126 v2v: linux: simplify RPM database cleaning
Iterate on the array directly, instead of converting it to a list to do
the same; also, avoid a temporary variable for it.
2016-08-18 14:00:43 +02:00
Pino Toscano
5991ce1c2a build: add silent rules for jar 2016-08-18 13:00:27 +02:00
Richard W.M. Jones
c5a06ae1ad v2v: test-harness: Print the full path of the virt-v2v binary under test. 2016-08-17 17:13:41 +01:00
Richard W.M. Jones
5c03a2ca8b v2v: OVMF is now fully open source, fix the man page. 2016-08-17 14:36:51 +01:00
Richard W.M. Jones
326200c433 Version 1.35.1. 2016-08-16 15:06:17 +01:00
Richard W.M. Jones
dd22e376c4 v2v: Add -o discard option when fstrimming.
This *may* be required by some filesystems in order for fstrim to
work.  I'm not actually sure if this is true, but it's what
virt-sparsify --in-place does, and that utility has been tested a lot
more in regards to trimming.
2016-08-16 13:22:25 +01:00
Richard W.M. Jones
66816e1133 v2v: Make fstrim warning clearer (RHBZ#1366456).
This reverts the change made for RHBZ#1168144.  The warning is now
always displayed.

It would be nice to make the warning actionable, but there is not a
lot that end users can do since fstrim is such a complex topic
interacting with all filesystem and storage layers.
2016-08-16 13:22:25 +01:00
Richard W.M. Jones
d33e28c988 p2v: Fix s/is/are/ in GUI message.
I reordered the 'and' clause to make it sound a bit more natural.

Thanks: Junqin Zhou.
2016-08-16 13:22:25 +01:00
Tomáš Golembiovský
7eab864c21 v2v: linux: accept 'sr' devices in fstab
Do not print warning for 'sr' devices when converting fstab. Not all
systems create the /dev/cdrom symlink for SCSI CD-ROM devices. Moreover,
on systems with multiple CD-ROMs, having entries for /dev/sr* devices
may be inevitable.

RWMJ: Use String.is_prefix instead of String.find, to more accurately
match on the device name.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2016-08-11 09:00:33 +01:00
Tomáš Golembiovský
68ba0609c7 v2v: Citrix Xen has been tested, adapt the documentation
Conversion from Citrix Xen has now been tested and should work. Remove
the comment about it from the documentation.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-08-11 08:58:30 +01:00
Matteo Cafasso
42bccd78b8 sleuthkit code cleanup
Small cosmetic changes.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2016-08-08 22:25:04 +01:00
Pino Toscano
8a9c747ff6 sparsify, v2v: use Common_utils.absolute_path
Use the common function for ensuring a path is absolute; it should not
change the behaviour at all.
2016-08-08 17:25:40 +02:00
Pino Toscano
98dea4978d v2v: disk: strip only common extension (RHBZ#1365005)
In disk input mode, to determine the guest name strip the extension from
the filename only if it's a very well extension for disk images.
2016-08-08 17:21:03 +02:00
Richard W.M. Jones
48e4012d03 website: Get rid of some quite old branches.
RHEL 7.3 will have 1.32.6, so we should encourage people to move to at
least that version for recent features.

Fixes commit f4e4a668ae.
2016-08-08 13:57:17 +01:00
Richard W.M. Jones
2c3b829bd8 Version 1.35.0. 2016-08-08 13:46:24 +01:00
Richard W.M. Jones
4c84033d8c Version 1.34.0. 2016-08-08 12:49:58 +01:00
Richard W.M. Jones
f4e4a668ae Update website for 1.34 release. 2016-08-08 12:37:25 +01:00
Richard W.M. Jones
4ad5652c99 Update release notes.
Also remove "draft" logo since these are close to being finalized
for the 1.34 release.
2016-08-08 12:31:15 +01:00
Tomáš Golembiovský
4ddc0add85 v2v: fix regex replacement in grub2_update_console
The replacement string was wrong. There are only two match groups in the
regular expression, not three.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-08-08 11:00:15 +02:00
Tomáš Golembiovský
56e5cf14e9 v2v: do not hide the error, rather report it
The Invalid_argument exception is there to catch unexpected situation
when rpm returns no output. Such situation should be reported rather
then hidden.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-08-05 18:09:10 +02:00
Pino Toscano
34c7215a2f ruby: ignore -Wshift-overflow warnings
There seems to be a -Wshift-overflow bug in a Ruby 2.3 header, so
add a GCC diagnostic override to avoid build failures with
--enable-werror.
2016-08-05 18:09:10 +02:00
Richard W.M. Jones
71de3d49a3 sparsify: Add a regression test for RHBZ#1364347.
Add a regression test for the previous commit.
2016-08-05 15:10:50 +01:00
Richard W.M. Jones
4d5335a56d sparsify: Warn instead of error if a filesystem cannot be fstrimmed (RHBZ#1364347).
Thanks:  Xianghua Chen
2016-08-05 15:10:50 +01:00
Richard W.M. Jones
116a41d048 daemon: fstrim: Turn "discard operation is not supported" into ENOTSUP.
Because we run the external fstrim command we don't have access to the
kernel errno when it fails.  However in the case where it prints this
specific error message, turn that into errno ENOTSUP.
2016-08-05 15:10:50 +01:00
Richard W.M. Jones
97b6b4a4eb sparsify: Exit with error code 3 if fstrim is not supported by the appliance.
This replaces the indirect exception catching from
commit 931aec5b88 with a direct feature
test.

Fixes commit 931aec5b88.
2016-08-05 12:16:54 +01:00
Richard W.M. Jones
7de25f7d71 build: Line up "OCAMLOPT" with other silent rules.
Tidies up commit 0b94c4d3bb.
2016-08-05 10:37:46 +01:00
Richard W.M. Jones
a11a7ebbc3 build: Add silent rules for podwrapper.
Also quietens the podwrapper script itself, as there is no reason to
print 'wrote <output>' for each output file.
2016-08-04 23:33:58 +01:00
Richard W.M. Jones
320b053178 Version 1.33.49. 2016-08-04 22:34:42 +01:00
Pino Toscano
0b94c4d3bb build: add simple custom silent rules for automake
Add makefile variables to enable silent rules for simple command
invocations, such as ocamlc, ocamlopt, javac, and erlc.

This reduces the log output when building with silent rules, still
showing the full command lines otherwise.
2016-08-04 16:18:33 +02:00
Pino Toscano
5630e0eb05 dib: add --drive-format
Allow to specify the format of the helper drive, to avoid relying on the
format autodetection.  This is the same approach used also in all the
other tools.
2016-08-04 14:43:21 +02:00
Pino Toscano
6e198634ac firstboot: make SysV symlinks as relative on Debian
Turn the rc.d symlinks for the guestfs-firstboot service as relative,
instead of absolute paths: the result is the same (the service works the
same), and this way is more coherent with symlinks created by
update-rc.d.
2016-08-04 13:53:31 +02:00
Pino Toscano
d394e01c2b firstboot: rename systemd and sysvinit
Currently we install a systemd service named firstboot.service and a
SysV service named virt-sysprep-firstboot.  On systems where systemd is
the init system and runs with the SysV compatibility, the different
names make systemd handle them as different services, and thus trying to
run the firstboot script runner twice.

Rename both the systemd service and the SysV one to guestfs-firstboot:
the new name is less generic, and allows the systemd service to be
shadowed by the SysV service (and thus running just once).

Also cleanup the old services: the old SysV service can be removed
directly, since its former name had "virt-sysprep" in it, and so there
could not be much room for confusion and conflict.  Regarding the old
systemd service: to avoid leaving it behind, a simple cleanup strategy
is in place, checking the content of the old firstboot.service to really
ensure we are removing one of our versions of this file.
2016-08-04 13:44:03 +02:00
Pino Toscano
1d32637c64 dib: export FS_TYPE for elements
Export FS_TYPE for the elements, so they can know what is the filesystem
created.

This was implemented in diskimage-builder upstream as
commit be521bdec6233530cc952be246a66f1957b0dd58.
2016-08-04 12:16:35 +02:00
Pino Toscano
8ad870e563 dib: add docker output format
Implement the "docker" output format, to import an image into docker.

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

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

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

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

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

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

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

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

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

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

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

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

Also move few common AC_SUBST in a single place.
2016-07-28 10:56:58 +02:00
Richard W.M. Jones
108509ec19 docs: hacking: Add a section describing the build system. 2016-07-27 19:02:49 +01:00
Richard W.M. Jones
7561d1bcae docs: hacking: Improve documentation on how OCaml programs are built. 2016-07-27 19:02:27 +01:00
Richard W.M. Jones
c008dd15a7 Version 1.33.46. 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
Richard W.M. Jones
88ba55c553 Version 1.32.0. 2016-01-06 11:34:01 +00:00
Richard W.M. Jones
bc9faf843b website: Prepare website for 1.32 release. 2016-01-06 11:30:02 +00:00
Richard W.M. Jones
5218f54a54 hacking: Document simpler way to create stable branch in git.
I will try this method for the 1.32 release.
2016-01-06 11:30:02 +00:00
Richard W.M. Jones
acde5a6f95 Finalize release notes for libguestfs 1.32. 2016-01-06 11:18:35 +00:00
Richard W.M. Jones
07d1baebae Update PO files from Zanata. 2016-01-06 11:13:27 +00:00
Richard W.M. Jones
1007b2555c daemon: Fix ext2 labels error message (RHBZ#1294956). 2016-01-04 15:33:45 +00:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Richard W.M. Jones
9958dffc08 builder: Update Fedora 23 ppc64le image which was broken.
This updates commit d92758d8bb.
2015-12-19 21:30:50 +00:00
Richard W.M. Jones
d92758d8bb builder: Add Fedora 23 ppc64/ppc64le images. 2015-12-19 13:32:25 +00:00
Richard W.M. Jones
eed0e7a2e0 builder: Fix Fedora ppc64/ppc64le build scripts to use correct version. 2015-12-19 09:57:36 +00:00
Pino Toscano
d7753a8eb9 tests: add a couple of iSCSI-related test cases 2015-12-18 17:10:25 +01:00
Pino Toscano
079984a8b8 drives: allow authentication for iSCSI
Now that both the direct and libvirt backends handle authentication with
iSCSI correctly, we can allow this in the library.
2015-12-18 11:17:23 +01:00
Pino Toscano
b2598ce890 launch: direct: manually compose iscsi:// URIs
Move the creation of iscsi URIs away from make_uri, composing them
manually: this is needed because libxml assumes colons (':') to separate
user and password for the authority part, while with iscsi URIs the
separator is percentage ('%'), which would be percent-encoded by libxml.
2015-12-18 11:17:23 +01:00
Richard W.M. Jones
7ecad8d4f7 daemon: Improve debug information from command*.
Do some fake quoting so people don't get worried that we aren't
quoting the commands we run.  See:
https://www.redhat.com/archives/libguestfs/2015-December/msg00080.html
2015-12-17 11:27:04 +00:00
Richard W.M. Jones
6d90cf5eb2 daemon: Make command*f flags parameter unsigned.
It's a bitmask, so unsigned is the right choice.  eg. We can more
easily print it using %x.

This patch changes the size of the fd mask and the values of the
COMMAND_FLAG_* constants, but since these are internal definitions
that doesn't matter.
2015-12-17 11:15:14 +00:00
Richard W.M. Jones
346a8aa303 Version 1.31.30. 2015-12-16 13:27:16 +00:00
Richard W.M. Jones
8e5a431a59 po: Add pt_BR to list of linguas.
Commit e6f7d23782 added new po files for
pt_BR to po/ and po-docs/ (they are only very minimal).  However they
were not added to the list of linguas, so amongst other things the
files were not included in EXTRA_DIST automatically.
2015-12-16 13:27:16 +00:00
Richard W.M. Jones
cbe698b9c9 po: Fix two faults in the uk.po file.
./uk.po:1049: 'msgid' and 'msgstr' entries do not both end with '\n'
./uk.po:9638: format specifications in 'msgid' and 'msgstr' for argument 2 are not the same

This updates commit e6f7d23782.
2015-12-16 13:27:08 +00:00
Richard W.M. Jones
adfe577ee9 hacking: index.html.in is now stored in git under website/ directory. 2015-12-16 12:44:51 +00:00
Richard W.M. Jones
e44de65ec9 builder: Add CentOS 7.2 image. 2015-12-15 18:40:36 +00:00
Richard W.M. Jones
e69e9c1ece builder: website: Update comment in centos.sh script. 2015-12-15 18:20:17 +00:00
Richard W.M. Jones
43e0d25f8d fish: tests: Don't open phony fedora.img for write in parallel.
Two tests opened the phony Fedora image in parallel without the
readonly flag.  This occasionally resulted in strange errors
(especially observed in test-inspect.sh).  Add the --readonly flag to
avoid this.
2015-12-15 17:01:44 +00:00
Richard W.M. Jones
8ec4ebb952 Update release notes. 2015-12-15 16:49:30 +00:00
Richard W.M. Jones
7e8ff29710 Update gnulib to latest. 2015-12-15 16:31:50 +00:00
Richard W.M. Jones
e6f7d23782 Add latest translations pulled from Zanata. 2015-12-15 16:31:50 +00:00
Richard W.M. Jones
ddd9d479cc Update translations and send to Zanata. 2015-12-15 16:31:41 +00:00
Richard W.M. Jones
5c02ad3375 Update BUGS. 2015-12-15 16:31:34 +00:00
Pino Toscano
9c3b4f6ad8 daemon: improve internal commandrvf
- add a flag to request chroot for the process, which is done only as
  very last (before chdir) operation before exec'ing the process in the
  child: this avoids using CHROOT_IN & CHROOT_OUT around command*
  invocations, and reduces the code spent in chroot mode
- add failure checks for dup2, open, and chdir done in child, not
  proceeding to executing the process if they fail
- open /dev/null without O_CLOEXEC, so it stays available for the
  exec'ed process, and thus we don't need to provide an own fd for stdin

Followup of commit fd2f175ee7, thanks also
to the notes and hints provided by Mateusz Guzik.
2015-12-15 15:00:11 +01:00
Richard W.M. Jones
6c6c3ea675 build: Disable -Wstack-protector warning.
Fires with gcc 5.3.1 (on Fedora 23).  It's a completely useless
warning since it just tells you that a function couldn't use the stack
protector.
2015-12-14 22:38:52 +00:00
Kashyap Chamarthy
b314f6700a guestfs.pod: Update reference to libguestfs internals 2015-12-14 21:23:20 +00:00
Richard W.M. Jones
cc717138a9 customize: Capitalize the first character in --sm-credentials help text.
Prior to this commit:

$ virt-builder --help
[...]
  --sm-attach SELECTOR         Attach to a subscription-manager pool
  --sm-credentials SELECTOR    credentials for subscription-manager
  --sm-register                Register using subscription-manager

Really the generator ought to check this.
2015-12-11 15:51:21 +00:00
Pino Toscano
4be1587b33 inspect: recognize the PLD Linux distribution
Just basic identification, with name and version read from
/etc/os-release.
2015-12-10 14:06:14 +01:00
Richard W.M. Jones
545fc84775 perl: Add missing backslash in CLEANFILES rule.
This fixes commit a2edda266e.

Thanks: Jean-Christophe Manciot.
2015-12-06 16:24:32 +00:00
Richard W.M. Jones
f48361ed04 Version 1.31.29. 2015-12-05 23:45:07 +00:00
Richard W.M. Jones
0339b3d7a5 builder: Add Fedora 23 i686 image (RHBZ#1288733).
This includes the DNF fix, see
commit 59ea51d358.
2015-12-05 23:41:25 +00:00
Pino Toscano
a090a48f44 builder: create temporary images in the cachedir (RHBZ#1288201)
Temporary images can be quite big, more than the space available in
$TMPDIR when it's on a tmpfs; hence, place them in our cachedir
instead.
2015-12-04 11:06:35 +01:00
Richard W.M. Jones
5c7c4666e4 resize: Add a regression test for RHBZ#1285847. 2015-12-02 16:18:14 +00:00
Richard W.M. Jones
b3bc670c71 resize: Work around regression in sfdisk (RHBZ#1285847).
'sfdisk --part-type' used to merely set the MBR ID byte in the
partition.  However since sfdisk was rewritten, it now "helpfully"
corrupts the first sector of the partition if you change the type byte
from an ordinary partition to an extended partition.

So we need to change the order in which we sets the partition type
byte, to do it before copying the partition content.

This fixes a major regression in the way that virt-resize handles any
guest with logical partitions (specifically Ubuntu guests).
2015-12-02 16:18:14 +00:00
Richard W.M. Jones
8eb9ad0fb2 POTFILES: Escape dot in regular expression. 2015-12-02 16:18:14 +00:00
Richard W.M. Jones
59ea51d358 builder: Rebuild Fedora 23 image with new DNF (RHBZ#1280029, RHBZ#1278382).
We also need to add a small hack to the build script to ensure the
latest dnf is really included.
2015-12-01 13:03:31 +00:00
Richard W.M. Jones
4085acc67f builder: pxzcat: If write fails, display correct error message.
If uncompressing a template to a filesystem which is nearly full,
virt-builder displays an error which points to the wrong (source) file:

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

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

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

$ virt-builder fedora-22
[   1.1] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.6] Planning how to build this image
[   1.6] Uncompressing
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
2015-11-27 09:08:07 +00:00
Richard W.M. Jones
8120c6c903 Version 1.31.28. 2015-11-24 22:59:36 +00:00
Richard W.M. Jones
2ee2003d56 daemon: Allow --channel fd:N
In this case, the daemon has been passed an open file descriptor which
it uses directly for the channel.
2015-11-24 19:13:39 +00:00
Richard W.M. Jones
49ad09bae3 launch: direct: aarch64: Add gic-version=host to -M option.
On ARM machines with vGICv3, we need to use the extra -M
parameter gic-version=3 (or gic-version=2 for the old vGIC).

qemu can detect this feature for us if we pass gic-version=host,
so add that to the -M option.  Unfortunately we cannot detect if
qemu itself supports this parameter, but this change only affects
aarch64.

Thanks: Wei Huang
2015-11-24 18:39:52 +00:00
Richard W.M. Jones
6e15468337 builder: rhel: Fix path in rhel-aarch64.sh. 2015-11-24 15:41:56 +00:00
Pino Toscano
51362c9638 fuse: fix return value of guestunmount for unmounted paths
Exit with 3 as return value when fusermount fails, because the specified
mount point is not considered mounted for the user.  This is in line
with what the guestunmount documentation says.

Adapt the test-guestunmount-fd test to the updated return value.

Thanks to: Maxim Perevedentsev.
2015-11-24 16:28:06 +01:00
Richard W.M. Jones
e49680bdd6 fish: ps_restore is only used when HAVE_LIBREADLINE is defined.
Thanks: Keresztes Péter-Zoltán
2015-11-24 11:14:37 +00:00
Pino Toscano
fd2f175ee7 daemon: always provide stdin when running chroot commands (RHBZ#1280029)
When running commands in the mounted guest (using the "command" API, and
APIs based on it), provide the /dev/null from the appliance as open fd
for stdin.  Commands usually assume stdin is open if they didn't close
it explicitly, so this should avoid crashes or misbehavings due to that.
2015-11-20 14:55:46 +01:00
Pino Toscano
0799ac4bf4 build: disable -Winline
Older GCC versions (e.g. < 4.9) may complain about inline functions that
cannot be inlined (growing the generated code). It is not really a
problem for us, so just suppress again the warning.

Followup of commit c37c554fc5.
2015-11-20 14:54:20 +01:00
Richard W.M. Jones
37e145140b v2v: Add full stop after multi-line error message. 2015-11-20 10:27:53 +00:00
Richard W.M. Jones
6faa0bb331 v2v: Clean up the documentation for virt-v2v-copy-to-local.
Don't duplicate the instructions in two different man pages.
Put the conversion steps into virt-v2v(1) only.

This updates commit 87adc30163.
2015-11-20 09:53:35 +00:00
Richard W.M. Jones
0721b8d7f3 v2v: Fix valgrind of virt-v2v-copy-to-local.
This fixes commit 87adc30163.
2015-11-20 08:22:01 +00:00
Richard W.M. Jones
b193908514 build: Add virt-v2v-copy-to-local to installcheck.
This updates commit 87adc30163.
2015-11-19 22:53:18 +00:00
Richard W.M. Jones
9fbb956b14 Version 1.31.27. 2015-11-19 22:51:17 +00:00
Richard W.M. Jones
87adc30163 v2v: Add a new tool virt-v2v-copy-to-local.
This allows certain guests which virt-v2v cannot access to be copied
off the remote hypervisor and converted.  Essentially this just
automates the process of copying the guest's disks and adjusting the
libvirt XML.

This also adds a test of the new tool.
2015-11-19 21:51:42 +00:00
Richard W.M. Jones
05a80e6088 v2v: xml: Add a binding for XmlUnsetProp. 2015-11-19 19:17:41 +00:00
Richard W.M. Jones
7a9edee22c v2v: vcenter: Split out map_source_to_https from map_source_to_uri.
Split the map_source_to_uri function up so that we can get at just the
https://... URI.

This is almost refactoring.  It doesn't quite handle the case where we
are passed a source path from the libvirt VMware driver that doesn't
match the expected "[datastore] path" format, but probably if we hit
that case it's a bug anyway.
2015-11-19 17:20:55 +00:00
Richard W.M. Jones
2ea771e4f8 v2v: Detect conversions where the source disk has zero size (RHBZ#1283588).
If you try to convert a guest that has a zero-sized disk, it
will currently fail in a rather strange way.  Usually you will
see errors in the debug output:

  [    0.562714] sd 2:0:0:0: [sda] Read Capacity(16) failed: Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
  [    0.563884] sd 2:0:0:0: [sda] Sense Key : Not Ready [current]
  [    0.564587] sd 2:0:0:0: [sda] Add. Sense: Logical unit not ready, manual intervention required

followed by virt-v2v failing with:

  libguestfs: trace: v2v: inspect_os = []
  virt-v2v: error: inspection could not detect the source guest (or physical
  machine).

Additionally, because of a problem with the ssh driver in qemu (or
perhaps, with sftp-server on the remote side) it is not possible to
use the ssh driver to open a block device path on the remote server.
The drive will appear as zero-sized, triggering the above error.

Therefore detect this situation, and emit an error (see below).  Also
add a section to the manual describing the workaround required for
converting RHEL 5 Xen guests which are located on block devices.

  virt-v2v: error: guest disk sda appears to be zero bytes in size.

  There could be several reasons for this:

  Check that the guest doesn't really have a zero-sized disk.  virt-v2v
  cannot convert such a guest.

  If you are converting a guest from an ssh source and the guest has a disk
  on a block device (eg. on a host partition or host LVM LV), then
  conversions of this type are not supported.  See "XEN OR SSH CONVERSIONS
  FROM BLOCK DEVICES" in the virt-v2v(1) manual for a workaround.
2015-11-19 13:56:37 +00:00
Richard W.M. Jones
9c85bbbc42 p2v: Cancel conversion if user closes the running dialog.
If the user tries to close the running dialog during a running
conversion, act as if the cancel button was pressed (cancelling the
conversion).

If the conversion has finished/been cancelled, then this closes the
dialog and exits virt-p2v, as now.

Cancelling the conversion in this way ensures that qemu-nbd and ssh
subprocesses are cleaned up.
2015-11-16 22:38:01 +00:00
Richard W.M. Jones
046a625846 p2v: Add a conversion_is_running() function.
This thread-safe function can be used to determine if the conversion
is running (maybe in another thread).
2015-11-16 22:33:59 +00:00
Richard W.M. Jones
62b8a09b36 p2v: Make cancel_conversion() properly thread safe.
Rename 'stop' variable as cancel_requested, and defend it with a
mutex.
2015-11-16 22:33:59 +00:00
Richard W.M. Jones
05d08b8d19 p2v: Tidy up in man page. 2015-11-16 21:47:36 +00:00
Richard W.M. Jones
7406c76bcf p2v: Send physical server 'dmesg' output to debug dir on conversion server.
If the virt-p2v ISO doesn't contain the correct drivers for the
hardware on the physical server, that can cause peculiar conversion
problems.  This was hard to diagnose because we could not see the
'dmesg' output from the physical server.

Upload 'dmesg' output from the physical server (more precisely: from
the virt-p2v ISO's kernel running on the physical server) to the
virt-v2v conversion server debugging directory, so that this
information is available for debugging later.

Unfortunately this involves yet another copy of the 'read_whole_file'
function.
2015-11-16 21:47:36 +00:00
Richard W.M. Jones
399e031c25 v2v: OVF: Use common generated_by string.
Instead of creating a special 'Exported by ...' string just for this
module, use the Common_utils.generated_by string.  Since the string is
just descriptive, this should make no difference.
2015-11-15 22:43:06 +00:00
Richard W.M. Jones
ab37d92ab9 v2v: Move mpstat struct into Types module.
Strangely the Types module already defined mpstat, but it was not used
and redefined in v2v.ml.  Apart from that, this change is just
refactoring.
2015-11-15 22:18:36 +00:00
Richard W.M. Jones
fa1f770498 v2v: windows: Fix a few comments. 2015-11-15 21:54:06 +00:00
Richard W.M. Jones
d2ea61bd1c v2v: Add comment. 2015-11-15 21:54:06 +00:00
Richard W.M. Jones
f3e6b3565c v2v: Move the get_node function to the Windows module.
Just refactoring - however this does make the function safer by having
it return an option type instead of throwing a [Not_found] exception.
2015-11-15 21:54:06 +00:00
Richard W.M. Jones
9ad4ce77b6 v2v: Refactor some uses of Windows.with_hive.
This changes:

  let f root = .. in
  Windows.with_hive ... f

to:

  Windows.with_hive ... ( fun root -> .. )

No functional change, just refactoring.
2015-11-15 21:54:06 +00:00
Richard W.M. Jones
40701b715c v2v: Move the with_hive function to the Windows module.
Just refactoring.
2015-11-15 21:33:32 +00:00
Richard W.M. Jones
8cb6600eee Version 1.31.26. 2015-11-13 19:14:43 +00:00
Richard W.M. Jones
9dc4717bb9 build: Remove ChangeLog from make distclean.
Adding this causes 'make dist' to fail with:

  make[1]: *** No rule to make target 'ChangeLog', needed by 'distdir'.  Stop.

This updates commit a2edda266e.
2015-11-13 19:10:35 +00:00
Richard W.M. Jones
c2d216d166 inspection: Fix detection of the kernel version of Windows ≥ 10 (RHBZ#1281578).
See the description in the bug report:

https://bugzilla.redhat.com/show_bug.cgi?id=1281578

Thanks: Richard Tollerton for alerting me to this change in the way
that Windows version numbers are stored in the Registry starting with
Windows ≥ 10.
2015-11-13 14:24:27 +00:00
Richard W.M. Jones
b91b39e06a daemon: lvm: Change the separator character to ':'.
The separator character (currently comma) was picked arbitrarily to
allow us to parse the output of commands like 'lvs' for APIs such as
'lvs-full'.  Unfortunately the choice of comma conflicts with the 'lvs
-o modules' column, since the list of modules is separated by commas,
breaking our parser.

Change the separator to another arbitrary character (colon) which
hopefully is not used by any column.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1278878#c11
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
fccd4ee5e8 daemon: lvm: Only return public LVs from guestfs_lvs API (RHBZ#1278878).
When a disk image uses LVM thinp (thin provisioning), the guestfs_lvs
API would return the thinp pools.  This confused other APIs because
thinp pools don't have corresponding /dev/VG/LV device nodes.

Filter the LVs that are returned using "lv_role=public".

Thanks: Fabian Deutsch
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
c37c554fc5 build: Enable some more warnings.
After fixing some warnings (see prior commits), we can now enable
them in configure.ac.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
52e517c570 Avoid "function 'asprintf_nowarn' can never be inlined because it uses variable argument lists".
Move this to a separate translation unit and don't inline it.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
120b658ccc Avoid various "declaration of <var> shadows a previous local"
I enabled the -Wshadow warning temporarily in order to do these fixes,
but had to disable it again afterwards.  The reason is that this warns
about shadowing globals, which is sort of a good thing, but because we
have a global called "verbose" just about everywhere, and at the same
time we baked a function argument called "verbose" into several
unchangable APIs, well, we're stuck without being able to use this
warning.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
4dc53f0fba Avoid gcc warnings about infinite loop.
This seemingly redundant change avoids a gcc warning/error:

  error: cannot optimize possibly infinite loops

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34114#c3 and
following for an explanation.

Of course gcc is completely wrong and stupid here, because there's no
possibility on current or future hardware that an array of size
SSIZE_MAX could be allocated since it would by definition occupy at
least all addressible memory (if it was an array of bytes, which this
isn't), leaving no room for the code that is being compiled.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
573c0a26fb gobject: Ignore gobject/docs/guestfs-scan.c.
I'm not sure what/why this file has suddenly appeared.  It may
be something to do with updating gtk-doc.

Whatever - ignore it.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
4e32737c40 sparsify: Make the interface between cmdline.ml and sparsify.ml explicit.
We could go a bit further here and push the cmdline struct
into Copying.run and In_place.run.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
995ce5f648 dib: Turn a few progress messages into info messages. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
f8287387c2 dib: Make the interface between cmdline.ml and dib.ml explicit. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
a4c981e7bb builder: Make the interface between cmdline.ml and builder.ml explicit. 2015-11-13 11:53:12 +00:00
Richard W.M. Jones
6f38aff262 inspector: --xpath: Copy node to new document (RHBZ#1281577).
'virt-inspector --xpath' can segfault.

When run under valgrind, it shows this error:

==2254== Invalid free() / delete / delete[] / realloc()
==2254==    at 0x4C29D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2254==    by 0x53BA198: xmlFreeNodeList (tree.c:3690)
==2254==    by 0x53B9F65: xmlFreeDoc (tree.c:1247)
==2254==    by 0x405BFA: do_xpath (inspector.c:808)
==2254==    by 0x405BFA: main (inspector.c:250)
==2254==  Address 0x1030a037 is 311 bytes inside a block of size 1,048 alloc'd
==2254==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2254==    by 0x545DE86: xmlDictAddString.isra.0 (dict.c:270)
==2254==    by 0x545E961: xmlDictLookup (dict.c:923)
==2254==    by 0x539C6DC: xmlDetectSAX2 (parser.c:1067)
==2254==    by 0x53B0B92: xmlParseDocument (parser.c:10725)
==2254==    by 0x53B1276: xmlDoRead (parser.c:15295)
==2254==    by 0x40587D: do_xpath (inspector.c:772)
==2254==    by 0x40587D: main (inspector.c:250)

The cause appears to be that when copying the matching node(s) found
by the xpath expression, we have to copy them into the new document
(using xmlDocCopyNode instead of xmlCopyNode).

This bug has existed since this functionality was originally added in
commit d1ee71782a.
2015-11-13 11:53:12 +00:00
Richard W.M. Jones
ab48601afd inspector: Whitespace changes.
Just break up a few long source lines.
2015-11-12 22:42:45 +00:00
Richard W.M. Jones
7747723aa0 builder: Add Fedora 23 aarch64 image. 2015-11-12 18:12:04 +00:00
Richard W.M. Jones
c15b877310 builder: fedora-aarch64.sh: Switch to using Gerd's edk2. 2015-11-12 16:41:36 +00:00
Richard W.M. Jones
be1b9315ac customize, dib, resize, sysprep: Use 'may' pattern in various places. 2015-11-11 16:12:36 +00:00
Richard W.M. Jones
905d98c127 mllib, v2v: Allow open_guestfs to set the handle identifier.
Extend open_guestfs to take an optional ?identifier parameter.

Use this parameter in virt-v2v which is currently the only place where
we use the handle identifier.
2015-11-11 16:12:35 +00:00
Richard W.M. Jones
b91286c372 v2v: Use the 'may' pattern in the Changeuid module. 2015-11-11 16:12:35 +00:00
Richard W.M. Jones
9307087bb5 builder: Use the 'may' pattern in a few places. 2015-11-11 16:12:35 +00:00
Richard W.M. Jones
9a2c5b7c4d mllib: Add Common_utils 'may' function.
This higher order function encapsulates the following pattern:

  match x with
  | None -> ()
  | Some x -> f x

(replaced with: `may f x`)

This is taken from OCaml lablgtk (Gtk bindings) where this pattern is
used frequently.

See also: https://ocaml.org/learn/tutorials/labels.html
2015-11-11 16:12:35 +00:00
Richard W.M. Jones
c09be9334b v2v: Make the interface between cmdline.ml and v2v.ml explicit. 2015-11-11 14:53:18 +00:00
Richard W.M. Jones
6d46eb33bf v2v: Add --compressed option to produce compressed qcow2 files (RHBZ#1279273). 2015-11-10 13:40:34 +00:00
Pino Toscano
4cc98d8f6e OCaml tools: use open_guestfs everywhere
Instead of creating Guestfs handles and manually apply common options
(e.g. debug and trace), use the open_guestfs in Common_utils.
This also applies the common options to handles which didn't set them
before, so we can inspect also their messages if needed.
2015-11-10 11:38:40 +01:00
Pino Toscano
a7f3f48dd1 customize: allow editing symlinked files
Resolve also symlinks when checking whether a path passed to --edit is a
file: the file editing code supports symlinks anyway (properly changes
the target file, instead of overwrite the symlink with a real file), so
it is safe to allow this operation in customize/builder.
2015-11-09 18:33:52 +01:00
Pino Toscano
6e41fc5a7f customize: check for file existence with --edit (RHBZ#1275806)
Check that a path provided to --edit exists already; while the is_file
call later will fail for non-existing files, with an explicit check a
better error message can be provided.
2015-11-09 18:26:05 +01:00
Pino Toscano
78db05a05c v2v: test-v2v-i-ova-two-disks.sh: fix sha1 filename
Run sha1sum on the compressed filename (with .gz extension, after the
gzip run), and reference that file in the .mf file.
2015-11-09 16:42:32 +01:00
Pino Toscano
39a8e12d90 lib: do not manually include libvirt.h in .c files
guestfs-internal.h includes it already, so rely on that.
2015-11-09 11:38:49 +01:00
Pino Toscano
3b54869dad lib: enable the libvirt code consistently everywhere
With commit bc2b417784
HAVE_LIBVIRT_BACKEND is defined based on the libvirt version (using its
version macro), although libvirt.h is included only after that check:
because of this, variables in the guestfs_h struct after the
HAVE_LIBVIRT_BACKEND block would be used wrongly if libvirt.h was not
included before guestfs-internal.h, like in the recently added
available.c (all the other places using libvirt features in the handle
already happened to do so).

Considering guestfs-internal.h already includes libvirt.h, move its
inclusion up, right before the libvirt version check.
2015-11-09 11:29:49 +01:00
Richard W.M. Jones
cbeb127a5d todo: Remove virt-p2v --inject-ssh-identity as it has been implemented. 2015-11-08 20:36:47 +00:00
Richard W.M. Jones
3bf676be92 lib: find_or_cache_feature function can return a const pointer.
This updates commit 38598e2ba5.
2015-11-06 22:24:39 +00:00
Richard W.M. Jones
2497b4921e lib: Fix whitespace in src/available.c
This updates commit 38598e2ba5.
2015-11-06 21:38:28 +00:00
Richard W.M. Jones
dc9d14ebd3 Version 1.31.25. 2015-11-06 17:30:53 +00:00
Pino Toscano
7b74d05758 tests: rhbz1232192.sh: fix VIRT_TOOLS_DATA_DIR
Followup of commit f933a3c9c7.
2015-11-06 17:13:34 +01:00
Pino Toscano
af3511c7a9 tests: replace run-xml-to-junit.* with automake2junit.ml
Replace the custom XSLT + script to turn output from $RUN_OUTPUT_FILE
(from previous run.in versions) with a OCaml script to analyze .trs and
.log files of the automake test framework.

The final result should be the same, just with classname= for each test
set to the "path" (subdirectories) to that test.
2015-11-06 16:14:22 +01:00
Pino Toscano
18c730e7f6 build: use a custom test driver
Use a custom test driver for running the tests: based on the test-driver
provided by automake, it adds the running time of the test in each .trs
file.
2015-11-06 16:11:55 +01:00
Richard W.M. Jones
c0a781ed9a build: Drop serial_tests.
Use (implicitly) parallel tests on new enough automake.  The tests run
a bit quicker with this change.  On my laptop, I measured 27 mins down
to 18 mins.

Change the ./run function so that ./run --test no longer spools the
test output to a file.  That is not necessary when using parallel
tests, since the test harness does the same thing.

Note: This commit removes the $RUN_OUTPUT_FILE functionality.  We will
change the CI integration in a future commit so it uses the .trs and
.log files.
2015-11-06 16:11:44 +01:00
Richard W.M. Jones
7964e48b5e inspect: windows: Fail hard if we cannot detect Windows architecture (RHBZ#1278371).
The user did not have the 'file' command installed, and when they
attempted to do a v2v conversion of a Windows guest, inspection
succeeded, but the Types.i_arch field was found to contain "unknown".
virt-v2v conversion failed to locate the correct virtio drivers as a
result.

The 'file' command is required, and there's no other reason we should
not be able to detect the architecture of any Windows guest, so fail
hard in this situation.
2015-11-06 12:16:30 +00:00
Richard W.M. Jones
32368f25f1 generator: Another minor indentation fix in src/actions-*.c files. 2015-11-06 12:09:53 +00:00
Richard W.M. Jones
22c97bcb3f v2v: tests: No QXL drivers on the ISO.
There are no QXL drivers on the ISO, so don't expect the QXL driver to
be installed.

This fixes commit 8c735a84c7.
2015-11-06 09:41:47 +00:00
Richard W.M. Jones
c5237e28c5 test-data: Copy DriverVer from real *.inf files to fake *.inf files.
We want to test if virt-v2v can find drivers using the *.inf files.
For this to work, one field is important:

  [Version]
  DriverVer = 07/17/2013,6.1.0.10018

Copy the [Version] section header and DriverVer field from the real
*.inf files to our fake *.inf files, which is enough for testing.

See also:
https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html

Note that the fields are case insensitive and may or may not contain
spaces.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
8c735a84c7 test-data: Make fake virtio-win ISO.
The virtio-win ISO has a different layout and superset of drivers
compared to the virtio-win RPM directory.  Previously we simply put
all the RPM files into the fake ISO.  Instead create a fake ISO which
has the same layout and (fake) drivers as the real ISO.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
b99a57a631 test-data: Add further (all fake) virtio-win driver files. 2015-11-05 16:23:10 +00:00
Richard W.M. Jones
f933a3c9c7 v2v: Move fake-virtio-win and fake-virt-tools under test-data.
There is no change, this just moves the test files.
2015-11-05 16:23:10 +00:00
Pino Toscano
38598e2ba5 actions: refactor available & feature_available
Refactor the internal_feature_available to return the result for just
one group, so it is easier to know on the library side what was the
actual error, and which group refers to; drop internal_available, as no
more needed after this.

On the library side, implement in available and feature_available the
real logic to iterate through the requested group, and error out or
return whether the groups are available. This also introduces caching
for the features, so each needs to be queried just once in each
appliance run.

The result of this is that there should be much less communication with
the daemon to know about available features; the downside is that
queries for more than one group at once, not already cached, will be
cause more queries to the daemon.
2015-11-05 16:48:58 +01:00
Pino Toscano
2e79edb4a3 actions: turn available & feature_available as non-daemon
Rename the current available and feature_available into internal daemon
functions, and provide non-daemon functions wrapping them at library
side.  This will make it possible to e.g. add caching for them.

Should be only refactoring, no actual behaviour change.
2015-11-05 16:48:58 +01:00
Richard W.M. Jones
18fbdaaf14 v2v: Improve the error when virt-v2v is run on a blank disk.
The error messages changes from:

  $ virt-v2v -i disk /tmp/blank.img -o null
  [...]
  [  14.6] Inspecting the overlay
  virt-v2v: error: no root device found in this operating system image.

to:

  $ virt-v2v -i disk /tmp/blank.img -o null
  [...]
  [  15.2] Inspecting the overlay
  virt-v2v: error: inspection could not detect the source guest (or physical
  machine).

  Assuming that you are running virt-v2v/virt-p2v on a source which is
  supported (and not, for example, a blank disk), then this should not
  happen.  You should run 'virt-v2v -v -x ... >& log' and attach the complete
  log to a new bug report (see http://libguestfs.org).

  No root device found in this operating system image.
2015-11-05 14:01:10 +00:00
Richard W.M. Jones
b20d36aa1b tests: Change more conflicting temporary output file names.
Various tests cannot be run in parallel just because they happen to
use conflicting names for temporary output files (eg. "test.out").

Change these tests to use unique temporary names, so the tests could
be run in parallel.
2015-11-05 13:48:38 +00:00
Richard W.M. Jones
8a72616bf7 test-data: phony-guests: Don't use *.tmp.* temporary files. 2015-11-05 13:46:05 +00:00
Richard W.M. Jones
458d7c09b7 v2v: Check if i_type, i_distro or i_arch contains "unknown".
That indicates that inspection failed, so we should error out early.
2015-11-05 13:46:05 +00:00
Richard W.M. Jones
fff2797578 v2v: vCenter: Document additional permission needed for conversions (RHBZ#1277274).
This updates commit 4e24338625.

Thanks: Alessandro on https://bugzilla.redhat.com/show_bug.cgi?id=1277274#c6
2015-11-05 09:03:56 +00:00
Pino Toscano
b933b17a2a actions: set features for vfs_minimum_size tests
Limit the scope of two tests of vfs_minimum_size to the features they
require (btrfs and xfs).
2015-11-05 09:46:36 +01:00
Richard W.M. Jones
c12c7d0df0 Version 1.31.24. 2015-11-04 17:45:28 +00:00
Richard W.M. Jones
8e3920a334 sparsify: Let --in-place capture ^C and shut down gracefully (RHBZ#1277122).
When virt-sparsify receives a user quit signal (eg from ^C) it
currently kills virt-sparsify and qemu instantly, meaning any mount +
fstrim in progress is uncleanly stopped.  The (minor) side effect of
this is that the guest filesystem may require a journal replay or fsck
on boot.

Let virt-sparsify capture the user quit signal and shut down
gracefully.

It is not thought that the previous behaviour could cause guest
corruption; see
https://lists.nongnu.org/archive/html/qemu-devel/2015-11/threads.html#00402
for discussion.
2015-11-04 16:24:04 +00:00
Richard W.M. Jones
4e24338625 v2v: vCenter: Document the minimum set of permissions needed for conversions (RHBZ#1277274).
Thanks: Alessandro on https://bugzilla.redhat.com/show_bug.cgi?id=1277274#c2
2015-11-04 16:24:04 +00:00
Pino Toscano
9d8ffd966a lib: include few more headers
- include <sys/un.h> for sockaddr_un, on any OS (removing the Mac OS X
  blocks)
- include <fcntl.h> for O_* flags

This commits reverts a couple of changes in these files done in
commit 3b17152ec3.
2015-11-04 14:52:29 +01:00
Pino Toscano
a13e95783d Revert "launch: add missing headers on Darwin"
This reverts commit 3ce4e95c5a.
2015-11-04 14:50:58 +01:00
Richard W.M. Jones
226848762b builder: Add fedora-23 image. 2015-11-04 13:06:11 +00:00
Margaret Lewicka
3ce4e95c5a launch: add missing headers on Darwin
Including sys/un.h for sockaddr_un and sys/fcntl.h for
O_CLOEXEC/O_NONBLOCK.
2015-11-04 12:22:28 +00:00
Richard W.M. Jones
0c879fcd15 sparsify: Don't mark virt-sparsify --in-place as "experimental".
Thanks: Gil Klein.
2015-11-04 09:47:52 +00:00
Richard W.M. Jones
9f70d71d4a builder: Document using 'qemu-img amend' for RHEL 6 compat (RHBZ#1204131). 2015-11-03 21:14:40 +00:00
Richard W.M. Jones
a2edda266e build: Make 'make clean' remove more files.
Remove man pages and other pages which 'make clean' did not remove
before.

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

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

 - generator-built files

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

 - any ./configure output files (maybe they should be?)
2015-11-03 13:53:37 +00:00
Richard W.M. Jones
6221d54445 build: Remove unused intltool-* files.
None of these files have been touched since the initial intltoolize
command (commit 29204fe10d, May 2009).
2015-11-03 12:14:10 +00:00
Richard W.M. Jones
c192d99c09 p2v: Don't present the vdsm output driver to the user (RHBZ#1277074).
Thanks: Ming Xie.
2015-11-02 23:31:32 +00:00
Richard W.M. Jones
f45c4619f5 tests: Remove fuzz testing of inspection.
It's a nice idea, but has never actually found a problem.  After using
afl to find bugs in qemu-img, it's pretty clear to me that no
successful approach could be run in the short time demanded by the
libguestfs test suite.  Afl tests run for days, weeks or even months.

A better approach may be to use a proven fuzz tester (such as afl) on
the inspection code; or to run this code for days on end on a separate
testing machine.

This reverts commit c2dcd10964.
2015-10-31 23:09:51 +00:00
Richard W.M. Jones
2c62de52b7 df: Close parenthesis in comment. 2015-10-31 22:53:14 +00:00
Richard W.M. Jones
88c506767a build: Make 'make clean' remove a few backup files. 2015-10-31 22:08:06 +00:00
Richard W.M. Jones
6190226671 website: Add guestfs-hacking, guestfs-internals, guestfs-security to website.
Also move guestfs-performance to the right place on the website.

This updates commit 2eb01004bf
and commit d07515b947
and commit 74fba6e692
and commit 15b8b6453d.
2015-10-31 17:09:29 +00:00
Richard W.M. Jones
47b095b928 website: Put website into a separate directory.
Move the random set of HTML files we build from html/ into
the website/ directory.

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

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

Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
2015-10-31 17:09:29 +00:00
Richard W.M. Jones
de819d17e4 Version 1.31.23. 2015-10-31 11:08:14 +00:00
Richard W.M. Jones
7dcfc9eb03 docs: Minor fix to description of 'test-data' subdirectory.
Fixes commit dc1d0880b0.
2015-10-30 23:02:54 +00:00
Richard W.M. Jones
2eb01004bf website: Copy guestfs-hacking, guestfs-internals, guestfs-security to website.
Make sure the three new man pages are copied over to the website.

This updates commit d07515b947
and commit 74fba6e692
and commit 15b8b6453d.
2015-10-30 22:49:50 +00:00
Richard W.M. Jones
877c69bef7 build: Reorder build sequence.
When I conceived commit dc1d0880b0, I
thought it would be a good idea to build test-data files, including
the phony guest images, during the 'make' phase.  Previously these
were built early in the 'make check' phase.

However this has two disadvantages: (a) We run the appliance
unnecessarily during builds.  For example, it is not necessary to
build the phony guests if we are going to do an 'installcheck'.
(b) Even if we are testing, the critical first time we run the
appliance is not in 'quickcheck' or 'tests/qemu', but some random
guest build.

Reorder the build sequence to fix this, and also a few other things.

This updates commit dc1d0880b0.
2015-10-30 22:06:18 +00:00
Richard W.M. Jones
dd5f5ffb48 test-data: Remove bogus comment.
The way we now build the blank guest images is safe to be run in
parallel.
2015-10-30 21:39:54 +00:00
Richard W.M. Jones
cd6f7f6ee0 tests/regressions: Fix rhbz1174551.sh so it works when debugging is enabled.
This test failed during release testing.  It turned out to be because
the tests are run with LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 which
causes other messages to be printed.

Updates commit b5a6f899cd.
2015-10-30 18:51:30 +00:00
Richard W.M. Jones
c078486041 Version 1.31.22. 2015-10-30 16:28:28 +00:00
Richard W.M. Jones
dc1d0880b0 tests: Move the tests/data and tests/guests directories to test-data.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.

There are actually several new subdirectories created:

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

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

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

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

test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
2015-10-30 16:07:32 +00:00
Richard W.M. Jones
7efde6589c tests/regressions: Display errors in rhbz1174551.sh.
Updates commit b5a6f899cd.
2015-10-30 15:09:37 +00:00
Richard W.M. Jones
93214205cc Version 1.31.21. 2015-10-30 10:52:30 +00:00
Richard W.M. Jones
6b2ff3377c v2v: windows: Create Windows module, and move functions around.
Create a Windows module, analogous to the Linux module we already
have.  Move utility functions related to Windows into this module.

In particular:

 - detect_antivirus function moves here, and the Detect_antivirus
   module goes away entirely

 - copy_virtio_drivers / virtio_iso_path_matches_guest_os moves here,
   and the virtio_iso_path_matches_guest_os can now be hidden

This is just refactoring, but allows us to make deeper changes to
copy_virtio_drivers.
2015-10-30 10:32:43 +00:00
Richard W.M. Jones
b00a2151ab v2v: utils: Refactor xpath_* functions.
No change, just refactoring.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
bd65e346d8 v2v: utils: Add a utils.mli file defining the interface. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
6a688c5119 v2v: utils: Remove unused function compare_app2_version_min. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
e9bd10897d v2v: utils: Comment fix. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
7f19420cfe v2v: utils: Move three utility functions to where they are used.
The three utility functions xml_quote_attr, xml_quote_pcdata and
uri_escape were only used in a single module.  Move them close to
where they are used.

This is just code refactoring.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
e7f8c064cf v2v: utils: Don't open Types module. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
0dffbb7d94 v2v: Move the open_guestfs function into Common_utils.
Removes the somewhat ugly inclusion of this function in Types.  Also
means we can use this function elsewhere.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
63952d9666 ocaml: Rename Config module as Guestfs_config.
Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
f4783fcc0d docs: Group guestfs(3) 'SEE ALSO' into sections. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
15b8b6453d docs: Move security documentation to guestfs-security(1). 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
74fba6e692 docs: Move architecture and internals documentation to guestfs-internals(1). 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
d07515b947 docs: Move 'extending libguestfs' documentation to guestfs-hacking(1).
Start to split the huge, monolithic guestfs(3) manual page.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
a87218c271 configure: Move FUSE checks to separate file.
This is moved earlier because it's now part of the C library.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
cdcd1e7c98 configure: Move misc. library checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
34304f5e3d configure: Move appliance checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
dfa9dee775 configure: Move daemon checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
56884b6543 configure: Move C library checks to separate file. 2015-10-30 09:45:02 +00:00
Richard W.M. Jones
4a67b4be93 configure: Move basic C compiler environment checks to separate file.
Also gnulib stuff.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
1d73d93130 configure: Move detection of external programs to a separate file.
Do this early since these tests generally don't depend on anything
else (the external program is either there or its not), and because
other things depend on some of these tests.
2015-10-30 09:45:02 +00:00
Richard W.M. Jones
671525bfdd configure: Move qemu detection to separate file. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
7adf7e26de configure: Move bash completion detection to separate file. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
3683b5f57f configure: Move Perl program / man page detection into m4/guestfs_perl.m4. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
51811c80a1 configure: Move (old, Perl) tools detection into m4/guestfs_perl.m4. 2015-10-30 09:45:01 +00:00
Richard W.M. Jones
21d41daec0 configure: Move language binding detection to separate files.
The extra files don't have to be added to EXTRA_DIST, as it appears
that autotools already knows that it has to add them.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
db5ebecd8a Revert "resize: add function find_partitions"
This reverts commit 5aa7e99cb9.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
3258695162 Revert "resize: add function calculate_target_partitions"
This reverts commit 21677c5b46.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
8ad069c402 Revert "resize: add function mbr_part_type"
This reverts commit fc34e2d16c.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
b1a7903fd1 Revert "resize: add p_mbr_p_type as member of type partition"
This reverts commit 6e989fd709.
2015-10-30 09:45:01 +00:00
Richard W.M. Jones
20ae8bd9ec v2v: windows: Don't do NTFS heads fix if i_root is not a partition (RHBZ#1276540).
The error was:

libguestfs: trace: pread_device = "NTFS    "
libguestfs: trace: part_to_dev "/dev/sda"
guestfsd: main_loop: new request, len 0x34
guestfsd: error: device name is not a partition
guestfsd: main_loop: proc 272 (part_to_dev) took 0.00 seconds
libguestfs: trace: part_to_dev = NULL (error)
virt-v2v: error: libguestfs error: part_to_dev: device name is not a
partition
2015-10-30 08:51:52 +00:00
Richard W.M. Jones
25fee09a44 builder: Add Debian 7 sparc64 image. 2015-10-27 18:18:50 +00:00
Maxim Perevedentsev
f5caa421d1 Added xfs support to vfs_minimum_size. 2015-10-27 17:25:49 +00:00
Pino Toscano
a4da3f74c9 builder: run virt-resize with --unknown-filesystems=error
This way, we can make sure that if a template needs to be expanded, the
result will have all the filesystems correctly expanded, fitting into
the new sizes of their partitions.
2015-10-27 17:49:57 +01:00
Pino Toscano
4f97f6866c resize: add --unknown-filesystems
Introduce a new option to control how virt-resize behaves when asking to
expand a filesystem, either unknown to libguestfs or that virt-resize
cannot expand. The default keeps the current behaviour, i.e. just warn.
2015-10-27 17:49:57 +01:00
Maxim Perevedentsev
858a9de297 Added btrfs support to vfs_minimum_size. 2015-10-27 14:58:42 +00:00
Pino Toscano
3734d76f1a build: look for Module::Build instead of ExtUtils::MakeMaker
Module::Build is now used for building the Perl bindings, so look for it
instead of the old module.

Followup of commit f98e0f115b.
2015-10-26 13:08:58 +01:00
Richard W.M. Jones
638761e6df Version 1.31.20. 2015-10-25 17:07:01 +00:00
Richard W.M. Jones
31c42e9c11 perl: Fix location of generator_build Guestfs.xs.
Also add MANIFEST to EXTRA_DIST.

This fixes commit f98e0f115b.
2015-10-25 17:06:06 +00:00
Richard W.M. Jones
f98e0f115b perl: Switch to using Module::Build.
Replace ExtUtils::MakeMaker with Module::Build.

'perllocal.pod' and 'bindtests.pl' are no longer incorrectly
installed.

This change also removes the following phony deps: appliance src_deps
test_images.  No other language binding needs explicit dependencies
for their tests, they just rely on the top level build order being
correct (ie. SUBDIRS in /Makefile.am).
2015-10-24 12:36:28 +01:00
Richard W.M. Jones
1c506aa960 ocaml: Allow 'make install' to be run twice.
'ocamlfind install' doesn't like to install the same package if it is
already installed.  It will give errors like:

  ocamlfind: Package guestfs is already installed

or:

  ocamlfind: Conflict with file: /usr/lib64/ocaml/guestfs/mlguestfs.cmxa

Fix this by removing the old installed files before running
'ocamlfind install'.  An alternative would be to use
'ocamlfind uninstall', but this seems more direct.
2015-10-24 12:36:28 +01:00
Richard W.M. Jones
905a9c54e6 builder: Allow 'make install' to be run twice.
The error is:

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

There is no 'LN_SF' macro, but according to the documentation at
least, it should be safe to add a '-f' flag since it will work for
both the 'ln' and 'cp' variants of the macro.
2015-10-24 12:36:18 +01:00
Maxim Perevedentsev
474f6525c8 Bugfix in number parsing in vfs_min_size. 2015-10-23 10:05:09 +01:00
Pino Toscano
a1b7540b78 v2v: -o libvirt: dump XML for libvirt if verbose
When running in verbose mode, dump the XML we created for libvirt:
this way it is easier to debug mismatches between what we want to setup
in libvirt, and what actually gets defined.
2015-10-22 14:39:03 +02:00
Pino Toscano
f56031d549 v2v: -o libvirt: fix <video> element (RHBZ#1225789)
Create the correct tags for <video> in the libvirtxml, so all the
attributes are in a <model> child of <video> instead of <video> itself.

Adapt the XML of test-v2v-i-ova to the different expected XML.
2015-10-22 14:10:16 +02:00
Pino Toscano
d8f248ffb4 po-docs: generate virt-dib and virt-get-kernel docs 2015-10-22 11:20:35 +02:00
Pino Toscano
0f04263000 build: isolate common po-docs logic
Move most of the content of either po-docs/ja/Makefile.am or
po-docs/uk/Makefile.am to po-docs/language.mk, and use it exclusively
instead of the former contents of the languange-specific Makefile.am.
This way, either adding a new documentation or enabling a new language
will not require copying over the same make code.
2015-10-22 11:13:48 +02:00
Pino Toscano
8d8fa9cf4a v2v: fix identifier
Set the "virtio_win" identifier to the right Guestfs handle.

Fixes commit f7249a0bcc.
2015-10-21 18:03:46 +02:00
Pino Toscano
6aea0e21ad v2v: use open_guestfs everywhere
Use the common open_guestfs to open Guestfs handles, so we get
debugging, tracing, and other common options set.
2015-10-21 18:03:46 +02:00
Pino Toscano
8a9d056163 v2v: move open_guestfs to Types
Move most of open_guestfs to Types, so a common function to open a
Guestfs handle is available.  Since it does not do all the things the
old open_guestfs did, the two operations have been moved to the only
place requiring them.

This function has been placed in Types and not Utils, as will be needed
by other functions in Types; Utils uses Types, so this avoids a circular
dependency.
2015-10-21 18:03:46 +02:00
Richard W.M. Jones
9ecfd8a94f p2v: Set the virt-p2v ISO timeout to 60 seconds (not 6 seconds).
Thanks: Dennis Gilmore.
2015-10-21 15:46:08 +01:00
Richard W.M. Jones
34d1b2678b p2v: Add dracut-live to the kickstart (RHBZ#1168223).
Thanks: Dennis Gilmore for working out what was missing.
2015-10-21 15:21:11 +01:00
Pino Toscano
b5a6f899cd actions: turn some params into FilenameList (RHBZ#1174551).
Use FilenameList as type for lists of file names, as used in some
listing-alike APIs.  This way we can ensure anything different than just
file names in those lists is rejected outright.

As a consequence, test-big-dirs.pl does not need to prepend the
directory name anymore before calling listing-alike APIs: previously
they didn't fail, but the returned lists contained only invalid
elements (and only their size was checked).

Furthermore, add a new regression test for it.
2015-10-21 13:00:18 +02:00
Pino Toscano
7c10cda266 generator: add a FilenameList parameter type
Mostly like StringList (so it can used in current StringList
parameters), but checking client- and daemon-side that the elements are
file names.
2015-10-21 13:00:18 +02:00
Pino Toscano
64cb0f5dad tests: use fake-virt-tools also in tests outside v2v
We have phony tools for v2v tests, introduced with
commit c1af1ba32f126b7be275bcc8cd4ea4e5af27a88e; make use of it also in
tests related to v2v outside the v2v directory.
2015-10-21 13:00:18 +02:00
Richard W.M. Jones
2b50bad568 docs: Move guestfs-release-notes(1) to docs/ subdirectory.
I have also removed the text equivalent of this file.  Originally I
added this because it was thought good to have the release notes
available in a format that doesn't require any special tools to read.
But:

 - POD files are basically text.

 - Debian tooling generates the text file in a slightly different way
   from Fedora tooling, resulting in git marking the file as being
   updated when it isn't really.

 - github can format and display POD files.
2015-10-21 11:26:16 +01:00
Richard W.M. Jones
6219e61cba Move miscellaneous documentation from examples/ to docs/.
Wasn't very logical putting these doc files in the examples directory.
2015-10-21 11:17:14 +01:00
Richard W.M. Jones
eb36df827b guestfs-performance: Add a note about Xen dom0. 2015-10-21 10:36:07 +01:00
Richard W.M. Jones
0294b1f9b2 guestfs-performance: Use lowercase in =head2 sections.
Makes it easier to read.
2015-10-21 10:35:03 +01:00
Richard W.M. Jones
a86a7d0f07 Version 1.31.19. 2015-10-20 23:53:21 +01:00
Maxim Perevedentsev
8296933ade Include resize2fs_P into vfs_minimum_size. 2015-10-20 18:26:22 +01:00
Maxim Perevedentsev
b8d4ca686b New API: vfs_minimum_size
This call provides the way to get minimum size of filesystem.
This is needed for shrinking. The return units are bytes.
2015-10-20 18:26:22 +01:00
Roman Kagan
e9b32e1bad v2v: add test for --in-place
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Roman Kagan
3c3873bc9a v2v: document --in-place
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Roman Kagan
d0069559a9 v2v: add --in-place mode
In this mode, converting of the VM configuration, setting up the
rollback path for error cases, transforming the VM storage and so on is
taken care of by a third-party toolset, and virt-v2v is only supposed to
tune up the guest OS directly inside the source VM, to enable it to boot
and run under the input hypervisor.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 18:26:22 +01:00
Pino Toscano
fe62f4727f Add a regression test for RHBZ#1011907 / RHBZ#1165785
Test case adapted from Hu Zhang's RHBZ#1242853, thanks.
2015-10-20 18:02:23 +02:00
Richard W.M. Jones
44889b7d53 Version 1.31.18. 2015-10-20 16:56:00 +01:00
Roman Kagan
fa40934aad v2v: factor out opening and populating guestfs handle
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
7ad0c1eee9 v2v: factor out preserving overlays for debugging
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
5c1e068e60 v2v: factor out copying of output data
Factor out copying the overlays to final disk images into a separate
function.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
48345d0d83 v2v: factor out determining the guest firmware
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
030c6fb63e v2v: factor out actual guest transformation
Factor out perfoming the actual convertion of the guest, which includes
determinig the appropriate guest os specific conversion module and
running its conversion routine.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
5dae9ca23d v2v: factor out size checks
Factor the size checks out to separate functions.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 15:17:27 +01:00
Roman Kagan
a61f148186 v2v: factor out populating targets list
Besides, it doesn't need guestfs handle open so move this step earlier
in the process.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Roman Kagan
d59a43aa65 v2v: factor out overlay creation
Iterating over source disks and creating temporary overlays for easy
rollback fits nicely into a separate function.  In addition, determining
their size doesn't need to wait until the guestfs is launched: the size
can be obtained via disk_virtual_size() method.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Roman Kagan
3ca8c04273 v2v: factor out opening input VM
Opening the source VM and amending the properties in its internal
representation in accordance with command-line options fit nicely into
two isolated functions.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-20 14:45:41 +01:00
Richard W.M. Jones
754a43142c inspect: Include more information for augeas parse errors (RHBZ#1229119)
If Augeas fails to parse a file, more information is available in at
least these fields:

><fs> aug-ls /augeas/files/etc/fstab/error
/augeas/files/etc/fstab/error/char
/augeas/files/etc/fstab/error/lens
/augeas/files/etc/fstab/error/line
/augeas/files/etc/fstab/error/message
/augeas/files/etc/fstab/error/pos

Pull out some of these fields and add them to the error message.
The new error message looks like this:

  virt-v2v: error: libguestfs error: /etc/fstab:17:4: augeas parse failure:
  Iterated lens matched less than it should

This updates commit 279addeb7d.
2015-10-16 10:22:00 +01:00
Richard W.M. Jones
bc2b417784 lib: Define HAVE_LIBVIRT_BACKEND where you have too old libvirt to run the backend.
In the case where libvirt was installed, but is too old to run the
backend, the libvirt backend would be compiled out but still
referenced by the library.

Fix this by splitting the definition of HAVE_LIBVIRT (libvirt is
installed at all) and HAVE_LIBVIRT_BACKEND (libvirt is new enough to
run the libvirt backend).

Reported by: Efstratios Skleparis.
2015-10-16 10:01:36 +01:00
Pino Toscano
279addeb7d inspect: check for errors in files parsed with augeas (RHBZ#1229119)
During the inspection phase, check for errors after aug_load: if any of
the errors happened in any of the requested files, then report the error
straight away; ignoring the error means that information would be
silently lost.  For example, a malformed /etc/fstab would have caused
the inspection to not handle any of the additional mount points, giving
cryptic errors later on when trying to access files in any of the mount
points.

Now guests with invalid files such as /etc/fstab, /etc/mdadm.conf, and
/etc/sysconfig/network will cause the inspection to fail, instead of
being reported with a single mount point ('/').
2015-10-15 18:14:49 +02:00
Pino Toscano
45bb7c8bcb mllib: move is_regular_file there
Move the is_regular_file function, implemented in virt-dib and virt-v2v,
to Common_utils.
2015-10-15 16:24:25 +02:00
Richard W.M. Jones
42c60abfbd v2v: Curry Changeuid.func. 2015-10-15 14:38:29 +01:00
Richard W.M. Jones
01ede002db v2v: Rename Kvmuid module to Changeuid.
It has nothing to do with KVM.
2015-10-15 14:32:30 +01:00
Richard W.M. Jones
2587db8f18 Version 1.31.17. 2015-10-15 14:24:10 +01:00
Richard W.M. Jones
b50f341576 v2v: Add unit test for virtio_iso_path_matches_guest_os. 2015-10-15 13:23:29 +01:00
Richard W.M. Jones
6b02513bb2 v2v: Rename match_vio_path_with_os -> virtio_iso_path_matches_guest_os.
Just refactoring.  Having the function name begin with 'match' was a
bit confusing because it can look similar to a match statement.
2015-10-15 12:25:04 +01:00
Richard W.M. Jones
2cb86bc4dc lib: Add comment and regression test for case where main process has large heap.
Thanks: Dan Berrangé for identifying the problem.
2015-10-15 11:04:48 +01:00
Richard W.M. Jones
25bde98cb1 lib: info: Move common code for setting child rlimits.
This is almost just refactoring, but I also set the memory
limit to really 1 GB, and not 1×10⁹.
2015-10-15 11:04:48 +01:00
Roman Kagan
169bc884a5 v2v: drop useless forced gc
Now that virtio driver copying is localized in a single function and the
auxiliary guestfs handle doesn't leak outside of it (and thus an extra
qemu instance doesn't survive beyond that function's runtime) there's no
need in the forced GC which used to trigger closing of that handle and
termination of that qemu instance.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Roman Kagan
f7249a0bcc v2v: copy virtio drivers without guestfs handle leak
Refactor copying of virtio windows drivers into the guest so that the
matching of the drivers to the guest os flavor and copying the files
happens one next to the other in a single function, and no guestfs
handle (nor any other irrelevant info) is leaked outside.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Roman Kagan
4ff0bfc336 v2v: consolidate virtio-win file copying
Copy the appropriate driver files from the virtio-win storage into
%SYSTEMROOT%\Drivers\VirtIO once they are discovered, and stick to using
those copies later on.

This way the knowledge of where the drivers come from originally is
consolidated in one place, so the lifetime of the associated entities
becomes easier to control (to be implemented in followup patches).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-15 11:04:48 +01:00
Maxim Perevedentsev
a5e7823c92 New API: resize2fs_P
Added support for getting ext2/3/4 filesystem minimum size.
This is needed primarily for shrinking images.
2015-10-14 17:11:54 +01:00
Richard W.M. Jones
3bf70226f6 v2v: test harness: Suggest using make check -k. 2015-10-14 14:45:48 +01:00
Richard W.M. Jones
b486ae1631 v2v: test harness: Use I<> quoting around command line parameter. 2015-10-14 14:45:29 +01:00
Pino Toscano
753bf99f5c builder: fix conversion of double to OCaml (RHBZ#1270011).
Create the OCaml value for double using caml_copy_double, which is
the correct way, simplier, and works.
2015-10-12 16:38:50 +02:00
Richard W.M. Jones
1f23a2c3a9 Version 1.31.16. 2015-10-09 17:55:19 +01:00
Richard W.M. Jones
9090408ea1 v2v: -i libvirt: Fix comment. 2015-10-09 17:46:36 +01:00
Richard W.M. Jones
5cdff50d8a v2v: Refactor the map_source_to_uri function.
Move this function to the VCenter module.  This is easier since it
doesn't have to do dcPath calculation (see previous commit).

The readhead parameter is no longer labelled.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
ffea9f9792 v2v: Use libvirt-supplied <vmware:datacenterpath> if available.
In libvirt >= 1.2.20, the VMware libvirt driver supplies the correct
dcPath to use via <vmware:datacenterpath> in the libvirt XML.  If
libvirt passes us this element, use it.

This code still allows the user to override dcPath using the --dcPath
option on the command line, but that's mainly for safety so we can fix
any problems in virt-v2v or libvirt in the field.  As we get more
confident in libvirt and as libvirt 1.2.20 is more widely adopted, we
will be able to deprecate this parameter entirely.

Thanks: Matthias Bolte for adding the <vmware:datacenterpath> element
to libvirt in
https://libvirt.org/git/?p=libvirt.git;a=commit;h=636a99058758a0447482f3baad94de8de3ab1151
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
a8c725071d v2v: Move VCenter functions to library module.
This refactors useful VCenter functions out of the large
'input_libvirt_vcenter_https.ml' file.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
d4431886c7 v2v: Move curl functions to library module.
This refactors the curl functions used to talk to vCenter into a
library module.
2015-10-09 13:21:07 +01:00
Richard W.M. Jones
6fb4428358 v2v: Fix bogus comment. 2015-10-09 13:21:07 +01:00
Richard W.M. Jones
6334261497 inspect: Don't free uninitialized string.
libguestfs: trace: v2v: read_lines "/etc/os-release"
[...]
libguestfs: trace: v2v: read_lines = ["NAME=Fedora", "VERSION="20 (Heisenbug)"", "ID=fedora", "VERSION_ID=20", "PRETTY_NAME="Fedora 20 (Heisenbug)"", "ANSI_COLOR="0;34"", "CPE_NAME="cpe:/o:fedoraproject:fedora:20"", "HOME_URL="https://fedoraproject.org/"", "BUG_REPORT_URL="https://bugzilla.redhat.com/"", "REDHAT_BUGZILLA_PRODUCT="Fedora"", "REDHAT_BUGZILLA_PRODUCT_VERSION=20", "REDHAT_SUPPORT_PRODUCT="Fedora"", "REDHAT_SUPPORT_PRODUCT_VERSION=20"]

At this point libguestfs segfaulted.

It seems as if 'major' is not used here, so don't try to free it.

This fixes commit 32d19e3289.
2015-10-09 12:35:06 +01:00
Richard W.M. Jones
4f9899dd01 Version 1.31.15. 2015-10-08 22:05:19 +01:00
Richard W.M. Jones
48ae2d1dd1 handle: Free g->identifier on close.
This fixes commit f6e13aeb65.
2015-10-08 21:49:37 +01:00
Richard W.M. Jones
108c8173fa v2v: Add xpath_int64 functions, and use them to read memory values.
On 32 bit platforms, reading the memory values can cause some numbers
to be read as negative numbers.  Fix this by treating memory values as
64 bit integers throughout the parsing and calculation.
2015-10-08 20:14:04 +01:00
Richard W.M. Jones
37360159bf Version 1.31.14. 2015-10-08 19:51:43 +01:00
Richard W.M. Jones
e5fd9b54dd test/qemu: Fix free/close of log file.
The log file was not being closed at the right time, resulting in the
process running out of open files.  Also the log filename buffer was
not freed.

This fixes commit 7bbf5cab28.
2015-10-08 17:04:05 +01:00
Richard W.M. Jones
bd0b52d08e v2v: Use handle identifier in a few places.
Set the handle identifier of the main handle to "v2v".

Whenever we open a second handle for any substantial operation, set
the handle identifier for that handle too.

This should make traces clearer.
2015-10-08 16:52:43 +01:00
Roman Kagan
a94019f52f v2v: add test for v2v with virtio-win drivers on iso
For that, add autofoo machinery to generate the iso out of the fake
virtio-win drivers introduced in the previous patches, and pass the
resulting image in $VIRTIO_WIN to v2v in a new test otherwise similar to
test-v2v-windows-conversion.sh.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:37:19 +01:00
Roman Kagan
3c26dbf309 v2v:tests: use fake virtio-win drivers
In order to test the copying of virtio-win drivers into the guest during
v2v, create a set of fake virtio-win drivers and make use of them in the
corresponding v2v tests.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:37:18 +01:00
Richard W.M. Jones
7bbf5cab28 tests/qemu: Add qemu-boot --log option.
This option can be used to direct output from each individual
boot test to a different file.  Usual usage is:

  qemu-boot --log /tmp/output.% -v -x -n 1000
2015-10-08 16:35:25 +01:00
Richard W.M. Jones
f291411f76 Add the thread identifier to various multi-threaded programs and tests. 2015-10-08 16:35:24 +01:00
Richard W.M. Jones
f6e13aeb65 New APIs: set-identifier, get-identifier
Add a per-handle identifier.  The main effect of this is to change
trace output from:

  libguestfs: trace: foo

to:

  libguestfs: trace: ID: foo

which makes it simpler to follow traces from multi-threaded programs.
2015-10-08 16:35:24 +01:00
Roman Kagan
5f352f6eea v2v:test:win: actually check the eventual layout
v2v/test-v2v-windows-conversion.sh used to query if the expected
directories and files were present in the VM upon conversion; however it
would ignore the results of that query.

That lead to the test passing even though the checks failed.

To fix it, parse the output of guestfish and verify that all is-file and
is-dir commands report the expected "true".

The approach taken is slightly more elaborate than what is being used in
other components, but it allows to generate comprehensible reports in
case of test failure, and facilitates future expansion of the set of
checks including negative ones.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Roman Kagan
2fabb89fee v2v: add fake rhev-apt.exe
Without rhev-apt.exe the code path where firstboot scripts are created
isn't taken, so it isn't tested and v2v/test-v2v-windows-conversion.sh
is supposed to fail (it actually doesn't but for another reason,
addressed in a followup patch).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Roman Kagan
c1af1ba32f v2v:tests: use fake rhsrvany.exe
The tests that depend on rhsrvany.exe being available, actually don't
need it to be the real one: all they want is the file being present.

So, instead of skipping the tests if the real rhsrvany.exe is not found,
store a fake one in the repository, and point $VIRT_TOOLS_DATA_DIR at
its location.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-08 16:34:48 +01:00
Pino Toscano
0f414edd11 build: use libintl where needed
Followup of commit a5426cce5f.
2015-10-08 16:31:54 +02:00
Pino Toscano
4d3466af68 fuse: test-fuse: close files even on errors
Make sure to close the open files even when test_fuse() returns earlier
because of failures, otherwise the mountpoint is still in use by open
files when later guestunmount is called on it.
2015-10-08 13:34:03 +02:00
Richard W.M. Jones
411e8e30e7 v2v: Skip test-v2v-o-libvirt.sh on !x86_64. 2015-10-07 17:26:22 +01:00
Richard W.M. Jones
95fe361215 Version 1.31.13. 2015-10-07 14:24:37 +01:00
Richard W.M. Jones
b1f11ef75b ocaml/examples: Fix use of event_callback in debug_logging.ml.
This fixes commit 8bbc5e73cb.
2015-10-07 14:16:00 +01:00
Richard W.M. Jones
a332e23dde ocaml/examples: Remove all programs in 'make clean'.
Previously the debug_logging program was not being deleted.
2015-10-07 14:15:05 +01:00
Richard W.M. Jones
9c97cc720b Version 1.31.12. 2015-10-07 14:02:56 +01:00
Richard W.M. Jones
63d1a8050a configure: Check that OCaml version >= 3.11. 2015-10-07 13:25:32 +01:00
Richard W.M. Jones
585a7e1f3e ocaml: Add regression test for failure of implicit close. 2015-10-06 22:28:54 +01:00
Richard W.M. Jones
8bbc5e73cb ocaml: Allow Guestfs.t handle to be garbage collected.
** NB: This is an API break for OCaml programs using Guestfs.event_callback. **

Because of the way I implemented Guestfs.event_callback which had the
Guestfs.t handle as the first parameter, we had to store the (OCaml)
Guestfs.t handle in the C handle's private data area.  To do that, we
had to create a global root pointing to the handle.

This of course meant that the handle could not be garbage collected
(thanks Roman Kagan for spotting this).

This changes the API of Guestfs.event_callback so that a handle is no
longer passed.  The OCaml handle can now be garbage collected again.

For programs that need the Guestfs.t handle in the callback function
(which turns out to be *none* of the OCaml programs we have written),
you can do:

  g#set_event_callback (callback_fn g) [Guestfs.EVENT_FOO];

In this case, since the closure passed to Guestfs.set_event_callback
is still registered as a global root, that will capture a reference to
the handle, so the handle won't be able to be garbage collected until
you delete the callback.
2015-10-06 22:28:27 +01:00
Richard W.M. Jones
3858db9d58 ocaml: Use generational global roots.
These are considerably more efficient than ordinary global roots, but
with the caveat that the program is not allowed to modify them without
calling a special function.  We don't modify them, so this change is
safe.

This requires OCaml >= 3.11, but we have that on RHEL 6
(since we dropped support for RHEL 5).

See also:
http://caml.inria.fr/pub/ml-archives/caml-list/2008/03/c3bf86990088236ceeb9a0f0f4c35390.en.html
2015-10-06 15:53:31 +01:00
Richard W.M. Jones
0944acf90c mllib: Replace various ad hoc string_* functions with String.*
This is just a straight refactoring.  Various ad hoc string_*
functions that appeared in Common_utils have been renamed and placed
in the String.* namespace.  The old vs "new" functions are:

string_prefix  -> String.is_prefix
string_suffix  -> String.is_suffix
string_find    -> String.find
replace_str    -> String.replace
string_nsplit  -> String.nsplit
string_split   -> String.split
string_lines_split -> String.lines_split
string_random8 -> String.random8
2015-10-06 13:40:34 +01:00
Richard W.M. Jones
47892b580b mllib: Hide unsafe lower/uppercase functions.
The ones in the OCaml stdlib assume ISO-8859-1 bytes and strings, and
so can end up corrupting UTF-8 strings.
2015-10-06 12:50:36 +01:00
Richard W.M. Jones
932e5ad089 mllib: Add (Char|String).(lower|upper)case_ascii functions.
These functions come from upstream OCaml (4.03) where they were
written by Gabriel Scherer under a compatible license.

See also:
http://caml.inria.fr/mantis/view.php?id=6694
http://caml.inria.fr/mantis/view.php?id=6695
2015-10-06 12:49:47 +01:00
Richard W.M. Jones
672920f3e9 mllib: Override Char and String modules from stdlib.
In Common_utils, override the Char and String modules from stdlib.
This hides the original (stdlib) modules, and means that whenever you
use Char.foo or String.foo you are in fact calling the
Common_utils.Char.foo or Common_utils.String.foo function.

As it stands, this change does nothing, but it will allow us to drop
unsafe functions (like String.lowercase) and add extra functions.
2015-10-06 12:34:30 +01:00
Richard W.M. Jones
7d7a1aeeac mllib: Don't alias G = Guestfs in Common_utils module. 2015-10-06 12:23:21 +01:00
Richard W.M. Jones
bdedb47cf0 tests: Don't leave a libguestfs tmpdir lying around after running test-launch-race.pl.
Calling _exit(2) in the child process has the side effect that
tmp/libguestfsXXXXXX is not cleaned up.  Clean it up by ensuring the
handle is properly closed before _exit.
2015-10-06 11:47:08 +01:00
Richard W.M. Jones
3b56001583 tests: Fix test-launch-race.
This test has been broken for a while.  It is meant to test that when
the appliance cachedir is empty, two simultaneous runs of libguestfs
(both rebuilding the full appliance) will not cause conflicts, because
(eg) the locking in either supermin or libguestfs is not working.

However the test only set $TMPDIR, but the ./run script sets
$LIBGUESTFS_CACHEDIR which overrides $TMPDIR, so it was simply reusing
the existing appliance, and hence not testing anything.

Fix this by clearing $LIBGUESTFS_CACHEDIR.

Note the test now takes a lot longer to run since it does a full
appliance rebuild.
2015-10-06 11:44:48 +01:00
Richard W.M. Jones
cab3d5d2f6 builder: Remove duplicate planner transition.
Seems to be a copy and paste bug in
commit 62cc7d3361.
2015-10-06 11:22:21 +01:00
Richard W.M. Jones
540ce6a4e5 clean: Remove null.* and sockets from builddir tmp/ subdirectory. 2015-10-05 22:00:13 +01:00
Richard W.M. Jones
fe4630e033 Update translations from Zanata.
However I reverted the Catalan file since it did not appear to be
newer than the version provided in
commit 6404114515.
2015-10-05 20:39:31 +01:00
Richard W.M. Jones
dd1dbc5191 Version 1.31.11. 2015-10-05 17:13:18 +01:00
Pino Toscano
7c1bb1b40c p2v: fix mode for gtk_label_set_line_wrap_mode
Accoding to its documentation [1], it takes as second parameter a
PangoWrapMode and not a GtkWrapMode.  While the change should reflect
the actual value intended, it should slightly change the label wrap
mode: GTK_WRAP_WORD is 2, which corresponds (as int value) to
PANGO_WRAP_WORD_CHAR.

[1] https://developer.gnome.org/gtk2/stable/GtkLabel.html#gtk-label-set-line-wrap-mode
2015-10-05 15:43:35 +02:00
Pino Toscano
29e6368f4c daemon: use str_udevadm in udev_settle
There is GUESTFSD_EXT_CMD defining a string for udevadm (so it is marked
as "used tool" in the appliance), but it is not actually used when
starting udevadm.

There should be no behaviour change.
2015-10-05 15:43:35 +02:00
Pino Toscano
d98c9c0e0b Fix shebang in perl scripts
Instead of hardcoding the location of perl (assuming it is installed in
/usr), use /usr/bin/env to run it, and thus picking it from $PATH.
This makes it possible to run these scripts also on installations with
perl in a different prefix than /usr.

Also, given that we want enable warnings on scripts, turn the -w
previously in shebang to explicit "use warnings;" in scripts which
didn't have it before.
2015-10-05 15:43:35 +02:00
Pino Toscano
1e0cbe6681 lib: include <sys/socket.h> for accept4
Apparently implicitly pulled by something else on Linux, it is not when
building on e.g. FreeBSD.

This reverts the change to this file of
commit 3b17152ec3.
2015-10-05 15:43:35 +02:00
Pino Toscano
b530bc764e Revert "lib: Don't need to include <rpc/types.h>."
The include is not needed with GNU libc, where rpc/xdr.h includes it
[1].  But this does not happen on other libc's, for example the
FreeBSD [2] and Mac OS X [3] ones.

Hence put it back, with an extra comment about this.

[1] http://linux.die.net/man/3/xdr
[2] http://www.freebsd.org/cgi/man.cgi?query=xdr&sektion=3&apropos=0&manpath=freebsd
[3] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/xdr.3.html

This reverts commit ada85d1566.
2015-10-05 15:43:35 +02:00
Richard W.M. Jones
8554dbbc03 Remove multiple hacks that only apply to RHEL 5.
We don't support RHEL 5 upstream (see the 'oldlinux' branch for a
version that works with RHEL 5).  Therefore remove a bunch of hacks
that were only needed on RHEL 5.
2015-10-05 14:32:28 +01:00
Richard W.M. Jones
677c721e85 Fix whitespace.
Because of previous automated commits, such as changing 'guestfs___'
-> 'guestfs_int_', several function calls no longer lined up with
their parameters, and some lines were too long.

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

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

The changes suggested by emacs were then reviewed by hand.
2015-10-05 14:28:33 +01:00
Richard W.M. Jones
d07b32e14f Change 'fprintf (stdout,...)' -> printf.
Result of earlier copy and paste.
2015-10-05 14:28:33 +01:00
Roman Kagan
82763c0444 v2v:utils: ignore files w/o extension
When searching for virtio drivers, it makes no sense to fail if we
encounter a file without extension.

Ignore such files instead, just like we do for the files whose extension
doesn't match that of a driver-related file.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-10-05 14:28:33 +01:00
Pino Toscano
1f47ba92f2 actions: fix documented limit for btrfs labels
Our documentation of set-label says that labels for btrfs are limited
to 256 characters, while btrfs-filesystem(1) says:

  Note
  the maximum allowable length shall be less than 256 chars

which is indeed true, as trying to set a label with 256 characters
fails. Hence, fix our documentation to say that the limit is actually
255 characters.

Related to RHBZ#1164708.
2015-10-05 11:41:03 +02:00
Richard W.M. Jones
67bd4f37a1 Version 1.31.10. 2015-10-04 20:03:46 +01:00
Richard W.M. Jones
5d2ebb7076 launch: direct: Use a single -machine [type, ]accel=... option.
Previously we used (on arm): -M virt -machine accel=...

After this change, we use: -machine virt,accel=...
On x86 there is no change.

The -M option is an abbreviation for -machine, and we can combine the
two options together.  (Qemu combines the two options internally, but
it's more predictable if we do it ourselves).

Upstream qemu has supported the -machine option for over 5 years, and
in fact we implicitly relied on it (despite what the comment in the
code said).
2015-10-04 19:20:35 +01:00
Richard W.M. Jones
45cc5489b2 launch: Change comment.
Making -machine configurable would be a really bad idea.
2015-10-04 19:20:35 +01:00
Cédric Bosdonnat
bc8e1ff9ae customize: remove zypper's gpg keys auto-import
This option was considered unsecure, found a fix on the generated
opensuse images instead.
2015-10-02 17:21:47 +01:00
Pino Toscano
9c836e8669 ruby: improve rdoc markup
- fix the syntax of hyperlinks
- replace the deprecation text with a simplier named list item, so it's
  more visible
- use a named list item for the pointer to the C documentation of each
  API
- add a named list item for the version of each API
2015-10-02 15:30:38 +02:00
Robert Antoni Buj Gelonch
6404114515 add Catalan in po/Makefile.am 2015-10-02 12:25:20 +01:00
Richard W.M. Jones
7bc6fb2451 build: Remove ./configure --enable-valgrind-daemon.
If you've ever tried to use this option, you'll know that it didn't
work well.  It broke random things (probably RHBZ#1020216, definitely
RHBZ#1023630), and caused random failures generally, while often not
actually failing when valgrind itself found problems.
2015-10-01 15:32:49 +01:00
Richard W.M. Jones
4414de775a ocaml: Conditionally remove bindtests.* when doing 'make install'.
Commit f6a790b67d changed the Makefile
so it only builds the tests when you run 'make check'.

If you didn't run 'make check' then (in particular) bindtests won't be
built, and so when you install it cannot be removed.

The simple fix for this is to make the removal of bindtests.*
conditional.

This fixes commit f6a790b67d.
2015-10-01 14:17:52 +01:00
Richard W.M. Jones
2c519cf055 Add missing generated files to generator_built and EXTRA_DIST.
Use the generator_built variable to list any files which are built by
the generator.  This ensures they get automatically rebuilt.

Three files were missing from EXTRA_DIST, so they were not included in
the tarball, meaning you would have needed OCaml to build from the
tarball.  You would have seen this when building:

  cd .. && /builddir/build/BUILD/libguestfs-1.31.9/generator/generator
  written gobject/docs/guestfs-title.sgml
  written customize/customize-synopsis.pod
  written customize/customize-options.pod
  generated 476921 lines of code
2015-10-01 14:13:30 +01:00
Cédric Bosdonnat
3b4f83e0b2 customize: sles password defaults. 2015-10-01 13:01:59 +01:00
Richard W.M. Jones
24d2230831 Version 1.31.9. 2015-09-30 17:30:47 +01:00
Cédric Bosdonnat
d0aa7a032c Add opensuse.gpg to the dist tarball
Adding missing opensuse.gpg to EXTRA_DIST.
2015-09-30 16:04:12 +01:00
Richard W.M. Jones
3f3d9353a3 ocaml: Improve ocamldoc.
Miscellaneous improvements to the ocamldoc:

 - Generate more sub-headings.

 - Document the object-oriented API.

 - Use a common function to generate the doc for module and OO APIs.
2015-09-30 14:19:12 +01:00
Richard W.M. Jones
b482593a07 ocaml: Use ocamlfind to run ocamldoc.
Using 'ocamlfind ocamldoc' is much faster than running 'ocamldoc'
directly, because ocamlfind will run the native code program
'ocamldoc.opt' if it is available.

This change approximately halves the time taken to compile the ocaml
bindings.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
84598ef6f5 daemon: Compile stubs.c first.
This shaves about 20% off the compile time for the daemon subdirectory.

See also:
https://rwmj.wordpress.com/2015/09/30/make-and-queuing-theory/#content
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
538c5d5eb7 java: Only build the tests when running 'make check'.
Make the tests 'check_DATA' so they only get built when running the
tests.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
f6a790b67d ocaml: Only build the tests when running 'make check'.
Make the tests 'check_DATA' so they only get built when running the
tests.  This saves a couple of seconds on the build time.
2015-09-30 13:33:39 +01:00
Richard W.M. Jones
3b17152ec3 lib: Remove unused header files.
I used ESR's deheader program to look for unused includes.  I then
examined each instance by hand, and also test-compiled (on Linux).
2015-09-30 13:32:42 +01:00
Richard W.M. Jones
ada85d1566 lib: Don't need to include <rpc/types.h>.
It is already included by <rpc/xdr.h>.
2015-09-30 13:32:42 +01:00
Richard W.M. Jones
c938202bc8 lib: Move <libintl.h> -> files that use it.
Don't include <libintl.h> (for gettext etc) in <guestfs-internal.h>.
Include include it only in files that use internationalized strings.
2015-09-30 13:32:42 +01:00
Pino Toscano
2ff115a736 copy-in: error out early if the localpath does not exist 2015-09-30 10:55:38 +02:00
Cédric Bosdonnat
4bb4c0f4f7 builder: add opensuse images sources 2015-09-30 10:55:37 +02:00
Richard W.M. Jones
8571c1298a haskell: Remove whitespace in Makefile.am. 2015-09-29 22:45:19 +01:00
Richard W.M. Jones
491b3d4f44 Version 1.31.8. 2015-09-29 19:02:33 +01:00
Cédric Bosdonnat
66efad4172 customize: get zypper to eat licenses and gpg keys
Without these flags --install will most likely fail as the GPG key
may no be imported in the guest image.
2015-09-29 17:48:19 +01:00
Richard W.M. Jones
bbc4a649b4 copy-in/copy-out: Capture errors from tar subprocess (RHBZ#1267032).
Modify the copy-in/copy-out APIs to use the new guestfs_int_cmd_pipe
internal API.

This new API allows us to capture the stderr from the tar subprocess
if it fails, fixing RHBZ#1267032.  The user will now see errors like
this:

$ guestfish -N fs -m /dev/sda1 copy-in '/tmp/d/*' / : ll /
libguestfs: error: tar subprocess failed: tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2015-09-29 12:51:14 +01:00
Richard W.M. Jones
e98bb86929 cmd: New internal API for read/writing to a subprocess via a pipe.
Roughly equivalent to popen(...,"r"|"w") the new internal API allows
you to run a subprocess and either read its stdout, or write to its
stdin.
2015-09-29 12:51:13 +01:00
Richard W.M. Jones
2fc1e14625 cmd: Move all the common processing code for running the child into a subfunction.
Anything that doesn't involve pipes [parent-child communication] is
moved into the run_child function, so we can reuse the same code when
writing the new pipe APIs (see following commit).  Anything involving
setting up pipes stays in the existing run_command function.

This is just refactoring.
2015-09-29 12:45:22 +01:00
Richard W.M. Jones
60aa4238c4 lib: Move read_whole_file function into separate library.
Allow this useful function to be called from elsewhere.

This commit is almost, but not completely refactoring.  I made a minor
change to the function so that it \0-terminates the returned data,
which is convenient for some callers.
2015-09-29 12:44:25 +01:00
Richard W.M. Jones
73928e9e35 lib: Whitespace cleanups. 2015-09-29 11:16:38 +01:00
Richard W.M. Jones
1b6f0daa9a Revert "cmd: add a way to run (and wait) asynchronously commands"
This reverts commit c5d3d198dc.
2015-09-29 11:06:10 +01:00
Richard W.M. Jones
3c27f3d91e Revert "cmd: add the possibility to get a fd to the process stdin"
This reverts commit db055262d4.
2015-09-29 11:05:07 +01:00
Richard W.M. Jones
5786191718 v2v: Further information on using ovftool to create OVA files.
c9291a91b0 (commitcomment-13440884)

Thanks: GitHub user https://github.com/angystardust
2015-09-25 20:24:21 +01:00
Richard W.M. Jones
f37d363f18 v2v: Update /etc/sysconfig/kernel DEFAULTKERNEL (RHBZ#1176801). 2015-09-25 13:55:46 +01:00
Richard W.M. Jones
c9291a91b0 v2v: Mention ovftool in the man page as a way to create OVA files. 2015-09-25 10:36:36 +01:00
Richard W.M. Jones
2d1d485265 installcheck: Use 'make check -k' option.
Run all the tests, even if some of them fail, so you can easily see
the complete list of failures.  This still exits with an error if any
test fails.
2015-09-22 14:16:54 +01:00
Richard W.M. Jones
cc1c010aa0 Version 1.31.7. 2015-09-20 15:26:15 +01:00
Richard W.M. Jones
3fa674df5f Remove make-check-on-installed.pl from EXTRA_DIST.
Removed in commit f2540d68e4.
2015-09-18 17:31:21 +01:00
Richard W.M. Jones
dd61872582 configure: Require OCaml and findlib if we need to run the generator.
When building from git, you need OCaml to compile the generator to
build the generated files.  Previously configure didn't detect that
situation, resulting in failed builds.  This commit causes the
configure script to error out if the generated files are not present
and OCaml is not installed.

Note that you can still build without OCaml, if you get the generated
files from somewhere else.  The source tarballs distributed on the
website contain the generated files.
2015-09-18 15:55:57 +01:00
Richard W.M. Jones
bc0ea59587 v2v: documentation: Add link to import-to-ovirt.pl script. 2015-09-18 14:12:17 +01:00
Richard W.M. Jones
dda1a7c37c v2v: documentation: Add 'OTHER TOOLS' section.
This currently contains just a link to rhevm-image-uploader.
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
38be2da9be python: Set program name to the true name instead of 'python'.
As in commit e102bcf3cf (for Perl), any
Python program has the handle program name field set to 'python'.  Set
it to the true name (derived from sys.argv[0]).
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
bb7d088eda python: Allow bindings to be compiled with different version of libguestfs (RHBZ#1262983).
When compiling the libguestfs bindings as a pip module, it's helpful
if you can compile the bindings with a different version of libguestfs
(eg. installed 1.28, pip module 1.30).

That broke the previous assumption that we were always compiling
against precisely the same version of libguestfs (which made sense
because the python bindings are part of the libguestfs source tree).

Python distutils has no way to check a C library to find out if
functions are defined.  Therefore we have to rely on GUESTFS_HAVE_*
macros from <guestfs.h>.
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
ac5b3a050d header: Define GUESTFS_HAVE_STRUCT_* for each struct defined in the header. 2015-09-18 14:12:17 +01:00
Richard W.M. Jones
a17627cdd2 header: Define GUESTFS_HAVE_* for every function.
Previously we only defined GUESTFS_HAVE_* macros for functions that
were not deprecated, test or debug functions.  The reasoning for that
is given in this commit message [note that 'LIBGUESTFS_HAVE_' is the
old/deprecated macro]:

  commit 2d8fd7dacd
  Author: Richard Jones <rjones@redhat.com>
  Date:   Thu Sep 2 22:45:54 2010 +0100

    Define LIBGUESTFS_HAVE_<shortname> for C API functions.

    The actions each have a corresponding define, eg:

      #define LIBGUESTFS_HAVE_VGUUID 1
      extern char *guestfs_vguuid (guestfs_h *g, const char *vgname);

    However functions which are for testing, debugging or deprecated do
    not have the corresponding define.  Also a few functions are so
    basic (eg. guestfs_create) that there is no point defining a symbol
    for them.

This wasn't in fact carried through very consistently, since when we
replaced s/LIBGUESTFS_HAVE_/GUESTFS_HAVE_/, we kept the old
LIBGUESTFS_HAVE_* macros, but defined them for every function.  Oops.

This commit defines GUESTFS_HAVE_* for every function in <guestfs.h>,
making it easier to write the Python language bindings (see following
commits).
2015-09-18 14:12:17 +01:00
Richard W.M. Jones
f2540d68e4 Add 'make installcheck' rule to test installed packages.
Allow the tests to be run on the installed libguestfs.so library and
on installed programs (but not installed language bindings, yet).

To run the tests, you have to have a copy of the libguestfs source
tree with exactly the same version as the installed libguestfs.  You
have to build the libguestfs source tree.  Then you do:

  make installcheck

I investigated making automake 'make installcheck' work, but it's
basically broken (no surprise there).

This is derived from the old 'make-check-on-installed.pl'
script (which is also removed in this patch).
2015-09-18 14:12:17 +01:00
Pino Toscano
59a9101e44 daemon: initrd: print return value from failing process
If either zcat or cpio fails when spawned in initrd-list, pclose will
return the actual return value of it, but reply_with_perror still uses
errno regardless; thus, the reported error is:

  libguestfs: error: initrd_list: pclose: Success

which is not much helpful.

Instead, when pclose returns > 0, extract the actual return value of the
subprocess, and print that. Thus now we get for example:

  libguestfs: error: initrd_list: pclose: command failed with return code 1
2015-09-15 10:19:58 +02:00
Richard W.M. Jones
e102bcf3cf perl: Set program name to the true name instead of 'perl'.
Currently any Perl program has the handle program name field set
to 'perl'.  Set it to the true name (derived from $0).
2015-09-13 13:45:32 +01:00
Shahar Lev
1b856a20ba v2v: fix provides list whitespace trim
Tabs should not be doubly-escaped in regexp.

Signed-off-by: Shahar Lev <shahar@stratoscale.com>
2015-09-13 11:47:52 +01:00
Richard W.M. Jones
7fb21afff6 Version 1.31.6. 2015-09-11 15:28:39 +01:00
Richard W.M. Jones
edcd02a965 launch: libvirt: Better error when bridge / virbr0 doesn't exist (RHBZ#1262127).
The current diagnostic is terrible.  This one tells the user how to
diagnose and fix the problem.
2015-09-10 23:06:20 +01:00
Richard W.M. Jones
0ed3855098 v2v: Add --dcpath parameter to allow dcPath to be overridden (RHBZ#1256823).
It's currently impossible to correctly predict the dcPath parameter
from the data that libvirt gives us.  So allow the user to override
--dcpath themselves.

Eventually we will get better support in libvirt for this, and this
option will no longer be needed:

  https://www.redhat.com/archives/libvir-list/2015-September/thread.html#00201

This enhances commit 51bc573d0c
and commit 20f1eb400b.
2015-09-10 12:38:56 +01:00
Pino Toscano
1b8dd2150b builder: fix prototype virt_builder_yajl_tree_parse
Declare the prototype depending whether libyajl is available, and if it
isn't add also the noreturn attribute.

Fixes commit 87a42174f9.
2015-09-10 11:12:53 +02:00
Pino Toscano
32d19e3289 inspect: try to use /etc/os-release on Linux guests
If a Linux guest has /etc/os-release (mandatory for systemd, so all the
recent Linux distributions have it), try to parse it for the distro, its
version, and its product name.  If we cannot get all of them, the
detection as done so far continues.

Other than changes in the product_name string (which is free-form
anyway, and already documented to not be parseable), there should be no
regressions in the detected distro and version.
2015-09-09 16:17:59 +02:00
Richard W.M. Jones
e3aee9c14d v2v: -o rhev, -o vdsm: Set DefaultDisplayType back to 1 (RHBZ#1260590).
In commit c4bc8116d9, the DefaultDisplayType
was changed from 1 -> 2.  However this is in fact wrong.  See
https://bugzilla.redhat.com/show_bug.cgi?id=1260590#c17 for details.

This reverts the code back to what it was in
commit 829e3fe7a6.

Thanks: Omer Frenkel
2015-09-09 13:47:19 +01:00
Richard W.M. Jones
d68be534ea v2v: Detect AVG Technologies as AV software (RHBZ#1261436).
Thanks: Junqin Zhou
2015-09-09 13:33:12 +01:00
Richard W.M. Jones
6734fce8c8 v2v: Move anti-virus (AV) detection code to a separate module.
This is just code refactoring of earlier
commit 8e28d6b188.
2015-09-09 13:33:12 +01:00
Pino Toscano
27becc7e2f builder: handle output filenames with ':'
Use qemu_input_filename for the output file in the qemu-img convert
invocation.

See also commit 1709263613 for
virt-sparsify.
2015-09-09 13:19:57 +02:00
Pino Toscano
87a42174f9 builder: add noreturn for yajl functions without libyajl
caml_invalid_argument will not return, and GCC warns (or errors out with
-Werror) when the function is not marked as such.
2015-09-09 10:50:01 +02:00
Pino Toscano
1b4c1d74d3 customize: password: use SHA-512 on openSUSE >= 11.0
openSUSE 11.0 has glibc 2.8, which supports the SHA-512 method.
Fallback to an explicit MD5 for older versions.
2015-09-08 19:07:23 +02:00
Pino Toscano
f788b3c48d inspect: recognize the Frugalware distribution
Just basic identification, name and version.
2015-09-08 19:05:49 +02:00
Richard W.M. Jones
6c3bc24f90 Version 1.31.5. 2015-09-08 14:20:28 +01:00
Pino Toscano
6d08da07dc build: improve maintainer-check-extra-dist target
Filter out from the git ls-files output the files we don't care they
appeared (gnulib and intltools stuff), and use comm to only show the
remaining added files (i.e. files not being distributed).

The output of comm is redirected to file and then printed, so we can
check it is empty (failing the target if not).
2015-09-08 12:08:43 +02:00
Cédric Bosdonnat
fb9c17c8d4 Allow curl to follow redirects.
download.opensuse.org uses redirects to point to the relevant mirror.
Adding -L --max-redirs 5 to curl options will get us the requested
images.
2015-09-08 12:08:43 +02:00
Pino Toscano
268de62db6 builder: distribute simplestreams test files
Fixes commit b024aef6fb.
2015-09-08 11:51:49 +02:00
Pino Toscano
c8436df4a2 builder: replace colons in simplestreams test files
Colons won't be handled by make at all, so replace them with underscore
to be able to distribute them.
2015-09-08 11:51:49 +02:00
Richard W.M. Jones
c4bc8116d9 v2v: -o rhev, -o vdsm: Use correct DefaultDisplayType for qxl (RHBZ#1260590).
This fixes commit 829e3fe7a6.
2015-09-08 09:11:36 +01:00
Richard W.M. Jones
5ed4388ecd customize: Create .ssh as 0700 and .ssh/authorized_keys as 0600 (RHBZ#1260778).
Both ssh-copy-id and ssh create .ssh as 0700.  ssh-copy-id creates
.ssh/authorized_keys as 0600.

Thanks: Ryan Sawhill for finding the bug.
2015-09-08 09:09:40 +01:00
Pino Toscano
b024aef6fb builder: support Simple Streams v1.0 as index metadata
Add a new "simplestreams" repository type, and a simple parser for
fetching and reading the JSON indexes of the Simple Streams v1.0
format.

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

Add a simple test, using the "released" images from the CirrOS project.
2015-09-08 09:51:49 +02:00
Pino Toscano
13eac43e28 build: expose HAVE_YAJL to automake
This way it can be used in automake conditionals.
2015-09-08 09:51:49 +02:00
Pino Toscano
23d1719105 builder: add simple libyajl binding
Only yajl_val and yajl_tree_parse are exposed for now.
2015-09-08 09:51:49 +02:00
Pino Toscano
7dfbb1f11c builder: add non-int revisions
Add support for non-integer revisions of entries, comparing them as
integer when possible.
2015-09-08 09:51:48 +02:00
Richard W.M. Jones
8e28d6b188 v2v: windows: Warn if Group Policy or AV software may result in 7B boot failure (RHBZ#1260689).
Check if the Windows guest has Group Policy Objects installed, or one
of several popular pieces of anti-virus software.  If we are
installing a virtio block driver, then experience has shown this may
cause a 7B boot failure.

Print a warning when this combination happens.

The warnings look like this:

[  19.9] Converting Windows Server 2008 R2 Enterprise to run on KVM
virt-v2v: warning: this guest has Windows Group Policy Objects (GPO) and a
new virtio block device driver was installed.  In some circumstances, Group
Policy may prevent new drivers from working (resulting in a 7B boot error).
 If this happens, try disabling Group Policy before doing the conversion.
virt-v2v: warning: this guest has Anti-Virus (AV) software and a new virtio
block device driver was installed.  In some circumstances, AV may prevent
new drivers from working (resulting in a 7B boot error).  If this happens,
try disabling AV before doing the conversion.
virt-v2v: This guest has virtio drivers installed.
2015-09-07 17:47:21 +01:00
Richard W.M. Jones
8f889f0c3e v2v: windows: Refactor Xen uninstaller detection code.
No change, just refactoring.
2015-09-07 17:17:49 +01:00
Richard W.M. Jones
4335088d74 dib: Move 'isdigit' utility function to common code.
No change, just simple refactoring.
2015-09-07 16:53:17 +01:00
Richard W.M. Jones
4ded4430bf v2v: -o rhev, -o vdsm: Add sound card to OVF output.
For the two sound card types that RHEV can emulate, add
them to the output.
2015-09-07 15:00:50 +01:00
Richard W.M. Jones
829e3fe7a6 v2v: -o rhev, -o vdsm: Review XML based on oVirt description of format.
After reviewing http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt
this commit makes some small revisions to the OVF that we generate.

Possible fix for https://bugzilla.redhat.com/show_bug.cgi?id=1260590
2015-09-07 15:00:44 +01:00
Richard W.M. Jones
e271992746 v2v: Error if certain options appear twice on the command line.
Change the handling of -ic, -if, -oc, -of, -on, -os, --password-file,
--vdsm-vm-uuid, --vdsm-ovf-output, --vmtype options, so that if any
appear multiple times on the command line we error out:

$ virt-v2v -i disk /tmp/centos-6.img -o null -of qcow2 -of raw
virt-v2v: error: -of option used more than once on the command line

Thanks: Juquin Zhou for finding the bug.
2015-09-07 12:18:21 +01:00
Richard W.M. Jones
0afe4773d0 Version 1.31.4. 2015-09-03 21:49:56 +01:00
Richard W.M. Jones
7e63d3680f v2v: test-harness: Allow test boot at fixed dates in the past.
Turns out that some of the Windows guests in the test suite try to
reactivate if the date is more than some time delta (maybe 1 year?)
after the previous activation.  Just disabling the network wasn't
enough to prevent this.

qemu allows us to boot guests with the clock set to a particular date
in the past, and libvirt exposes this (albeit very clumsily):

https://docs.fedoraproject.org/en-US/Fedora/18/html/Virtualization_Administration_Guide/sect-Virtualization-Tips_and_tricks-Libvirt_Managed_Timers.html

Allow guests to be booted with the date set to a particular past date,
by setting the test_plan.guest_clock field.

This required adding some more libxml2 bindings.
2015-09-03 20:11:07 +01:00
Richard W.M. Jones
6246bebf82 p2v: Clear previous version and driver information when testing connection (RHBZ#1227609).
When calling test_connection to test the connection to a conversion
server, we also query for the remote server's version and driver
information (using 'virt-v2v --version' and
'virt-v2v --machine-readable').

However we didn't clear the existing information from previous runs.

One consequence of this was that if you used the back button in the
GUI, the list of output drivers would be repopulated two or more
times.  https://bugzilla.redhat.com/show_bug.cgi?id=1227609

Another is that connecting to a different server could confuse
test_connection into thinking the connection was successful (because
of data from the previous run) when in fact it was not.

Thanks: Tingting Zheng for finding the original bug.
2015-09-03 16:12:22 +01:00
Richard W.M. Jones
302ea2aa5b p2v: Use gtk_list_store_clear instead of loop.
The model implements GtkListStore, so an easier way to clear the list
is simply to call the clear method.
2015-09-03 16:06:59 +01:00
Richard W.M. Jones
314713c3b0 p2v: Use GtkComboBoxText instead of deprecated gtk_combo_box_new_text.
Requires Gtk >= 2.24, which is the same version that RHEL 6 has.
2015-09-03 15:56:19 +01:00
Pino Toscano
cf3d93c826 get-kernel: respect -q
Now that virt-get-kernel has -q/--quiet, support it by printing the
download messages only if not specified.
2015-09-02 00:25:55 +02:00
Pino Toscano
45f6cfe1a1 get-kernel: refactor list and download code
Split in an own function the code dong the mounting, the inspection of
the kernel files, and the downloading, including a per-OS function for
the actual kernel files.  This gives few advantages:
- the download phease is not repeated for all the files to fetch
- it is easier to eventually support multi-root disk images
- it is possible to support OSes different than Linux; virt-get-kernel
  now will just report the unsupported OS, instead of a generic
  "no kernel found" message

This is mostly code refactoring, with (on Linux) no actual behaviour
change.
2015-09-02 00:25:55 +02:00
Pino Toscano
997c59139e get-kernel: split command line handling in own function
Simple refactoring, no actual behaviour changes.
2015-09-02 00:25:55 +02:00
Pino Toscano
b360e99ff6 builder, dib, get-kernel: document new -q/--quiet options
Provided as common options for all the OCaml-based tools.
2015-09-02 00:25:55 +02:00
Pino Toscano
2ec0332e5e mllib: move -q/--quiet as common option
Most of the OCaml-based tools had it already, except from virt-dib and
virt-get-kernel.
2015-09-02 00:25:55 +02:00
Pino Toscano
875f46fddc mllib: make few command line options stuff private
Make print_version_and_exit, long_options, display_short_options, and
display_long_options private, as set_standard_options now takes care of
handling the job for the common command line options.
2015-09-02 00:25:55 +02:00
Richard W.M. Jones
51bc573d0c v2v: Fix handling of extra slashes in dcPath calculation (RHBZ#1258342).
This updates commit 20f1eb400b.

Thanks: Tingting Zheng
2015-09-01 14:56:10 +01:00
Pino Toscano
4cc3cc3fbd mllib: set --debug-gc as common option
Move --debug-gc as common option for all the OCaml-based tools, even a
couple of them which didn't have it previously.

As implementation note, make set_debug_gc private to
set_standard_options, as it needed to be moved otherwise, and it is no
more required as public function.
2015-08-31 18:34:37 +02:00
Pino Toscano
2af6e48ba3 mllib: add and use set_standard_options
Introduce a new common helper to add the common options for libguestfs
tools (short/long options, version, verbose, trace), and sort them.
All the OCaml-based tools had these options already, so there are no
functional changes in the interface they provide.

The only difference is that now the options are always sorted, while
some tools didn't had them like that previously: because of this, a
couple of ditto markers (as descriptions) don't match what's above them
anymore, and thus their full description is put instead.
2015-08-31 18:25:48 +02:00
Pino Toscano
7bdb3e0df9 customize: fix running commands on the same architecture
Wrap the command around an heredoc only if setarch needs to be used;
otherwise the heredoc will not be run at all.

Fix commit d875346ad4.
2015-08-31 17:55:14 +02:00
Richard W.M. Jones
2596b78bcb Version 1.31.3. 2015-08-28 19:34:15 +01:00
Richard W.M. Jones
95233a8eee p2v: Add test-virt-p2v-pxe.sshd_config.in to EXTRA_DIST.
Fixes commit afe3c77014.
2015-08-28 19:32:15 +01:00
Richard W.M. Jones
d875346ad4 customize: Use setarch when running commands on i686 guest (RHBZ#1256405).
When running (eg) dnf on a 32 bit i686 guest when the host is 64 bit
x86_64, dnf believes it is running on a 64 bit machine and so tries to
install x86_64 packages.  We can 'trick' dnf into believing it's a 32
bit machine using the setarch program.

$ virt-builder fedora-22 --arch i686 --install 'gperf'
...
[  27.4] Installing packages: gperf
...
Running transaction test
Error: Transaction check error:
  package libgcc-5.1.1-4.fc22.x86_64 is intended for a different architecture
...

The use of a heredoc to solve quoting issues comes from:
http://stackoverflow.com/a/3435460

Thanks: Jan Sedlák for finding the solution.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
18b019e3dd v2v: -i libvirtxml: Map empty network or bridge name to default (RHBZ#1257895).
As with the -i ova driver, if an unnamed network is found, map it to
"eth0", "eth1" etc.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
261d05749f v2v: Convert xpath_to_* to use xpath convenience functions.
In -i libvirtxml, -i ova and -o libvirt drivers, replace the ad hoc
xpath_to_* functions with use of the new xpath convenience functions
introduced in the previous commit.

This is not entirely refactoring because I fixed a few bugs found by
type safety.
2015-08-28 19:09:17 +01:00
Richard W.M. Jones
00e1260d34 v2v: Add convenience functions for parsing xpath expressions. 2015-08-28 19:09:17 +01:00
Richard W.M. Jones
20f1eb400b v2v: vcenter: Calculate dcPath correctly (RHBZ#1256823).
Previously given a path such as:

  vpx://vcenter/Folder/Datacenter/esxi

we calculated dcPath=Folder.  However this is obviously wrong.  We
should chop the path at the final (esxi) element to give
dcPath=Folder/Datacenter.
2015-08-28 17:53:41 +01:00
Richard W.M. Jones
1585bb5bee v2v: vcenter: Change function get_datacenter -> get_dcPath.
In vCenter, the datacenter is identified by a path, and the parameter
used for this is called 'dcPath'.  Rename the function to avoid any
confusion about what we're getting here.

This is just renaming function/variable names and has no other effect.
2015-08-28 17:53:41 +01:00
Roman Kagan
a628fb65fa handle --debug-gc universally via at_exit hook
Several tools handle --debug-gc command-line option, by explicitly
forcing GC on every exit path.  This is tedious and prone to forgetting
some of the exit paths.

Instead, add a generic handler for --debug-gc, which installs an at_exit
hook to do the GC consistency check, and which can be called right in
the command-line parser.  Also adjust all users of --debug-gc to use
that handler.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2015-08-28 17:53:41 +01:00
Richard W.M. Jones
afe3c77014 p2v: Add a test for the PXE boot path (RHBZ#1256222).
Build the P2V disk image and boot it.  We don't actually use PXE
specifically, but we do test the whole PXE / kernel command line path
much more thoroughly.

This is a 'check-slow' test because it takes ages to run.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
ca4725e1c7 p2v: Add SSH Identity URL.
Allow SSH identities (ie. secret keys) to be used for authentication
instead of passwords.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
3c30fb4a79 Revert "p2v: Add tip about the root password of the virt-v2v conversion server appliance."
This reverts commit 35efaf8208.
2015-08-27 15:42:55 +01:00
Richard W.M. Jones
4c34d240a1 p2v: Wait for network to come online before testing connection (RHBZ#1256222).
When using the virt-p2v ISO in command line mode, we did not wait for
the network to come online before starting virt-p2v.  Therefore
virt-p2v could exit with an error when testing the ssh connection (or
on the other hand, it might work randomly).  If the user logs in and
runs 'launch-virt-p2v' by hand, then it would usually work because the
network had been brought online in the meantime.

Fix this by waiting for NetworkManager to bring the connection online
before calling test_connection().  Note that the obvious way to fix
this (changing the systemd service to wait for network-online.target)
does *not* work - I added a comment to the service about this.

Thanks: Tingting Zheng
2015-08-27 15:42:55 +01:00
Pino Toscano
c1e1e23285 osinfo: add altlinux and mageia distributions 2015-08-25 17:39:26 +02:00
Pino Toscano
70579d08cd inspect: recognize the ALT Linux distribution
Check its presence ahead of /etc/redhat-release, as the distro provides
it and thus previously it was recognized as "redhat-based".
2015-08-25 16:17:59 +02:00
Pino Toscano
74f0b45ddf v2v: ignore missing kernels from grub (RHBZ#1230412)
Raise a warning for each kernel specified in grub which does not
actually exist, keep going on with the conversion using the remaining
(existing) kernels.
2015-08-24 18:25:10 +02:00
Pino Toscano
baa4ec6e45 ocaml: Add handling for errno ENOENT. 2015-08-24 18:11:18 +02:00
Pino Toscano
649f439cb7 ocaml: dynamically generate the content of Guestfs.Errno
Put in a list the errnos to expose, filling the content of the
Guestfs.Errno submodule from that.
Also, generate a separate guestfs-c-errnos.c with the implementations of
the functions returning the errno codes.

Only code motion and refactoring, no actual changes on the content of
the ocaml Guestfs module.
2015-08-24 17:57:10 +02:00
Pino Toscano
0dcb862943 configure: look for "java" as directory for Java in lib64 too
On 64-bit openSUSE versions, /usr/lib64/jvm/java provides the symlink to
the default Java version.
2015-08-20 17:25:34 +02:00
Pino Toscano
e6dd9b5d6b appliance: explicitly add libyajl on Mageia
It seems yajl was bringing it, but seems not on Mageia 5.  Leave yajl
for older versions.
2015-08-19 14:46:39 +02:00
Richard W.M. Jones
97bd64f588 FAQ: the -> and in previous commit.
This fixes commit 571fca8e71.
2015-08-13 22:54:30 +01:00
Richard W.M. Jones
571fca8e71 FAQ: Further improve debugging section. 2015-08-13 22:51:43 +01:00
Richard W.M. Jones
8828005691 Version 1.31.2. 2015-08-13 16:46:08 +01:00
Richard W.M. Jones
08b57ae1f4 builder/website: Fix EXTRA_DIST.
This fixes commit 190a9f4534 and
commit 864ca489ac.
2015-08-13 16:45:30 +01:00
Richard W.M. Jones
c9ad61b37b p2v: Modify some partial match regexps to work with pcre 7.8.
pcre < 8 has limitations on the types of partial matching
possible.  As noted in the pcrepartial(3) man page, these can
be worked around by adding non-capturing parentheses around
various subexpressions, as I have done here.
2015-08-13 15:48:36 +01:00
Richard W.M. Jones
92e155dbdd p2v: For pcre < 8 (RHEL 6), abort if partial matching cannot be used on a regexp. 2015-08-13 15:48:36 +01:00
Richard W.M. Jones
1d082d127e p2v: Print an error if gtk_init_check fails.
Apparently gtk_init_check doesn't (always?) print an error message
when it returns false, so virt-p2v just exits without any message.

This was observed on RHEL 6 when $DISPLAY was not set.
2015-08-13 14:13:49 +01:00
Richard W.M. Jones
2bfb9ff9ea p2v: Call g_thread_init with old glib2 as used by RHEL 6. 2015-08-13 13:51:11 +01:00
Richard W.M. Jones
00bceec421 v2v: Help RHEL 6 OCaml to determine type of class.
File input_libvirt_other.ml, line 1, characters 0-1:
Error: The implementation input_libvirt_other.ml
       does not match the interface input_libvirt_other.cmi:
       Class declarations do not match:
         class virtual input_libvirt :
           'a ->
           string option ->
           string ->
           object
             method adjust_overlay_parameters : Types.overlay -> unit
             method as_options : string
             method virtual source : unit -> Types.source
           end
       does not match
         class virtual input_libvirt :
           string option ->
           string option ->
           string ->
           object
             method adjust_overlay_parameters : Types.overlay -> unit
             method as_options : string
             method virtual source : unit -> Types.source
           end
       A parameter has type 'a but is expected to have type string option
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
b0cd6917ca v2v: Hide StringMap functions we're not actually using.
In RHEL 6 OCaml, some of these functions were not part of the Map
class, giving an error.  Hide the ones we aren't using.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
437cb7b6ff handle: Move #pragma out of functions.
RHEL 6 gcc did not support #pragma within functions.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
06e92bffd4 p2v: Add replacement for xmlBufferDetach function not available in RHEL 6. 2015-08-13 13:23:59 +01:00
Richard W.M. Jones
42b6bb12dc v2v: -oa preallocated for qcow2 output now fully allocates the file (RHBZ#1251909).
When the output format is qcow2 and -oa preallocated is used,
previously it would only allocate the metadata.  That was a regression
over previous behaviour of virt-v2v 0.9.  Change it so it allocates
the full file size in this case.
2015-08-13 13:23:59 +01:00
Richard W.M. Jones
66daad38f3 disk-create: Allow preallocation off/metadata/full.
For raw, this allows "off" as a synonym for "sparse" (to make it
consistent with qcow2).

For qcow2, this allows "sparse" as a synonym for "off".

It also adds qcow2 "full" preallocation, which is actually mapped to
the qemu option "falloc" (see arguments about this on the qemu-devel
mailing list, which we lost).

This also updates the test.
2015-08-13 13:23:58 +01:00
Pino Toscano
d78f685c0e builder: normalize architectures
Normalize the target architecture, and also each architecture when
checking for a compatible image.

This sort of reverts the effects of
commit 8864c47b94, but at least it is
possible to build e.g. Debian-based amd64 images on any x86_64 system
without being considered as foreign architecture.
2015-08-12 18:22:34 +02:00
Pino Toscano
0bbb903f42 mllib: add normalize_arch helper
Small helper to normalize an architecture string, so it is easier to
compare them and check for compatibilities.

Make use of it in guest_arch_compatible, simplifying it.
2015-08-12 18:22:34 +02:00
Pino Toscano
90b459a5db dib: expand doc on external dependencies for appliance 2015-08-12 18:21:08 +02:00
John Eckersberg
c2bb87e8f2 dib: handle unsetting functions in environment
If a function name, with its trailing parentheses, is in the
environment , trying to unset it will error out with a message of "not
a valid identifier".  Handle this as a special case, and unset it with
the -f option which can handle the parentheses in the supplied
identifier.
2015-08-12 17:20:38 +02:00
Pino Toscano
70d020f074 inspect: support the APK package manager and its format
Associate the Alpine Linux distribution with it.
2015-08-12 16:23:45 +02:00
Pino Toscano
120f06a8a1 inspect: recognize the Alpine Linux distribution
Just basic identification, name and version.
2015-08-12 16:23:45 +02:00
Richard W.M. Jones
190a9f4534 builder: Add script for building RHEL for aarch64. 2015-08-12 14:00:24 +01:00
Richard W.M. Jones
f3a7cf994b customize: firstboot: Place firstboot.service file in systemd unit directory (RHBZ#1250955).
It turns out that -- some of the time -- systemd ignores unit files
which are not placed in one of the official unit directories.  This
caused the service to be timed out and killed when the systemd daemon
was reloaded, as could happen for long-running package installs at
first boot.

Thanks: Marius Vollmer for diagnosing the problem and finding the
solution.
2015-08-12 10:42:57 +01:00
Richard W.M. Jones
75006fc27c p2v: Add mesa-dri-drivers.
Requires on Fedora 22 to work around:
https://bugzilla.redhat.com/show_bug.cgi?id=1242195
2015-08-11 16:27:49 +01:00
Richard W.M. Jones
bfd151b8bf p2v: Add tar to the kickstart.
Work around https://bugzilla.redhat.com/show_bug.cgi?id=1182362
2015-08-11 15:49:28 +01:00
Richard W.M. Jones
6f74d8044b p2v: Add a note about building a 32- or 64-bit virt-p2v ISO. 2015-08-11 15:38:07 +01:00
Richard W.M. Jones
864ca489ac builder: Add script for building Fedora i686 (32 bit) images. 2015-08-11 13:56:55 +01:00
Richard W.M. Jones
8cb82aec12 builder: fedora: Use os variant fedora22. 2015-08-11 13:34:27 +01:00
Pino Toscano
4e5d9962ce builder: improve "converting" message on unknown format
If the format of the disk image of the template is not specified in the
index, virt-builder would print
  Converting auto to qcow2
when asking to generate a qcow2 image.  Instead, in this case print only
the destination format, like
  Converting to qcow2
2015-08-10 13:22:27 +02:00
Richard W.M. Jones
068443843d v2v: vCenter: Suggest using %20 to escape spaces in Datacenter paths (RHBZ#1250715). 2015-08-06 17:29:56 +01:00
Richard W.M. Jones
fc70ea696b docs: Document CVE-2015-5745 qemu vulnerability. 2015-08-06 16:41:09 +01:00
Richard W.M. Jones
f8a81d6bae update-bugs.sh: Remove comment. 2015-08-06 16:24:56 +01:00
Pino Toscano
1c43c0800f get-kernel: remove extra progname from error messages
error() prints it already
2015-08-06 15:15:40 +02:00
Richard W.M. Jones
16e6378a5b customize: Make dnf upgrade to the latest versions of packages.
I discovered that 'dnf upgrade' doesn't actually upgrade to the latest
versions of packages unless you also supply the '--best' flag.

This also changes update -> upgrade, since apparently 'dnf update'
is deprecated.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
91c06391c1 automake: Admit defeat and use 'subdir-objects'.
Because this 'feature' is broken (since 2013):

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928

we have to replace all instances of $(top_srcdir) in *_SOURCES lines
with a relative path.  According to what I read, this shouldn't break
split builds, but I didn't test it.

The only things automake moans about now are:

* Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.

  - This is another bug in automake

* autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION

  - This is a feature, not a bug.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
f3ed65525c p2v: Display full package version (including extra string) in p2v.ks file. 2015-08-05 13:01:12 +01:00
Richard W.M. Jones
da87760407 p2v: Allow 'virt-p2v-make-kickstart rhel-7.1' to set up RHEL repos. 2015-08-05 13:01:12 +01:00
Richard W.M. Jones
007004a536 p2v: Disable ssh service in the ISO (RHBZ#1248678).
We don't want people to be able to ssh into the p2v ISO while it is
running, with a simple, known root password.
2015-08-05 13:01:12 +01:00
Richard W.M. Jones
d9c6370831 sysprep: Allow test-virt-sysprep.sh to be skipped.
It fails in Fedora Rawhide because LVM is broken (RHBZ#1237136).
2015-08-02 17:33:07 +01:00
Richard W.M. Jones
12898a8862 dib: Fix typo in documentation.
Thanks: Yuri Chornoivan
2015-07-31 08:30:00 +01:00
1879 changed files with 1134718 additions and 715226 deletions

377
.gitignore vendored
View File

@@ -14,21 +14,27 @@
*.jar
*.la
*.lo
*.log
*.o
*.orig
*.patch
*.pyc
*.rej
*.swp
*.trs
bindtests.tmp
cscope.out
.deps
.dirstamp
dll*.so
.gdb_history
.libs
Makefile
Makefile.in
/.sc-*
/*.patch
/ABOUT-NLS
/aclocal.m4
/align/stamp-virt-alignment-scan.pod
@@ -42,33 +48,63 @@ Makefile.in
/appliance/stamp-supermin
/appliance/supermin.d
/autom4te.cache
/bash/guestunmount
/bash/virt-builder
/bash/virt-cat
/bash/virt-copy-in
/bash/virt-copy-out
/bash/virt-customize
/bash/virt-df
/bash/virt-dib
/bash/virt-diff
/bash/virt-edit
/bash/virt-filesystems
/bash/virt-format
/bash/virt-get-kernel
/bash/virt-inspector
/bash/virt-log
/bash/virt-ls
/bash/virt-p2v-make-disk
/bash/virt-p2v-make-kickstart
/bash/virt-p2v-make-kiwi
/bash/virt-resize
/bash/virt-sysprep
/bash/virt-sparsify
/build-aux
/bash/virt-tail
/bash/virt-tar-in
/bash/virt-tar-out
/build-aux/.gitignore
/build-aux/ar-lib
/build-aux/compile
/build-aux/config.guess
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/ltmain.sh
/build-aux/missing
/build-aux/snippet/
/build-aux/test-driver
/build-aux/ylwrap
/builder/.depend
/builder/index-parse.c
/builder/index-parse.h
/builder/index-scan.c
/builder/libguestfs.conf
/builder/opensuse.conf
/builder/oUnit-*
/builder/*.qcow2
/builder/stamp-virt-builder.pod
/builder/stamp-virt-index-validate.pod
/builder/test-config/virt-builder/repos.d/test-index.conf
/builder/test-console-*.sh
/builder/test-simplestreams/virt-builder/repos.d/cirros.conf
/builder/test-website/virt-builder/repos.d/libguestfs.conf
/builder/virt-builder
/builder/virt-builder.1
/builder/virt-index-validate
/builder/virt-index-validate.1
/builder/*.xz
/builder/yajl_tests
/cat/stamp-virt-*.pod
/cat/virt-cat
/cat/virt-cat.1
@@ -78,7 +114,22 @@ Makefile.in
/cat/virt-log.1
/cat/virt-ls
/cat/virt-ls.1
/cat/virt-tail
/cat/virt-tail.1
/ChangeLog
/common/errnostring/errnostring.c
/common/errnostring/errnostring-gperf.c
/common/errnostring/errnostring-gperf.gperf
/common/errnostring/errnostring.h
/common/miniexpect/miniexpect.3
/common/protocol/guestfs_protocol.c
/common/protocol/guestfs_protocol.h
/common/protocol/guestfs_protocol.x
/common/utils/guestfs-internal-frontend-cleanups.h
/common/utils/structs-cleanup.c
/common/utils/structs-print.c
/common/utils/structs-print.h
/common/utils/uefi.c
/compile
/config.cache
/config.guess
@@ -95,25 +146,25 @@ Makefile.in
/customize/customize-options.pod
/customize/customize-synopsis.pod
/customize/stamp-virt-customize.pod
/customize/test-firstboot-*.sh
/customize/test-password-*.sh
/customize/test-settings-*.sh
/customize/virt-customize
/customize/virt-customize.1
/daemon/actions.h
/daemon/errnostring.c
/daemon/errnostring-gperf.c
/daemon/errnostring-gperf.gperf
/daemon/errnostring.h
/daemon/dispatch.c
/daemon/guestfsd
/daemon/guestfsd.8
/daemon/guestfsd.exe
/daemon/guestfs_protocol.c
/daemon/guestfs_protocol.h
/daemon/install-sh
/daemon/missing
/daemon/names.c
/daemon/optgroups.c
/daemon/optgroups.h
/daemon/lvm-tokenization.c
/daemon/stamp-guestfsd.pod
/daemon/stubs.c
/daemon/stubs-?.c
/daemon/stubs.h
/depcomp
/df/stamp-virt-df.pod
/df/virt-df
@@ -125,39 +176,54 @@ 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
/docs/guestfs-performance.1
/docs/guestfs-recipes.1
/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
/docs/stamp-guestfs-performance.pod
/docs/stamp-guestfs-recipes.pod
/docs/stamp-guestfs-release-notes.pod
/docs/stamp-guestfs-security.pod
/docs/stamp-guestfs-testing.pod
/edit/stamp-virt-*.pod
/edit/virt-edit
/edit/virt-edit.1
/erlang/actions-?.c
/erlang/actions.h
/erlang/bindtests.erl
/erlang/dispatch.c
/erlang/erl-guestfs
/erlang/erl-guestfs.c
/erlang/examples/guestfs-erlang.3
/erlang/examples/stamp-guestfs-erlang.pod
/erlang/guestfs.beam
/erlang/guestfs.erl
/erlang/libguestfs-1.*
/erlang/structs.c
/examples/copy-over
/examples/create-disk
/examples/debug-logging
/examples/display-icon
/examples/guestfs-examples.3
/examples/guestfs-faq.1
/examples/guestfs-performance.1
/examples/guestfs-recipes.1
/examples/guestfs-testing.1
/examples/inspect-vm
/examples/libvirt-auth
/examples/mount-local
/examples/stamp-guestfs-examples.pod
/examples/stamp-guestfs-faq.pod
/examples/stamp-guestfs-performance.pod
/examples/stamp-guestfs-recipes.pod
/examples/stamp-guestfs-testing.pod
/examples/virt-dhcp-address
/fish/cmds.c
/fish/cmds-gperf.c
/fish/cmds-gperf.gperf
/fish/completion.c
/fish/entries-?.c
/fish/event-names.c
/fish/fish-cmds.h
/fish/guestfish
@@ -170,12 +236,15 @@ Makefile.in
/fish/prepopts.h
/fish/rc_protocol.c
/fish/rc_protocol.h
/fish/run-?.c
/fish/run.h
/fish/stamp-guestfish.pod
/fish/stamp-libguestfs-tools.conf.pod
/fish/stamp-virt-copy-in.pod
/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
@@ -193,8 +262,12 @@ Makefile.in
/fuse/test-guestmount-fd
/fuse/test-guestunmount-fd
/generator/.depend
/generator/bytes.ml
/generator/common_utils.ml
/generator/common_utils.mli
/generator/files-generated.txt
/generator/generator
/generator/guestfs_config.ml
/generator/.pod2text.data*
/generator/stamp-generator
/get-kernel/.depend
@@ -212,7 +285,6 @@ Makefile.in
/golang/examples/guestfs-golang.3
/golang/examples/stamp-guestfs-golang.pod
/golang/pkg
/guestfs-release-notes.1
/guestfsd-in-wine.log
/haskell/Bindtests
/haskell/Bindtests.hs
@@ -220,75 +292,41 @@ Makefile.in
/haskell/Guestfs030Config
/haskell/Guestfs050LVCreate
/haskell/Guestfs.hs
/html/guestfish.1.html
/html/guestfs.3.html
/html/guestfs-erlang.3.html
/html/guestfs-examples.3.html
/html/guestfs-faq.1.html
/html/guestfs-golang.3.html
/html/guestfs-java.3.html
/html/guestfs-lua.3.html
/html/guestfs-ocaml.3.html
/html/guestfs-performance.1.html
/html/guestfs-perl.3.html
/html/guestfs-python.3.html
/html/guestfs-recipes.1.html
/html/guestfs-release-notes.1.html
/html/guestfs-ruby.3.html
/html/guestfs-testing.1.html
/html/guestfsd.8.html
/html/guestmount.1.html
/html/guestunmount.1.html
/html/libguestfs-make-fixed-appliance.1.html
/html/libguestfs-test-tool.1.html
/html/libguestfs-tools.conf.5.html
/html/virt-alignment-scan.1.html
/html/virt-builder.1.html
/html/virt-cat.1.html
/html/virt-copy-in.1.html
/html/virt-copy-out.1.html
/html/virt-customize.1.html
/html/virt-df.1.html
/html/virt-dib.1.html
/html/virt-diff.1.html
/html/virt-edit.1.html
/html/virt-filesystems.1.html
/html/virt-format.1.html
/html/virt-get-kernel.1.html
/html/virt-index-validate.1.html
/html/virt-inspector.1.html
/html/virt-list-filesystems.1.html
/html/virt-list-partitions.1.html
/html/virt-log.1.html
/html/virt-ls.1.html
/html/virt-make-fs.1.html
/html/virt-p2v.1.html
/html/virt-p2v-make-disk.1.html
/html/virt-p2v-make-kickstart.1.html
/html/virt-rescue.1.html
/html/virt-resize.1.html
/html/virt-sparsify.1.html
/html/virt-sysprep.1.html
/html/virt-tar.1.html
/html/virt-tar-in.1.html
/html/virt-tar-out.1.html
/html/virt-v2v.1.html
/html/virt-v2v-test-harness.1.html
/html/virt-win-reg.1.html
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/inspector/virt-inspector
/inspector/virt-inspector.1
/installcheck.sh
/install-sh
/java/actions-?.c
/java/api
/java/Bindtests.java
/java/com_redhat_et_libguestfs_GuestFS.c
/java/com_redhat_et_libguestfs_GuestFS.h
/java/com/redhat/et/libguestfs/GuestFS.java
/java/doc-stamp
/java/examples/guestfs-java.3
/java/examples/stamp-guestfs-java.pod
/lib/actions-?.c
/lib/actions-variants.c
/lib/bindtests.c
/lib/event-string.c
/lib/guestfs.3
/lib/guestfs-actions.pod
/lib/guestfs-availability.pod
/lib/guestfs.h
/lib/guestfs-internal-actions.h
/lib/guestfs-structs.pod
/lib/libguestfs.3
/lib/libguestfs.pc
/lib/libguestfs.syms
/lib/.libs/libguestfs.so
/lib/libvirt-is-version
/lib/stamp-guestfs.pod
/lib/structs-compare.c
/lib/structs-copy.c
/lib/structs-free.c
/lib/unit-tests
/libguestfs.spec
/libguestfs-*.tar.gz
/libtool
@@ -313,13 +351,16 @@ Makefile.in
/make-fs/virt-make-fs.1
/missing
/mllib/.depend
/mllib/bytes.ml
/mllib/common_gettext.ml
/mllib/common_utils_tests
/mllib/config.ml
/mllib/dummy
/mllib/getopt_tests
/mllib/guestfs_config.ml
/mllib/JSON_tests
/mllib/libdir.ml
/mllib/oUnit-*
/mllib/visit_tests
/ocaml/bindtests.bc
/ocaml/bindtests.opt
/ocaml/bindtests.ml
@@ -331,6 +372,7 @@ Makefile.in
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
/ocaml/guestfs-c-actions.c
/ocaml/guestfs-c-errnos.c
/ocaml/guestfs.ml
/ocaml/guestfs.mli
/ocamlinit-stamp
@@ -342,27 +384,45 @@ Makefile.in
/p2v/dependencies.debian
/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
/p2v/test-virt-p2v-pxe.initramfs
/p2v/test-virt-p2v-pxe.sshd_config
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key.pub
/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
/p2v/virt-p2v.xz
/perl/_build
/perl/bindtests.pl
/perl/blib
/perl/Build
/perl/Build.PL
/perl/examples/guestfs-perl.3
/perl/examples/stamp-guestfs-perl.pod
/perl/Guestfs.bs
/perl/Guestfs.c
/perl/Guestfs.xs
/perl/lib/Sys/Guestfs.bs
/perl/lib/Sys/Guestfs.c
/perl/lib/Sys/Guestfs.xs
/perl/lib/Sys/Guestfs.pm
/perl/Makefile-pl
/perl/Makefile.PL
/perl/Makefile-pl.old
/perl/MYMETA.json
/perl/MYMETA.yml
/perl/pm_to_blib
@@ -381,12 +441,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
@@ -399,7 +453,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
@@ -411,6 +471,8 @@ Makefile.in
/podwrapper.1
/podwrapper.pl
/po/*.gmo
/python/actions-?.c
/python/actions.h
/python/bindtests.py
/python/build
/python/config.h
@@ -418,13 +480,15 @@ Makefile.in
/python/examples/guestfs-python.3
/python/examples/stamp-guestfs-python.pod
/python/guestfs.py
/python/guestfs-py.c
/python/guestfs.pyc
/python/guestfs.pyo
/python/guestfs-internal-all.h
/python/guestfs-internal-frontend-cleanups.h
/python/guestfs-internal-frontend.h
/python/ignore-value.h
/python/MANIFEST
/python/module.c
/python/structs.c
/python/__pycache__
/python/setup.py
/python/stamp-extra-files
@@ -441,11 +505,13 @@ Makefile.in
/ruby/doc/site/api
/ruby/examples/guestfs-ruby.3
/ruby/examples/stamp-guestfs-ruby.pod
/ruby/ext/guestfs/actions-?.c
/ruby/ext/guestfs/actions.h
/ruby/ext/guestfs/extconf.h
/ruby/ext/guestfs/extconf.rb
/ruby/ext/guestfs/_guestfs.bundle
/ruby/ext/guestfs/_guestfs.c
/ruby/ext/guestfs/_guestfs.so
/ruby/ext/guestfs/module.c
/ruby/ext/guestfs/mkmf.log
/ruby/Rakefile
/ruby/stamp-rdoc
@@ -454,35 +520,6 @@ Makefile.in
/sparsify/stamp-virt-sparsify.pod
/sparsify/virt-sparsify
/sparsify/virt-sparsify.1
/src/actions-?.c
/src/actions-variants.c
/src/bindtests.c
/src/errnostring.c
/src/errnostring-gperf.c
/src/errnostring-gperf.gperf
/src/errnostring.h
/src/event-string.c
/src/guestfs.3
/src/guestfs-actions.pod
/src/guestfs-availability.pod
/src/guestfs.h
/src/guestfs-internal-actions.h
/src/guestfs-internal-frontend-cleanups.h
/src/guestfs_protocol.c
/src/guestfs_protocol.h
/src/guestfs_protocol.x
/src/guestfs-structs.pod
/src/libguestfs.pc
/src/libguestfs.syms
/src/.libs/libguestfs.so
/src/libvirt-is-version
/src/stamp-guestfs.pod
/src/structs-cleanup.c
/src/structs-compare.c
/src/structs-copy.c
/src/structs-free.c
/src/test-utils
/stamp-guestfs-release-notes.pod
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
@@ -493,8 +530,6 @@ Makefile.in
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test.err
/test.out
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-backend-settings
@@ -517,75 +552,87 @@ Makefile.in
/tests/c-api/test*.tmp
/tests/c-api/test-user-cancel
/tests/charsets/test-charset-fidelity
/tests/data/100kallnewlines
/tests/data/100kallspaces
/tests/data/100kallzeroes
/tests/data/100krandom
/tests/data/10klines
/tests/data/abssymlink
/tests/data/bin-x86_64-dynamic.gz
/tests/data/blank-disk-*
/tests/data/blank-disk-*
/tests/data/hello.b64
/tests/data/initrd
/tests/data/initrd-x86_64.img
/tests/data/initrd-x86_64.img.gz
/tests/data/lib-i586.so.xz
/tests/data/test-grep.txt.gz
/tests/data/test.iso
/tests/daemon/captive-daemon.pm
/tests/disks/test-qemu-drive-libvirt.xml
/tests/events/test-libvirt-auth-callbacks
/tests/guests/blank-*.img
/tests/guests/debian.img
/tests/guests/fedora.img
/tests/guests/fedora-btrfs.img
/tests/guests/fedora-md1.img
/tests/guests/fedora-md2.img
/tests/guests/guests.xml
/tests/guests/guests-all-good.xml
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
/tests/guests/guest-aux/windows-software
/tests/guests/guest-aux/windows-system
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/archlinux.img
/tests/guests/coreos.img
/tests/guests/windows.img
/tests/mount-local/test-parallel-mount-local
/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
/tests/regressions/rhbz1044014.out
/tests/regressions/rhbz1055452
/tests/regressions/test-big-heap
/tests/rsync/rsyncd.pid
/tests/syslinux/extlinux-guest.img
/tests/syslinux/syslinux-guest.img
/test-data/test.iso
/test-data/blank-disks/blank-disk-*
/test-data/fake-virtio-win/fake-virtio-win.iso
/test-data/files/100kallnewlines
/test-data/files/100kallspaces
/test-data/files/100kallzeroes
/test-data/files/100krandom
/test-data/files/10klines
/test-data/files/abssymlink
/test-data/files/bin-x86_64-dynamic.gz
/test-data/files/hello.b64
/test-data/files/initrd
/test-data/files/initrd-x86_64.img
/test-data/files/initrd-x86_64.img.gz
/test-data/files/lib-i586.so.xz
/test-data/files/test-grep.txt.gz
/test-data/phony-guests/archlinux.img
/test-data/phony-guests/blank-*.img
/test-data/phony-guests/coreos.img
/test-data/phony-guests/debian.img
/test-data/phony-guests/fedora.img
/test-data/phony-guests/fedora-btrfs.img
/test-data/phony-guests/fedora-md1.img
/test-data/phony-guests/fedora-md2.img
/test-data/phony-guests/fedora-name.db
/test-data/phony-guests/fedora-packages.db
/test-data/phony-guests/guests.xml
/test-data/phony-guests/guests-all-good.xml
/test-data/phony-guests/stamp-fedora-md.img
/test-data/phony-guests/ubuntu.img
/test-data/phony-guests/windows.img
/test-data/phony-guests/windows-software
/test-data/phony-guests/windows-system
/test-tool/libguestfs-test-tool
/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/fake-virtio-win.iso
/v2v/oUnit-*
/v2v/rhel-5.10.img
/v2v/rhel-6.5.img
/v2v/rhel-7.0.img
/v2v/real-*.d/
/v2v/real-*.img
/v2v/real-*.xml
/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/test-v2v-conversion-of-*.sh
/v2v/uefi.ml
/v2v/uefi.mli
/v2v/v2v_unit_tests
/v2v/virt-v2v
/v2v/virt-v2v.1
/v2v/virt-v2v-copy-to-local
/v2v/virt-v2v-copy-to-local.1
/website/*.html
/website/README.txt
/website/TODO.txt

Submodule .gnulib updated: eda101a012...4c32543a4f

View File

@@ -1,7 +0,0 @@
^tests/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 @@
tests/data/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,14 +33,17 @@ 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
Menanteau Guy
Michael Scherer
Mike Frysinger
@@ -50,16 +55,20 @@ Nikos Skalkotos
Olaf Hering
Or Goshen
Paul Mackerras
Pavel Butsykin
Pino Toscano
Piotr Drąg
Qin Guan
Rajesh Ranjan
Richard W.M. Jones
Robert Antoni Buj Gelonch
Roman Kagan
Sandeep Shedmake
Shahar Havivi
Shahar Lev
Shankar Prasad
Thomas S Hatch
Tomáš Golembiovský
Török Edwin
Wanlong Gao
Wulf C. Krueger

689
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2015-07-30
Last updated: 2017-02-10
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
@@ -56,9 +53,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
824021 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824021
inspection cannot recognize guest which uses btrfs subvolumes for root
824867 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824867
Windows guest with dynamic disk can not boot on rhev after conversion by virt-p2v
832602 NEW https://bugzilla.redhat.com/show_bug.cgi?id=832602
"error in chunked encoding" when trying to extract (tar-out) a truncated ISO image
@@ -74,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
@@ -98,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
@@ -125,9 +110,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
921604 NEW https://bugzilla.redhat.com/show_bug.cgi?id=921604
RFE: virt-v2v: add option to specify spice or VNC and whether to add USB connections
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
963232 NEW https://bugzilla.redhat.com/show_bug.cgi?id=963232
RFE: v2v: a --no-cleanup would be useful for debugging of disk images that guestfs has issues converting
@@ -137,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
@@ -152,12 +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
1023630 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1023630
enable-valgrind-daemon option breaks UML
@@ -176,9 +149,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,54 +161,33 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1061040 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1061040
RFE: Enable ZFS support
1064041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
1075594 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075594
RFE: python-libguestfs should be available on pypi
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
1097272 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1097272
Ruby bindings should use RB_GC_GUARD (instead of volatile) for enhanced safety
1099292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099292
sfdisk failed by "Device or resource busy" when using one command line
1099475 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099475
sfdisk: BLKRRPART: Device or resource busy
1099976 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message with gnupg2
1100138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100138
some operation cause "lvremove" can not find the object
1100140 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100140
some operation cause "lvremove" can not find the object
1102241 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102241
[RFE] libguestfs should detect OSTree (project-atomic) qcow2 disk image
1102619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102619
lvm-clear-filter failed when has two same name but different uuid's VG
1102620 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102620
lvm-clear-filter failed when has two same name but different uuid's VG
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
@@ -251,41 +200,20 @@ 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
1132652 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1132652
virt-sysprep firstboot doesn't work with RHEL 7 guest
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
1139785 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1139785
virt-sysprep should change UUID fields in /etc/sysconfig/network-scripts/ifcfg-* files
1142184 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1142184
virt-sparsify --help print description of a option which is hard to get common understanding
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1146477 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1146477
virt-v2v sometimes hangs with printing: Add. Sense: No additional sense information
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
virt-v2v:Network interface disappear after conversion of guest with interface type direct
RFE: virt-v2v should do something with <interface type='direct'> (either virtualize it or give an error)
1151903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151903
virt tools --csv output should have a meaningful output
1151905 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151905
virt tools --csv output should have a meaningful output
1152533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152533
virt-v2v fail to convert guest with virtio lun disk
RFE: virt-v2v should do something with <disk device='lun'> (either virtualize it or give an error)
1152818 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152818
llz give ? for the security context of a file, which is wrong
@@ -293,18 +221,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1152819 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152819
Can not end a running command in virt-rescue by press ^C or other keys, the only way is to exit virt-rescue
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
1153702 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1153702
Using "upload - XXX" doesn't work with remote
@@ -315,28 +231,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
1164729 NEW 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
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
1166057 NEW 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"
1167916 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167916
P2V error:unexpected end of file waiting for password prompt.
1168626 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1168626
Tracker: Build RHEL 7.2 - based virt-p2v ISO
1168865 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1168865
warning: /files/boot/grub/device.map/hd0 references unknown device "vda" when convert a local guest with virtio disk to openstack server (-i disk))
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
@@ -347,162 +242,48 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1172425 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1172425
[RFE]virt-v2v failed to convert VMware ESX VM with snapshot
1172659 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1172659
virt-resize --expand fails on ubuntu-14.04.img image (regression)
1173462 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1173462
virt-resize on RHEL 5.7 fails to resize the raw format disk image
1173695 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1173695
RFE: allow passing in a pre-opened libvirt connection from python
1174551 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1174551
"lstatnslist" and "lstatlist" don't give an error if the API is used wrongly
1176526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176526
virt-resize cannot shrink ext filesystem by a small amount
1176801 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176801
File /etc/sysconfig/kernel isn't updated when convert XenPV guest with regular kernel installed
1177460 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177460
virt-customize does not work with fedora atomic
1179576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1179576
virt-v2v prints warning: /files/etc/fstab/8/spec references unknown device "hdb"
1180170 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1180170
virt-builder gives GPG warning message with gnupg2
1180769 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1180769
Security context on image file gets reset
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
1197786 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1197786
virt-builder fails --get-kernel on F21 PPC64 iso
1203595 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203595
No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
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
1204063 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1204063
virt-resize should warn if it cannot resize filesystems because optional support is missing
1204131 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1204131
RFE: virt-builder creates qcow v3 images, add build option for qcow v2
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
1216298 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1216298
'inspect-get-icon' fails to get the icon form the rhel7.1 image
1216305 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1216305
virt-inspector fails to detect the rhel7 images
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
1218934 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1218934
virt-sparsify: read all the output from 'qemu-img --help'
1220751 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1220751
fusermount returns EBUSY, but unmounts the disk anyway, confusing guestunmount
1221569 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1221569
aarch64: add-drive-opts fails to hot plug a disk
1221571 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1221571
aarch64: md-create fails to create Linux md (RAID) device
1222231 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1222231
virt-builder --size fails on debian-7/8 because of updated sfdisk in util-linux 2.62.2
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
1225789 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1225789
Wrong video driver is installed for rhel5.11 guest after conversion to libvirt
1227599 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1227599
P2V error:unexpected end of file waiting for command prompt.
1227609 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1227609
Output method shows three times in virt-p2v client.
1227621 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1227621
Log file saved on conversion server even "Enable server-side debugging" is not ticked
1229119 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1229119
Unrelated info in fstab makes virt-v2v fail with unclear error info
1229262 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1229262
virt-p2v doesn't work under no GUI mode
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
1230412 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1230412
virt-v2v should ignore bogus kernel entries in grub config
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
@@ -512,17 +293,215 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1237250 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1237250
aarch64: libguestfs should now prefer virtio-pci
1238615 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1238615
"Domain not found" error shows several times during virt-v2v conversion
1242028 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1242028
virt-make-fs cannot set g+s bit on vfat
1242853 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1242853
mount-loop failed to setup loop device: No such file or directory
1250670 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1250670
libguestfs-test-tool succeeds but guestmount fails
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
1252701 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1252701
virt-p2v cannot convert older HP Smart Array servers which require cciss driver
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
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
1270686 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1270686
libguestfs-1.31.15-1.fc24 FTBFS: cp: missing file operand
1272119 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1272119
virt-v2v on W2K3 32-bit image fails
1277744 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1277744
When VirtualBox is running, libguestfs fails with ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
1284191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1284191
virt-builder cgroup error when running docker
1291339 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291339
[RFE] Add support for layered/composable images in virt-builder repos
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
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
1322512 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1322512
Libguestfs error: filesize: /var/lib/rpm/Name: No such file or directory
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
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
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 when convert win7 or win2008r2 from kvm to rhev by virt-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
1359086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1359086
Rebase libguestfs in RHEL 7.4
1362497 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1362497
[RFE] Add support for importing Debian/Ubuntu guests with virt-v2v
1363764 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1363764
Permission problems on disk images result in confusing behavior
1363796 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1363796
[RFE] virt-v2v: add ability to identify source templates and indicate it in output to RHEV
1364058 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1364058
[RFE] virt-v2v should provide an option to store the traces to log file
1364518 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1364518
libguestfs-java: mismatch class version vs java dependency
1365473 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1365473
Can't convert rhel6.8 x86-lpfc host by virt-p2v
1368599 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1368599
pip install fails with ImportError: /usr/lib64/python2.7/site-packages/libguestfsmod.so: undefined symbol: put_isoinfo
1369010 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1369010
v2v UEFI conversions fail if the source has a bus='ide' CD-ROM
1370816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1370816
virt-builder rhel-6.5 --selinux-relabel fails
1371379 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1371379
Fail to inspect ppc64le ISO file
1372037 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1372037
txz-in hangs on btrfs filesystem
1372671 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1372671
Graphics type of guest become sdl after converted by virt-v2v -i disk
1373879 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1373879
virt-resize --expand fails with win2008 x86 image on aarch64 uefi host
1374232 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1374232
selinux relabel fails on RHEL 6.2 guests with "libguestfs error: selinux_relabel: : Success"
1374254 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1374254
Failed to boot up Win7sp1 for first time which installed on fc hardware after converting to rhv4.0
1374629 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1374629
[virt-p2v]virt-p2v recognize LCDRIVE & virtual floppy as hard disks
1379579 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1379579
guestfish mistakely parse nbd exportname
1382275 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1382275
virt-v2v is pulling in the X11 stack
1383048 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1383048
Device.map which is /dev/sdb or /dev/mapper/mpatha can't be updated to vda after p2v conversion
1383665 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1383665
mount: unknown filesystem type 'xfs' error while converting centos VMware VM to glance image.
1387213 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1387213
[RFE] Add support for importing Debian/Ubuntu guests with virt-v2v
1393747 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1393747
RFE: Libguestfs should support LUKS partition in guest image
1398191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1398191
RFE: virt-v2v should support converting vm with LUKS disk encryption format
1400332 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1400332
RFE: virt-builder should support templates with encrypted filesystems
1405273 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1405273
RFE: virt-builder should support a URL as the output diskimage
1406906 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1406906
Segmentation fault when reading corrupted path with Python 3 bindings
1409024 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1409024
[Debian] Missing db_dump abort inspection
1409637 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1409637
0x0000007B BSOD after converting Windows 2008 R2 using p2v
1410102 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1410102
Make install error for libguestfs-1.35.19
1412090 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1412090
Virt-v2v will use the latest kernel instead of the default kernel.
1413489 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1413489
Inspection doesn't find any OS in cirros-d161201-x86_64-disk.img
1414505 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1414505
virt-p2v needs RHEL 5 build to support LSI Logic / Symbios Logic MegaRAID SAS 8208ELP/8208ELP
1415935 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1415935
virt-v2v auto running convert esx guests failed with error "qemu-img: error while reading sector 24942336: Protocol error"
1415955 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1415955
Ubuntu 14 doesn't generate ssh host keys during first boot
1417306 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1417306
QEMU image file locking (libguestfs)
1417549 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1417549
/usr/bin/x86_64-linux-gnu-ld.bfd.real: ../common/progress/.libs/libprogress.a(libprogress_la-progress.o): undefined reference to symbol 'UP@@NCURSES_TINFO_5.0.19991023'
1420103 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1420103
[RFE] Hyper-V support in v2v
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
@@ -557,17 +536,14 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1069966 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1069966
RFE: let virt-builder etc build ARM guests on x86 host
1109144 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1109144
virt-builder --get-kernel doesn't fetch the dtb from images
1113153 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1113153
RFE: Inspection should support systemd mount units
1130506 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
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
1134726 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1143887 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1143887
virt-v2v: warning: cannot write files to the NFS server as 36:36
@@ -575,98 +551,110 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1144138 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1144138
virt-inspector fails on FreeBSD 9.3 guest
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
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
1156298 ASSIGNED 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 ASSIGNED 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
1190669 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1190669
Support virt-v2v conversion of Windows > 7
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
(190 bugs)
1213844 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1213844
guestfish should reset the console on ^Z
(181 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
1167623 POST https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Remove "If reporting bugs, run virt-v2v with debugging enabled .." message when running virt-p2v
1141631 POST 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
1194472 POST https://bugzilla.redhat.com/show_bug.cgi?id=1194472
Current virt-builder index breaks version < 1.26
1152369 POST 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
1229305 POST https://bugzilla.redhat.com/show_bug.cgi?id=1229305
virt-sysprep at cleanup deletes /var/spool/at/.SEQ which results in failing at
1164765 POST https://bugzilla.redhat.com/show_bug.cgi?id=1164765
[RFE] Add a new API to scan devices for a btrfs filesystem
1238053 POST https://bugzilla.redhat.com/show_bug.cgi?id=1238053
v2v:Duplicate disk target set when convert guest with cdrom attached
1362649 POST https://bugzilla.redhat.com/show_bug.cgi?id=1362649
RFE: virt-sysprep does not utilize libguestfs encryption support
1367738 POST https://bugzilla.redhat.com/show_bug.cgi?id=1367738
Missing bash completion scripts for: virt-diff guestunmount virt-copy-in virt-copy-out virt-customize virt-get-kernel virt-p2v-make-disk virt-p2v-make-kickstart virt-tar-in virt-tar-out virt-v2v-copy-to-local virt-win-reg
1372668 POST https://bugzilla.redhat.com/show_bug.cgi?id=1372668
Process status is not normal in windows guest after converted from kvm to rhev by virt-v2v
1374405 POST https://bugzilla.redhat.com/show_bug.cgi?id=1374405
There is HTTP 404 error info when convert guest to glance by virt-v2v
1374651 POST https://bugzilla.redhat.com/show_bug.cgi?id=1374651
Can't install qxl driver for display device in win7 guest after converting to glance by virt-v2v
1375157 POST https://bugzilla.redhat.com/show_bug.cgi?id=1375157
virt-v2v: -i ova: Permission denied when using libvirt and running as root
1377081 POST https://bugzilla.redhat.com/show_bug.cgi?id=1377081
virt-p2v manual should update the new dialog information
1378022 POST https://bugzilla.redhat.com/show_bug.cgi?id=1378022
There is virt-v2v warning about <listen type='none'> during converting a guest which has listen type='none' in XML
1379240 POST https://bugzilla.redhat.com/show_bug.cgi?id=1379240
virt-v2v should not report error any more since libvirt bug 1134592 has been fixed
1379289 POST https://bugzilla.redhat.com/show_bug.cgi?id=1379289
RFE: virt-p2v should support mnemonic operations
1379585 POST https://bugzilla.redhat.com/show_bug.cgi?id=1379585
guestfish mistakely parse nbd exportname
1383517 POST https://bugzilla.redhat.com/show_bug.cgi?id=1383517
virt-v2v fails with /etc/fstab containing btrfs with two or more mount options
1384241 POST https://bugzilla.redhat.com/show_bug.cgi?id=1384241
The tar-in command does not allow restoring file capabilities
1390876 POST https://bugzilla.redhat.com/show_bug.cgi?id=1390876
"--machine-readable" info should be updated in virt-v2v manual page
1392798 POST https://bugzilla.redhat.com/show_bug.cgi?id=1392798
secrets from libvirt domains are not read
1398070 POST https://bugzilla.redhat.com/show_bug.cgi?id=1398070
typo error in man page
1400205 POST https://bugzilla.redhat.com/show_bug.cgi?id=1400205
Add --vdsm-compat=1.1 flag for VDSM
1401474 POST https://bugzilla.redhat.com/show_bug.cgi?id=1401474
Importing VMs from VMware is failing with error "Inspection field 'i_arch' was 'unknown'"
1402301 POST https://bugzilla.redhat.com/show_bug.cgi?id=1402301
Improve OVA import compatibility
1404182 POST https://bugzilla.redhat.com/show_bug.cgi?id=1404182
RFE: virt-resize should support a URL as the outdisk
1404287 POST https://bugzilla.redhat.com/show_bug.cgi?id=1404287
qemu-kvm cannot boot RHEL 7 kernel with TCG, hangs at "Probing EDD (edd=off to disable)..."
1418283 POST https://bugzilla.redhat.com/show_bug.cgi?id=1418283
virt-v2v: appliance runs out of memory running setfiles command
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
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]
1159030 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1159030
libvirt backend does not set RBD password
1172660 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1172660
virt-resize --expand fails on ubuntu-14.04.img image
1177910 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1177910
Libguestfs fails to locate the qemu-kvm on POWER8(BE) host.
1199605 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1199605
FTBFS: requires file >= 5.11-22 but file = 5.11-21 is in release
1201507 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1201507
fuse missing from BuildRequires
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
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
1224486 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1224486
virt-resize should preserve GPT partition UUIDs, else EFI guests become unbootable
1224675 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1224675
ppc64le: virt-sparsify fails to make a disk image sparse, the output log indicates it gets the wrong parameter in the disk create step
1224676 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1224676
ppc64le: virt-resize/virt-build/virt-sysprep/virt-customize fail to execute and return the error "Segmentation fault (core dumped)"
1225467 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1225467
virt-sparsify refuses to work on qcow2 files
(17 bugs)
(27 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
823758 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=823758
p2v client should have largest number restrictions for CPU and Memory settings
855059 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=855059
RFE: virt-p2v: display more information about network devices such as topology, bonding, etc.
889082 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889082
[RFE] virt-v2v should check whether guest with same name exist on target first then transfer the disk
1146007 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1146007
Input/output error during conversion of esx guest.
1146832 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1146832
virt-v2v fail to convert guest with disk type volume
1165564 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165564
Provide Reboot/Shutdown button after virt-p2v
@@ -679,96 +667,15 @@ These bugs are in the VERIFIED state.
1167774 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167774
virt-p2v fails with error:"nbd.c:nbd_receive_negotiate():L501: read failed"
1167921 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167921
p2v: No Network Connection dialog
1319086 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1319086
libguestfs-java: mismatch class version vs java dependency
1167922 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167922
p2v: No virtual console
1358332 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1358332
virt-p2v to become supported tool in RHEL 7.3
1168144 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1168144
warning: fstrim: fstrim: /sysroot/: FITRIM ioctl failed: Operation not supported (ignored) when convert win2003 guest from xen server
1388407 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1388407
virt-sysprep will fail detecting OS if "/usr" is a distinct partition mounted in "/" via fstab
1174073 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1174073
The listen address for vnc is changed after conversion by virt-v2v
1174200 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1174200
New virt-v2v failure: CURL: Error opening file: NSS: client certificate not found (nickname not specified): Invalid argument
1175196 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1175196
"parse-environment" and "parse-environment-list" fail to parse "LIBGUESTFS_TRACE = 0"
1175676 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1175676
Typo error in 'help ping-daemon'
1176493 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1176493
virt-v2v ignores sound device when convert xen guest to local kvm
1176591 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1176591
virt-v2v -o vdsm doesn't work with multiple data domains
1176598 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1176598
virt-v2v -o vdsm write ovf to specify domain
1182463 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1182463
"mknod-b", "mknod-c", and "mkfifo" do not strip non-permissions bits from "mode"
1186850 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1186850
Update RHEV APT.exe
1187231 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1187231
rhsrvany crashes when run as a service
1196705 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1196705
libguestfs requires selinux-policy, but selinux-policy should be optional
1209225 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1209225
Allow configurable location for virtio drivers
1211321 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1211321
kernel dependency dropped between libguestfs-1.28.1-1.18.el7 and RHEL 7.2
1212002 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1212002
yum install guestfish fails on RHEL 7.1
1212677 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1212677
guestfish fails to add a remote image with ssh protocol
1222975 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1222975
virt-p2v network does not start
1226794 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1226794
"Doing conversion??" still shows after cancel the conversion from virt-p2v client
1229340 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229340
virt-p2v no GUI mode appends n to the final command line parameter
1229385 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1229385
virt-p2v in kernel command line mode should power off the machine after conversion
1232192 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1232192
Virt-v2v gives an error on a blank disk: part_get_parttype: unknown signature, of the output: BYT;
1234351 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1234351
virt-v2v Support for Fedora virtio-win drivers
1237869 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1237869
Virtio drivers are not installed for windows 2008 guests by virt-v2v
1238579 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1238579
virt-sysprep at cleanup deletes /var/spool/at/.SEQ which results in failing at
1239053 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1239053
virt-v2v error reporting when grub.conf cannot be parsed by Augeas
1240274 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1240274
Remove references in error messages to libguestfs-winsupport
1240276 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1240276
Add checks to ensure libguestfs-winsupport functionality only available to virt-v2v and virt-p2v
1246032 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1246032
virt-v2v: error: libguestfs error: umount_all: umount: /sysroot: umount: /sysroot: target is busy
(39 bugs)
(7 bugs)
End of BUGS file.

18
HACKING
View File

@@ -1,2 +1,16 @@
The contents of this page have moved to the section "EXTENDING LIBGUESTFS"
in the guestfs(3) man page.
To learn how to compile libguestfs from sources:
guestfs-building(1) or http://libguestfs.org/guestfs-building.1.html
To learn how to extend libguestfs:
guestfs-hacking(1) http://libguestfs.org/guestfs-hacking.1.html
To learn about the architecture and internals of libguestfs:
guestfs-internals(1) http://libguestfs.org/guestfs-internals.1.html
To learn how to write programs using the libguestfs API:
guestfs(3) http://libguestfs.org/guestfs.3.html
guestfs-examples(3) http://libguestfs.org/guestfs-examples.3.html

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2015 Red Hat Inc.
# Copyright (C) 2009-2017 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
@@ -19,15 +19,29 @@ include $(top_srcdir)/common-rules.mk
ACLOCAL_AMFLAGS = -I m4
# The generator - must be before anything else.
SUBDIRS = generator
# Must be the first tests that run.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
endif
# Files and other test data used by the tests. Must be before any
# tests run, except tests/qemu.
SUBDIRS += test-data
# Gnulib - must be built and tested before the library.
SUBDIRS = gnulib/lib
SUBDIRS += gnulib/lib
if ENABLE_GNULIB_TESTS
SUBDIRS += gnulib/tests
endif
# Basic source for the library.
SUBDIRS += tests/data generator src examples po
SUBDIRS += common/errnostring common/protocol common/utils
SUBDIRS += lib docs examples po
# The daemon and the appliance.
if ENABLE_DAEMON
SUBDIRS += daemon
SUBDIRS += tests/daemon
@@ -38,8 +52,6 @@ endif
# Tests - order is important.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
SUBDIRS += tests/guests
SUBDIRS += tests/c-api
SUBDIRS += tests/tmpdirs
SUBDIRS += tests/protocol
@@ -54,7 +66,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
@@ -69,11 +82,20 @@ SUBDIRS += tests/nbd
SUBDIRS += tests/http
SUBDIRS += tests/syslinux
SUBDIRS += tests/journal
SUBDIRS += tests/fuzz
SUBDIRS += tests/relative-paths
SUBDIRS += tests/gdisk
SUBDIRS += tests/regressions
SUBDIRS += tests/tsk
endif
# Common code used by the tools.
SUBDIRS += common/edit
SUBDIRS += common/options
SUBDIRS += common/parallel
SUBDIRS += common/progress
SUBDIRS += common/visit
SUBDIRS += common/windows
# libguestfs-test-tool
SUBDIRS += test-tool
@@ -83,7 +105,7 @@ SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat diff df edit format inspector make-fs rescue
if HAVE_P2V
SUBDIRS += p2v
SUBDIRS += common/miniexpect p2v
endif
# bash-completion
@@ -133,8 +155,7 @@ if HAVE_OCAML
SUBDIRS += \
mllib \
customize \
builder builder/website \
dib \
builder builder/templates \
get-kernel \
resize \
sparsify \
@@ -143,6 +164,9 @@ SUBDIRS += \
if HAVE_OCAML_PKG_LIBVIRT
SUBDIRS += v2v/test-harness
endif
if HAVE_FUSE
SUBDIRS += dib
endif
endif
# Perl tools.
@@ -155,6 +179,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
@@ -182,7 +215,11 @@ EXTRA_DIST = \
contrib/intro/vmm-icons-t.png \
contrib/intro/vmm-icons.png \
contrib/intro/win7.xml \
contrib/make-check-on-installed.pl \
contrib/p2v/aux-scripts/do-build.sh \
contrib/p2v/build-p2v-iso.sh \
contrib/p2v/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch \
contrib/p2v/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch \
contrib/p2v/test-p2v-iso.sh \
contrib/README \
contrib/visualize-alignment/.gitignore \
contrib/visualize-alignment/guestfish-add-mount.qtr \
@@ -195,171 +232,124 @@ EXTRA_DIST = \
contrib/visualize-alignment/README \
contrib/visualize-alignment/tracetops.ml \
contrib/windows-icons.pl \
guestfs-release-notes.pod \
guestfs-release-notes.txt \
html/draft.png \
html/draft.svg \
html/pod.css \
html/virt-builder.svg \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
logo/fish-5yrs.svg logo/fish-5yrs.png \
logo/virt-builder.svg \
m4/.gitignore \
ocaml-link.sh \
tests/run-xml-to-junit.sh \
tests/run-xml-to-junit.xsl \
podcheck.pl \
tests/automake2junit.ml \
tmp/.gitignore \
update-bugs.sh \
utils/README \
valgrind-suppressions \
website/bugs.png \
website/communicate.png \
website/documentation.png \
website/download.png \
website/download/builder/README \
website/download/builder/index \
website/download/builder/index.asc \
website/draft.png \
website/draft.svg \
website/easytoread.css \
website/feed.css \
website/fish-5yrs.svg \
website/fish.png \
website/git.png \
website/index.css \
website/index.html.in \
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
# The website.
HTMLFILES = \
html/guestfs.3.html \
html/guestfs-examples.3.html \
html/guestfs-faq.1.html \
html/guestfs-performance.1.html \
html/guestfs-recipes.1.html \
html/guestfs-release-notes.1.html \
html/guestfs-testing.1.html \
html/guestfsd.8.html \
html/guestfish.1.html \
html/libguestfs-make-fixed-appliance.1.html \
html/libguestfs-test-tool.1.html \
html/virt-alignment-scan.1.html \
html/virt-builder.1.html \
html/virt-cat.1.html \
html/virt-copy-in.1.html \
html/virt-copy-out.1.html \
html/virt-customize.1.html \
html/virt-df.1.html \
html/virt-dib.1.html \
html/virt-diff.1.html \
html/virt-edit.1.html \
html/virt-filesystems.1.html \
html/virt-format.1.html \
html/virt-get-kernel.1.html \
html/virt-inspector.1.html \
html/virt-list-filesystems.1.html \
html/virt-list-partitions.1.html \
html/virt-log.1.html \
html/virt-ls.1.html \
html/virt-make-fs.1.html \
html/virt-rescue.1.html \
html/virt-resize.1.html \
html/virt-sparsify.1.html \
html/virt-sysprep.1.html \
html/virt-tar.1.html \
html/virt-tar-in.1.html \
html/virt-tar-out.1.html \
html/virt-v2v.1.html \
html/virt-win-reg.1.html
if HAVE_ERLANG
HTMLFILES += html/guestfs-erlang.3.html
endif
if HAVE_GOLANG
HTMLFILES += html/guestfs-golang.3.html
endif
if HAVE_JAVA
HTMLFILES += html/guestfs-java.3.html
endif
if HAVE_LUA
HTMLFILES += html/guestfs-lua.3.html
endif
if HAVE_OCAML
HTMLFILES += html/guestfs-ocaml.3.html
endif
if HAVE_PERL
HTMLFILES += html/guestfs-perl.3.html
endif
if HAVE_PYTHON
HTMLFILES += html/guestfs-python.3.html
endif
if HAVE_RUBY
HTMLFILES += html/guestfs-ruby.3.html
endif
if HAVE_FUSE
HTMLFILES += \
html/guestmount.1.html \
html/guestunmount.1.html
endif
if HAVE_P2V
HTMLFILES += \
html/virt-p2v.1.html \
html/virt-p2v-make-disk.1.html \
html/virt-p2v-make-kickstart.1.html
endif
HTMLSUPPORTFILES = \
html/draft.png \
html/pod.css \
html/virt-builder.svg
TEXTFILES = BUGS README TODO
BUILDERFILES = \
builder/website/README \
builder/website/index \
builder/website/index.asc
zanata-pull.sh
WEBSITEDIR = $(HOME)/d/websites/libguestfs
# For reasons not fully understood, we need to rebuild all the
# man pages and HTMLFILES from scratch here.
website: $(HTMLFILES) $(HTMLSUPPORTFILES) $(TEXTFILES) $(BUILDERFILES)
find -name 'stamp-*.pod' -delete
$(MAKE)
cp $(HTMLFILES) $(HTMLSUPPORTFILES) $(WEBSITEDIR)
for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
BUILDERFILES = \
website/download/builder/README \
website/download/builder/index \
website/download/builder/index.asc
noinst_DATA = \
website/index.html \
website/README.txt \
website/TODO.txt
website/README.txt: README
cp $< $@
website/TODO.txt: TODO
cp $< $@
maintainer-upload-website:
cp website/*.{css,html,png,svg,txt} $(WEBSITEDIR)/
cp $(BUILDERFILES) $(WEBSITEDIR)/download/builder/
cd $(WEBSITEDIR) && \
date=`date +%F`; \
sed -e "s/SUBST_VERSION/$(VERSION)/" \
-e "s/SUBST_DATE/$$date/" \
< index.html.in > index.html
# 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 '*.[ch]' | \
grep -v -E '^(builder/index-parse\.|builder/index-scan\.|examples/|gnulib/|gobject/|java/com_redhat_et_libguestfs|perl/|php/extension/config\.h|ruby/ext/guestfs/extconf\.h|tests/|test-data/)' | \
grep -v -E '/(guestfs|rc)_protocol\.' | \
grep -v -E '.*/errnostring\.' | \
grep -v -E '.*-gperf\.' | \
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|perl/(blib|examples)|po-docs|tests)/' | \
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
grep -v -E '^python/utils\.c$$' | \
grep -v -E '^perl/lib/Sys/Guestfs\.c$$' | \
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
grep -v '^builder/templates/' | \
LC_ALL=C sort > $@-t
mv $@-t $@
# Try to stop people using 'make install' without 'DESTDIR'.
install:
@@ -369,59 +359,47 @@ 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 "***"; \
exit 1; \
fi
# Manual pages in top level directory.
man_MANS = \
guestfs-release-notes.1
noinst_DATA = \
$(top_builddir)/html/guestfs-release-notes.1.html
guestfs-release-notes.1 guestfs-release-notes.txt $(top_builddir)/html/guestfs-release-notes.1.html: stamp-guestfs-release-notes.pod
stamp-guestfs-release-notes.pod: guestfs-release-notes.pod
$(PODWRAPPER) \
--section 1 \
--man guestfs-release-notes.1 \
--text guestfs-release-notes.txt \
--html $(top_builddir)/html/guestfs-release-notes.1.html \
--license GPLv2+ \
$<
touch $@
# Test installed packages.
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 $@
# Make clean.
CLEANFILES = \
*~ \
html/*.html \
CLEANFILES += \
pod2htm?.tmp \
podwrapper.1 \
qemu-wrapper.sh \
stamp-guestfs-release-notes.pod \
tmp/disk* \
tmp/run-* \
tmp/valgrind-*.log
tmp/valgrind-*.log \
website/*~ \
website/*.html
clean-local:
-rm -rf tmp/libguestfs??????
-rm -rf tmp/guestfs.*
-rm -rf tmp/.guestfs-*
-rm -rf tmp/null.*
-find tmp -type s -delete
-find . -name '*~' -delete
# If you don't want to run all of the tests ('make check') then this
# will just run libguestfs-test-tool for a quick check. Note this
@@ -539,7 +517,7 @@ check-slow: build-test-guests
exit $$(( $$errors ? 1 : 0 ))
build-test-guests:
$(MAKE) -C tests/guests check
$(MAKE) -C test-data/phony-guests check
# Print subdirs.
#
@@ -565,21 +543,33 @@ 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.
# Maintainer only: check no files are missing from EXTRA_DIST rules,
# and that all generated files have been included in the tarball.
# (Note you must have done 'make dist')
maintainer-check-extra-dist:
zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
git ls-files | sort > tmp/gitfiles
diff -ur tmp/tarfiles tmp/gitfiles | \
grep '^\+' | \
grep -v '^\+intltool-.*\.in' | \
grep -v '^\+.gitmodules' | \
grep -v '^\+.gnulib' ||:
rm tmp/tarfiles tmp/gitfiles
git ls-files | \
grep -v '^intltool-.*\.in' | \
grep -v '^\.gitmodules' | \
grep -v '^\.gnulib' | \
sort > tmp/gitfiles
comm -13 tmp/tarfiles tmp/gitfiles > tmp/comm-out
@echo Checking for differences between EXTRA_DIST and git ...
cat tmp/comm-out
[ ! -s tmp/comm-out ]
@echo Checking for generated files missing from the tarball ...
@for f in `cat generator/files-generated.txt`; do \
if ! grep -sq "^$$f\$$" tmp/tarfiles; then \
echo generated file missing from tarball: $$f; \
exit 1; \
fi; \
done
rm tmp/tarfiles tmp/gitfiles tmp/comm-out
@echo PASS: EXTRA_DIST tests
# Provide help on common Makefile targets.
@@ -603,7 +593,8 @@ help:
@echo "make check-all Runs all 'check*' rules."
@echo "make check-release Runs 'check*' rules required for release."
@echo
@echo "make syntax-check -j1 -k Check syntax and style problems in the code."
@echo "make installcheck Test installed libguestfs packages."
@echo
@echo "make print-subdirs Print subdirectories."
@echo
@echo "make install Install everything."
@@ -613,5 +604,5 @@ help:
@echo "To run programs without installing:"
@echo " ./run ./fish/guestfish [or any other program]"
@echo
@echo "For more information, see EXTENDING LIBGUESTFS in guestfs(3); and README."
@echo "For more information, see guestfs-hacking(1); and README."
@echo

407
README
View File

@@ -8,408 +8,15 @@ list:
http://www.redhat.com/mailman/listinfo/libguestfs
To find out how to build libguestfs from source, read:
Requirements
----------------------------------------------------------------------
docs/guestfs-building.pod
http://libguestfs.org/guestfs-building.1.html
man docs/guestfs-building.1
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 | |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 | | 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. |
+--------------+-------------+---+-----------------------------------------+
| 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
----------------------------------------------------------------------
Copyright (C) 2009-2015 Red Hat Inc.
Copyright (C) 2009-2017 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,53 +19,35 @@ 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
CLEANFILES = stamp-virt-alignment-scan.pod
bin_PROGRAMS = virt-alignment-scan
SHARED_SOURCE_FILES = \
../df/domains.c \
../df/domains.h \
../df/estimate-max-threads.c \
../df/estimate-max-threads.h \
../df/parallel.c \
../df/parallel.h \
../fish/config.c \
../fish/domain.c \
../fish/inspect.c \
../fish/keys.c \
../fish/options.h \
../fish/options.c \
../fish/uri.h \
../fish/uri.c
virt_alignment_scan_SOURCES = \
$(SHARED_SOURCE_FILES) \
scan.c
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 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
virt_alignment_scan_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBCONFIG_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
$(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/parallel/libparallel.la \
$(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
@@ -74,15 +56,16 @@ virt_alignment_scan_LDADD = \
# Manual pages and HTML files for the website.
man_MANS = virt-alignment-scan.1
noinst_DATA = $(top_builddir)/html/virt-alignment-scan.1.html
noinst_DATA = $(top_builddir)/website/virt-alignment-scan.1.html
virt-alignment-scan.1 $(top_builddir)/html/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
virt-alignment-scan.1 $(top_builddir)/website/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/html/virt-alignment-scan.1.html \
--html $(top_builddir)/website/virt-alignment-scan.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
@@ -90,7 +73,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 += \
@@ -99,4 +83,4 @@ TESTS += \
endif
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
$(MAKE) VG="@VG@" check

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>
@@ -37,8 +38,11 @@
#include <libvirt/virterror.h>
#endif
#include "getprogname.h"
#include "guestfs.h"
#include "options.h"
#include "display-options.h"
#include "parallel.h"
#include "domains.h"
@@ -62,6 +66,8 @@ int keys_from_stdin = 0;
int echo_keys = 0;
const char *libvirt_uri = NULL;
int inspector = 0;
int in_guestfish = 0;
int in_virt_rescue = 0;
static int quiet = 0; /* --quiet */
static int uuid = 0; /* --uuid */
@@ -71,28 +77,28 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
guestfs_int_program_name);
getprogname ());
else {
fprintf (stdout,
_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name,
guestfs_int_program_name);
printf (_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --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"
"For more information, see the manpage %s(1).\n"),
getprogname (), getprogname (),
getprogname (), getprogname ());
}
exit (status);
}
@@ -106,7 +112,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' },
@@ -116,7 +122,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 }
@@ -131,10 +137,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);
@@ -150,11 +154,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,10 +173,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':
@@ -228,16 +229,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,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2014 Red Hat Inc.
# 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
@@ -16,15 +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.
do_md5 ()
{
case "$(uname)" in
Linux)
md5sum "$1" | awk '{print $1}'
;;
*)
echo "$0: unknown method to calculate MD5 of file on $(uname)"
exit 1
;;
esac
}
export LANG=C
set -e
$srcdir/../podcheck.pl virt-alignment-scan.pod virt-alignment-scan

View File

@@ -23,7 +23,7 @@ if [ -n "$SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH" ]; then
exit 77
fi
guestsdir="$(cd ../tests/guests && pwd)"
guestsdir="$(cd ../test-data/phony-guests && pwd)"
libvirt_uri="test://$guestsdir/guests-all-good.xml"
$VG virt-alignment-scan -c "$libvirt_uri"

View File

@@ -18,7 +18,7 @@
export LANG=C
$VG virt-alignment-scan -a ../tests/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

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2015 Red Hat Inc.
# Copyright (C) 2009-2017 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,12 +15,23 @@
# 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 = \
99-guestfs-serial.rules \
excludefiles.in \
guestfsd.suppressions \
guestfs_lvm_conf.aug \
guestfs_shadow.aug \
hostfiles.in \
@@ -55,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.
@@ -66,9 +80,6 @@ make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
rm -f $@-t
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)"
if VALGRIND_DAEMON
PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
endif
packagelist: packagelist.in Makefile
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
@@ -76,12 +87,11 @@ packagelist: packagelist.in Makefile
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_conf.aug guestfs_shadow.aug
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_lvm_conf.aug guestfs_shadow.aug
rm -f $@ $@-t
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
( cd tmp-d && tar zcf - * ) > $@-t
@@ -132,23 +142,20 @@ sbin_SCRIPTS = libguestfs-make-fixed-appliance
man_MANS = libguestfs-make-fixed-appliance.1
libguestfs-make-fixed-appliance.1 $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html: stamp-libguestfs-make-fixed-appliance.pod
libguestfs-make-fixed-appliance.1 $(top_builddir)/website/libguestfs-make-fixed-appliance.1.html: stamp-libguestfs-make-fixed-appliance.pod
stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
$(PODWRAPPER) \
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html \
--html $(top_builddir)/website/libguestfs-make-fixed-appliance.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
# Make clean.
CLEANFILES = \
*~ \
libguestfs-make-fixed-appliance.1 \
stamp-libguestfs-make-fixed-appliance.pod
DISTCLEANFILES = \
stamp-supermin \
DISTCLEANFILES += \
make.sh \
packagelist \
supermin.d/*

View File

@@ -1,27 +0,0 @@
# This file is only used when libguestfs is configured with
#
# ./configure --enable-valgrind-daemon
#
# (only used for development, and only used in the regular supermin
# appliance, not libguestfs live).
#
# If there are any valgrind errors in the base libraries such as
# glibc, then we can suppress them here, so we only see errors in
# libguestfs daemon code.
# libdl
{
libdl_index_cond
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
}
# aug_setm memory leak
{
aug_setm_leak
Memcheck:Leak
...
fun:aug_setm
}

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,10 +66,18 @@ 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
mkdir -p /dev/pts
mount -t devpts /dev/pts /dev/pts
if [[ $cmdline == *selinux=1* ]]; then
mount -t selinuxfs none /sys/fs/selinux
fi
# Static nodes must happen before udev is started.
@@ -58,50 +85,34 @@ mount -t devtmpfs /dev /dev
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 +120,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 +133,6 @@ mdadm -As --auto=yes --run
# Scan for LVM.
modprobe dm_mod ||:
lvmetad ||:
lvm vgchange -aay --sysinit
@@ -129,7 +140,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
@@ -150,18 +161,8 @@ fi
if ! test "$guestfs_rescue" = 1; then
# Run the daemon.
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
if grep -sq guestfs_valgrind_daemon=1 /proc/cmdline; then
if [ -r /etc/guestfsd.suppressions ]; then
suppressions="--suppressions=/etc/guestfsd.suppressions"
fi
vg="valgrind --leak-check=full --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
echo "enabling valgrind: $vg"
fi
# Run guestfsd, under valgrind if asked.
cmd="$vg guestfsd"
cmd="guestfsd"
eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
if test "x$guestfs_channel" != "x"; then
cmd="$cmd --channel $guestfs_channel"
fi
@@ -173,14 +174,6 @@ if ! test "$guestfs_rescue" = 1; then
fi
echo $cmd
$cmd
if [ $? -eq 119 ]; then
echo "DAEMON VALGRIND FAILED"
# Sleep so valgrind messages are seen by the host. Note this
# only happens in non-production builds
# (--enable-valgrind-daemon) + on an error path.
sleep 10
fi
else
# Run virt-rescue shell.

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
@@ -151,4 +151,4 @@ Richard W.M. Jones (C<rjones at redhat dot com>)
=head1 COPYRIGHT
Copyright (C) 2009-2015 Red Hat Inc.
Copyright (C) 2009-2017 Red Hat Inc.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009-2015 Red Hat Inc.
# Copyright (C) 2009-2017 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

View File

@@ -24,12 +24,9 @@ ifelse(UBUNTU,1,`define(`DEBIAN',1)')
ifelse(REDHAT,1,
augeas-libs
btrfs-progs
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
dhclient
dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
e4fsprogs
genisoimage
gfs-utils
gfs2-utils
@@ -40,12 +37,13 @@ ifelse(REDHAT,1,
iputils
kernel
libcap
libldm dnl only Fedora for now, others later
libldm
nilfs-utils
ntfsprogs
ntfs-3g
openssh-clients
pcre
policycoreutils
reiserfs-utils
libselinux
syslinux-extlinux
@@ -58,6 +56,7 @@ ifelse(REDHAT,1,
ifelse(DEBIAN,1,
bsdmainutils
dnl old name used in Jessie and earlier
btrfs-tools
cryptsetup
extlinux
@@ -75,6 +74,7 @@ dnl iproute has been renamed to iproute2
iputils-arping
iputils-tracepath
isc-dhcp-client
ldmtool
libaugeas0
libc-bin
libcap2
@@ -102,8 +102,8 @@ dnl iproute has been renamed to iproute2
ifelse(ARCHLINUX,1,
augeas
btrfs-progs
cdrkit
cdrtools
cryptsetup
dhcpcd
gptfdisk
@@ -117,8 +117,8 @@ ifelse(ARCHLINUX,1,
dnl syslinux has mtools as optional dependency, but in reality it's
dnl a hard one:
mtools
multipath-tools dnl for kpartx
nilfs-utils
ntfsprogs
ntfs-3g
pcre
reiserfsprogs
@@ -126,7 +126,6 @@ ifelse(ARCHLINUX,1,
vim
xz
yajl
zfs-fuse
)
ifelse(SUSE,1,
@@ -136,16 +135,21 @@ ifelse(SUSE,1,
btrfsprogs
cryptsetup
dhcpcd
dhcp-client
genisoimage
glibc-locale
gptfdisk
hivex
initviocons
iproute2
iputils
libcap2
libhivex0
libselinux1
libyajl2
mkisofs
ntfsprogs
ntfs-3g
reiserfs
systemd
vim
@@ -154,7 +158,6 @@ ifelse(SUSE,1,
ifelse(FRUGALWARE,1,
augeas
btrfs-progs
cryptsetup-luks
cdrkit
dhclient
@@ -180,7 +183,6 @@ ifelse(FRUGALWARE,1,
ifelse(MAGEIA,1,
augeas
btrfs-progs
cryptsetup
chkconfig /* for /etc/init.d */
cdrkit-genisoimage
@@ -194,6 +196,8 @@ ifelse(MAGEIA,1,
iproute2
iputils
libcap
libldm
libyajl
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
@@ -213,12 +217,14 @@ acl
attr
bash
binutils
btrfs-progs
bzip2
coreutils
cpio
diffutils
dosfstools
e2fsprogs
f2fs-tools
file
findutils
gawk
@@ -239,12 +245,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
@@ -279,10 +287,14 @@ ifelse(MAGEIA,1,
which
)
curl
kpartx
dnl (virt-dib) tools optionally used for elements
debootstrap
ifelse(VALGRIND_DAEMON,1,valgrind)
dnl exFAT is not usually available in free software repos
exfat-fuse
exfat-utils
fuse-exfat
dnl Define this by doing: ./configure --with-extra-packages="..."
EXTRA_PACKAGES

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2017 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
@@ -22,39 +22,64 @@ scripts = \
guestmount \
virt-alignment-scan \
virt-rescue \
virt-resize \
virt-v2v
# Some of the scripts are simply symbolic links.
symlinks = \
guestunmount \
virt-builder \
virt-cat \
virt-copy-in \
virt-copy-out \
virt-customize \
virt-diff \
virt-df \
virt-dib \
virt-edit \
virt-filesystems \
virt-format \
virt-get-kernel \
virt-inspector \
virt-log \
virt-ls \
virt-p2v-make-disk \
virt-p2v-make-kickstart \
virt-p2v-make-kiwi \
virt-resize \
virt-sparsify \
virt-sysprep
virt-sysprep \
virt-tail \
virt-tar-in \
virt-tar-out
# Note: Don't distribute the symbolic links, only the real files.
EXTRA_DIST = \
README \
$(scripts)
$(scripts) \
$(TESTS)
CLEANFILES = \
CLEANFILES += \
$(symlinks)
# Some of the scripts are simply symbolic links.
virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \
virt-log virt-ls virt-sysprep:
# Any tool that has --short-options and --long-options is handled by
# this common script. However this script cannot deal with commands
# that use --ro/--rw (eg. virt-rescue), nor commands that have lots of
# exceptions (eg. guestfish). Those tools have to be handled
# individually.
guestunmount \
virt-builder virt-cat virt-customize virt-df virt-dib virt-diff \
virt-edit virt-filesystems virt-format virt-get-kernel virt-inspector \
virt-log virt-ls \
virt-p2v-make-disk virt-p2v-make-kickstart virt-p2v-make-kiwi \
virt-resize virt-sparsify virt-sysprep \
virt-tail:
rm -f $@
$(LN_S) virt-alignment-scan $@
virt-builder virt-sparsify:
# guestfish is handled specially.
virt-copy-in virt-copy-out virt-tar-in virt-tar-out:
rm -f $@
$(LN_S) virt-resize $@
$(LN_S) guestfish $@
if HAVE_BASH_COMPLETION
@@ -74,3 +99,13 @@ clean-local:
-test $(srcdir) != $(builddir) && rm -f $(scripts)
endif
# Tests.
TESTS_ENVIRONMENT = \
scripts="$(scripts)" \
symlinks="$(scripts)" \
commands="$(scripts) $(symlinks)" \
$(top_builddir)/run --test
TESTS = \
test-complete-in-script.sh

View File

@@ -1,3 +1,6 @@
This directory contains the scripts for tab-completing commands in
bash. Note these new-style demand-loaded scripts require
'bash-completion' >= 1.99.
Tip: To test the bash completions without having to install them,
simply start a new shell and 'source ./virt-foo'.

View File

@@ -1,5 +1,5 @@
# guestfish bash completion script -*- shell-script -*-
# Copyright (C) 2010-2015 Red Hat Inc.
# Copyright (C) 2010-2017 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
@@ -73,5 +73,12 @@ _guestfish ()
COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
return ;;
esac
} &&
}
complete -o default -F _guestfish guestfish
# virt-copy-in etc are literally the same as guestfish
complete -o default -F _guestfish virt-copy-in
complete -o default -F _guestfish virt-copy-out
complete -o default -F _guestfish virt-tar-in
complete -o default -F _guestfish virt-tar-out

View File

@@ -1,5 +1,5 @@
# guestmount bash completion script -*- shell-script -*-
# Copyright (C) 2010-2015 Red Hat Inc.
# Copyright (C) 2010-2017 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

45
bash/test-complete-in-script.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash -
# libguestfs bash completion test script
# 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.
# Test that the correct 'complete' command is included in the script.
# Mainly prevents symlinking errors and some omissions.
unset CDPATH
export LANG=C
if [ -n "$SKIP_TEST_COMPLETE_IN_SCRIPT_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
fi
if [ -z "$commands" ]; then
echo "$0: \$commands is not defined. Use 'make check' to run this test."
exit 1
fi
for cmd in $commands; do
if [ ! -f $cmd ]; then
echo "$0: script or symlink '$cmd' is missing"
exit 1
fi
if ! grep "^complete.*$cmd\$" $cmd; then
echo "$0: script or symlink '$cmd' does not have"
echo "a 'complete' rule for '$cmd'"
exit 1
fi
done

View File

@@ -1,5 +1,5 @@
# virt-tools bash completion script -*- shell-script -*-
# Copyright (C) 2010-2015 Red Hat Inc.
# Copyright (C) 2010-2017 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,10 +36,29 @@ _guestfs_virttools ()
_init_completion -s || return
case "$prev" in
--align-first)
COMPREPLY=( $( compgen -W "never always auto" -- "$cur") )
return ;;
--check-tmpdir)
COMPREPLY=( $( compgen -W "ignore i continue cont c warn warning w fail f error" -- "$cur") )
return ;;
-d|--domain)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
-D)
doms=$(_guestfs_virsh_list "$flag_ro")
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
return ;;
--list-format)
COMPREPLY=( $( compgen -W "short long json" -- "$cur") )
return ;;
--password-crypto)
COMPREPLY=( $( compgen -W "md5 sha256 sha512" -- "$cur") )
return ;;
--unknown-filesystems)
COMPREPLY=( $( compgen -W "ignore warn error" -- "$cur") )
return ;;
esac
case "$cur" in
@@ -60,24 +79,54 @@ _guestfs_virttools ()
esac
}
_guestunmount ()
{
_guestfs_virttools "guestunmount" 1
} &&
complete -o default -F _guestunmount guestunmount
_virt_alignment_scan ()
{
_guestfs_virttools "virt-alignment-scan" 1
} &&
complete -o default -F _virt_alignment_scan virt-alignment-scan
_virt_builder ()
{
_guestfs_virttools "virt-builder" 0
} &&
complete -o default -F _virt_builder virt-builder
_virt_cat ()
{
_guestfs_virttools "virt-cat" 1
} &&
complete -o default -F _virt_cat virt-cat
_virt_customize ()
{
_guestfs_virttools "virt-customize" 0
} &&
complete -o default -F _virt_customize virt-customize
_virt_dib ()
{
_guestfs_virttools "virt-dib" 0
} &&
complete -o default -F _virt_dib virt-dib
_virt_df ()
{
_guestfs_virttools "virt-df" 1
} &&
complete -o default -F _virt_df virt-df
_virt_diff ()
{
_guestfs_virttools "virt-diff" 1
} &&
complete -o default -F _virt_diff virt-diff
_virt_edit ()
{
_guestfs_virttools "virt-edit" 0
@@ -96,26 +145,68 @@ _virt_format ()
} &&
complete -o default -F _virt_format virt-format
_virt_get_kernel ()
{
_guestfs_virttools "virt-get-kernel" 1
} &&
complete -o default -F _virt_get_kernel virt-get-kernel
_virt_inspector ()
{
_guestfs_virttools "virt-inspector" 1
} &&
complete -o default -F _virt_inspector virt-inspector
_virt_log ()
{
_guestfs_virttools "virt-log" 1
} &&
complete -o default -F _virt_log virt-log
_virt_ls ()
{
_guestfs_virttools "virt-ls" 1
} &&
complete -o default -F _virt_ls virt-ls
_virt_p2v_make_disk ()
{
_guestfs_virttools "virt-p2v-make-disk" 1
} &&
complete -o default -F _virt_p2v_make_disk virt-p2v-make-disk
_virt_p2v_make_kickstart ()
{
_guestfs_virttools "virt-p2v-make-kickstart" 1
} &&
complete -o default -F _virt_p2v_make_kickstart virt-p2v-make-kickstart
_virt_p2v_make_kiwi ()
{
_guestfs_virttools "virt-p2v-make-kiwi" 1
} &&
complete -o default -F _virt_p2v_make_kiwi virt-p2v-make-kiwi
_virt_resize ()
{
_guestfs_virttools "virt-resize" 0
} &&
complete -o default -F _virt_resize virt-resize
_virt_sparsify ()
{
_guestfs_virttools "virt-sparsify" 0
} &&
complete -o default -F _virt_sparsify virt-sparsify
_virt_sysprep ()
{
_guestfs_virttools "virt-sysprep" 0
} &&
complete -o default -F _virt_sysprep virt-sysprep
_virt_log ()
_virt_tail ()
{
_guestfs_virttools "virt-log" 1
_guestfs_virttools "virt-tail" 1
} &&
complete -o default -F _virt_log virt-log
complete -o default -F _virt_tail virt-tail

View File

@@ -1,5 +1,5 @@
# virt-rescue bash completion script -*- shell-script -*-
# Copyright (C) 2010-2015 Red Hat Inc.
# Copyright (C) 2010-2017 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

View File

@@ -1,75 +0,0 @@
# virt-resize, virt-builder, virt-sparsify bash completion script
# -*- shell-script -*-
# Copyright (C) 2010-2015 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.
_guestfs_options_only ()
{
local cur prev words cword split
local shortopts longopts tool="$1"
_init_completion -s || return
case "$prev" in
--align-first)
COMPREPLY=( $( compgen -W "never always auto" -- "$cur") )
return ;;
--check-tmpdir)
COMPREPLY=( $( compgen -W "ignore i continue cont c warn warning w fail f error" -- "$cur") )
return ;;
--list-format)
COMPREPLY=( $( compgen -W "short long json" -- "$cur") )
return ;;
--password-crypto)
COMPREPLY=( $( compgen -W "md5 sha256 sha512" -- "$cur") )
return ;;
esac
case "$cur" in
--*)
# --options
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
-*)
# -o and --options
shortopts="$($tool --short-options)"
longopts="$($tool --long-options)"
COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
return ;;
*)
COMPREPLY=( $(compgen "$cur") )
return ;;
esac
}
_virt_builder ()
{
_guestfs_options_only "virt-builder"
} &&
complete -o default -F _virt_builder virt-builder
_virt_resize ()
{
_guestfs_options_only "virt-resize"
} &&
complete -o default -F _virt_resize virt-resize
_virt_sparsify ()
{
_guestfs_options_only "virt-sparsify"
} &&
complete -o default -F _virt_sparsify virt-sparsify

View File

@@ -56,6 +56,7 @@ full-write
futimens
getaddrinfo
getline
getprogname
gitlog-to-changelog
glob
gnu-make

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2015 Red Hat Inc.
# Copyright (C) 2009-2017 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

141
build-aux/guestfs-test-driver Executable file
View File

@@ -0,0 +1,141 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2017 Free Software Foundation, 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
start_t="$(date +'%s')"
"$@" >$log_file 2>&1
estatus=$?
end_t="$(date +'%s')"
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
echo ":guestfs-time: $(($end_t - $start_t))" >> $trs_file

View File

@@ -1,5 +1,5 @@
# libguestfs virt-builder tool
# Copyright (C) 2013-2015 Red Hat Inc.
# Copyright (C) 2013-2017 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
@@ -22,9 +22,15 @@ AM_YFLAGS = -d
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
libguestfs.gpg \
opensuse.gpg \
test-console.sh \
test-index \
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 \
test-virt-index-validate.sh \
test-virt-index-validate-bad-1 \
@@ -32,14 +38,13 @@ EXTRA_DIST = \
test-virt-index-validate-good-2 \
test-virt-index-validate-good-3 \
virt-builder.pod \
virt-index-validate.pod
CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
virt-index-validate.pod \
yajl_tests.ml
SOURCES_MLI = \
cache.mli \
cmdline.mli \
downloader.mli \
checksums.mli \
index.mli \
index_parser.mli \
ini_reader.mli \
@@ -48,15 +53,17 @@ SOURCES_MLI = \
pxzcat.mli \
setlocale.mli \
sigchecker.mli \
sources.mli
simplestreams_parser.mli \
sources.mli \
yajl.mli
SOURCES_ML = \
utils.ml \
pxzcat.ml \
setlocale.ml \
checksums.ml \
index.ml \
ini_reader.ml \
yajl.ml \
paths.ml \
languages.ml \
cache.ml \
@@ -64,24 +71,19 @@ SOURCES_ML = \
downloader.ml \
sigchecker.ml \
index_parser.ml \
simplestreams_parser.ml \
list_entries.ml \
cmdline.ml \
builder.ml
SOURCES_C = \
$(top_srcdir)/mllib/fsync-c.c \
$(top_srcdir)/mllib/uri-c.c \
$(top_srcdir)/mllib/mkdtemp-c.c \
$(top_srcdir)/customize/perl_edit-c.c \
$(top_srcdir)/customize/crypt-c.c \
$(top_srcdir)/fish/uri.c \
$(top_srcdir)/fish/file-edit.c \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c \
pxzcat-c.c \
setlocale-c.c
setlocale-c.c \
yajl-c.c
man_MANS =
noinst_DATA =
@@ -98,7 +100,8 @@ virt_builder_CPPFLAGS = \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_srcdir)/src \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/fish
virt_builder_CFLAGS = \
-pthread \
@@ -106,48 +109,30 @@ virt_builder_CFLAGS = \
-Wno-unused-macros \
$(LIBLZMA_CFLAGS) \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS)
$(LIBXML2_CFLAGS) \
$(YAJL_CFLAGS)
BOBJECTS = \
$(top_builddir)/mllib/libdir.cmo \
$(top_builddir)/mllib/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
# -I $(top_builddir)/lib/.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.
OCAMLPACKAGES = \
-package str,unix \
-I $(top_builddir)/src/.libs \
-I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/lib/.libs \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib \
-I $(top_builddir)/customize
OCAMLPACKAGES_TESTS =
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
if HAVE_OCAML_PKG_OUNIT
OCAMLPACKAGES_TESTS += -package oUnit
endif
OCAMLCLIBS = \
-pthread -lpthread \
@@ -156,6 +141,7 @@ OCAMLCLIBS = \
$(LIBCRYPT_LIBS) \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
$(YAJL_LIBS) \
$(LIBINTL) \
-lgnu
@@ -163,61 +149,53 @@ 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
noinst_DATA += $(top_builddir)/html/virt-builder.1.html
noinst_DATA += $(top_builddir)/website/virt-builder.1.html
virt-builder.1 $(top_builddir)/html/virt-builder.1.html: stamp-virt-builder.pod
virt-builder.1 $(top_builddir)/website/virt-builder.1.html: stamp-virt-builder.pod
stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synopsis.pod $(top_srcdir)/customize/customize-options.pod
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/html/virt-builder.1.html \
--html $(top_builddir)/website/virt-builder.1.html \
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning safe \
$<
touch $@
CLEANFILES += stamp-virt-builder.pod
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
disk_images := \
$(shell for f in debian fedora ubuntu windows; do if [ -s "../tests/guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../tests/guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
$(shell for f in debian fedora ubuntu windows; do if [ -s "../test-data/phony-guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../test-data/phony-guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
CLEANFILES += *.qcow2 *.xz
check_DATA = $(disk_images)
fedora.qcow2: ../tests/guests/fedora.img
fedora.qcow2: ../test-data/phony-guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
mv $@-t $@
@@ -227,24 +205,94 @@ fedora.qcow2.xz: fedora.qcow2
xz --best -c $< > $@-t
mv $@-t $@
%.xz: ../tests/guests/%.img
%.xz: ../test-data/phony-guests/%.img
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
yajl_tests_SOURCES = yajl-c.c
yajl_tests_CPPFLAGS = $(virt_builder_CPPFLAGS)
yajl_tests_BOBJECTS = \
yajl.cmo \
yajl_tests.cmo
yajl_tests_XOBJECTS = $(yajl_tests_BOBJECTS:.cmo=.cmx)
# Can't call the following as <test>_OBJECTS because automake gets confused.
if HAVE_OCAMLOPT
yajl_tests_THEOBJECTS = $(yajl_tests_XOBJECTS)
yajl_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
else
yajl_tests_THEOBJECTS = $(yajl_tests_BOBJECTS)
yajl_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
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 =
TESTS += test-virt-builder-list-simplestreams.sh
if ENABLE_APPLIANCE
TESTS += test-virt-builder.sh
endif ENABLE_APPLIANCE
if HAVE_OCAML_PKG_OUNIT
check_PROGRAMS += yajl_tests
TESTS += yajl_tests
endif
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
$(MAKE) VG="@VG@" check
# Slow tests.
SLOW_TESTS = \
$(console_test_scripts) \
test-virt-builder-planner.sh
check-slow:
$(MAKE) TESTS="test-virt-builder-planner.sh" check
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
# Test that the supplied guests boot with a serial console.
#
# Note that in future we might decide to make the serial console a
# feature, eg. `virt-builder --add-serial-console' or `virt-builder
# --remove-serial-console', so don't assume that having these tests
# means that a serial console is a requirement.
console_test_scripts := \
test-console-centos-7.2.sh \
test-console-rhel-6.8.sh \
test-console-rhel-7.2.sh \
test-console-debian-7.sh \
test-console-debian-8.sh \
test-console-fedora-24.sh \
test-console-ubuntu-12.04.sh \
test-console-ubuntu-14.04.sh \
test-console-ubuntu-16.04.sh
test-console-%.sh:
rm -f $@ $@-t
f=`echo "$@" | $(SED) 's/test-console-\(.*\).sh/\1/'`; \
echo 'script=$@ exec $$srcdir/test-console.sh' "$$f" > $@-t
chmod 0755 $@-t
mv $@-t $@
CLEANFILES += \
$(console_test_scripts) \
console-*.img \
console-*.out
# Dependencies.
depend: .depend
@@ -262,17 +310,16 @@ depend: .depend
endif
DISTCLEANFILES = .depend
.PHONY: depend docs
# virt-builder's default repository
repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d
repoconf_DATA = libguestfs.conf libguestfs.gpg
repoconf_DATA = libguestfs.conf libguestfs.gpg \
opensuse.conf opensuse.gpg
install-exec-hook:
$(LN_S) xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
$(LN_S) -f xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
# Build a small C index validator program.
bin_PROGRAMS += virt-index-validate
@@ -289,7 +336,8 @@ virt_index_validate_CPPFLAGS = \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/src
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib
virt_index_validate_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros
@@ -298,23 +346,23 @@ virt_index_validate_LDADD = \
../gnulib/lib/libgnu.la
man_MANS += virt-index-validate.1
noinst_DATA += $(top_builddir)/html/virt-index-validate.1.html
noinst_DATA += $(top_builddir)/website/virt-index-validate.1.html
virt-index-validate.1 $(top_builddir)/html/virt-index-validate.1.html: stamp-virt-index-validate.pod
virt-index-validate.1 $(top_builddir)/website/virt-index-validate.1.html: stamp-virt-index-validate.pod
stamp-virt-index-validate.pod: virt-index-validate.pod
$(PODWRAPPER) \
--man virt-index-validate.1 \
--html $(top_builddir)/html/virt-index-validate.1.html \
--html $(top_builddir)/website/virt-index-validate.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
CLEANFILES += \
index-parse.c \
index-parse.h \
index-scan.c \
stamp-virt-index-validate.pod
index-scan.c
if HAVE_OCAML
# Automake-generated makefile has a rule ".y.c" but lacks a rule ".y.h".

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -34,6 +34,13 @@ open Printf
let () = Random.self_init ()
let remove_duplicates index =
let compare_revisions rev1 rev2 =
match rev1, rev2 with
| Rev_int n1, Rev_int n2 -> compare n1 n2
| Rev_string s1, Rev_int n2 -> compare s1 (string_of_int n2)
| Rev_int n1, Rev_string s2 -> compare (string_of_int n1) s2
| Rev_string s1, Rev_string s2 -> compare s1 s2
in
(* Fill an hash with the higher revision of the available
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
@@ -44,7 +51,7 @@ let remove_duplicates index =
let id = name, arch in
try
let rev = Hashtbl.find nseen id in
if revision > rev then
if compare_revisions rev revision > 0 then
Hashtbl.replace nseen id revision
with Not_found ->
Hashtbl.add nseen id revision
@@ -68,13 +75,33 @@ 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 mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, size, smp, sources, sync =
parse_cmdline () in
let cmdline = parse_cmdline () in
(* If debugging, echo the command line arguments and the sources. *)
if verbose () then (
@@ -84,29 +111,27 @@ let main () =
iteri (
fun i (source, fingerprint) ->
printf "source[%d] = (%S, %S)\n" i source fingerprint
) sources
) cmdline.sources
);
(* Handle some modes here, some later on. *)
let mode =
match mode with
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 format with
| None -> ""
| Some format -> sprintf " --format %s" (quote format))
(match output with
| None -> ""
| Some output -> sprintf " --output %s" (quote output))
(quote 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 cache with
(match cmdline.cache with
| Some cachedir ->
message (f_"Deleting: %s") cachedir;
Cache.clean_cachedir cachedir;
@@ -122,27 +147,27 @@ let main () =
(* Check that gpg is installed. Optional as long as the user
* disables all signature checks.
*)
let cmd = sprintf "%s --help >/dev/null 2>&1" gpg in
if Sys.command cmd <> 0 then (
if check_signature then
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.gpg in
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
warning (f_"gpg program is not available")
);
(* Check that curl works. *)
let cmd = sprintf "%s --help >/dev/null 2>&1" curl in
if Sys.command cmd <> 0 then
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.curl in
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. *)
let cache =
match cache with
match cmdline.cache with
| None -> None
| Some dir ->
try Some (Cache.create ~directory:dir)
@@ -152,29 +177,40 @@ let main () =
None
in
(* Create a single temporary directory for all the small-or-so
* temporary files that Downloader, Sigchecker, etc, are going
* create.
*)
let tmpdir = Mkdtemp.temp_dir "virt-builder." "" in
rmdir_on_exit tmpdir;
(* Download the sources. *)
let downloader = Downloader.create ~curl ~cache in
let downloader = Downloader.create ~curl:cmdline.curl ~cache ~tmpdir in
let repos = Sources.read_sources () in
let sources = List.map (
fun (source, fingerprint) ->
{
Sources.name = source; uri = source;
gpgkey = Utils.Fingerprint fingerprint;
proxy = Downloader.SystemProxy;
proxy = Curl.SystemProxy;
format = Sources.FormatNative;
}
) sources in
) cmdline.sources in
let sources = List.append sources repos in
let index : Index.index =
List.concat (
List.map (
fun source ->
let sigchecker =
Sigchecker.create ~gpg ~check_signature
~gpgkey:source.Sources.gpgkey in
Sigchecker.create ~gpg:cmdline.gpg
~check_signature:cmdline.check_signature
~gpgkey:source.Sources.gpgkey
~tmpdir in
match source.Sources.format with
| Sources.FormatNative ->
Index_parser.get_index ~downloader ~sigchecker source
| Sources.FormatSimpleStreams ->
Simplestreams_parser.get_index ~downloader ~sigchecker source
) sources
) in
let index = remove_duplicates index in
@@ -183,7 +219,13 @@ let main () =
let mode =
match mode with
| `List -> (* --list *)
List_entries.list_entries ~list_format ~sources index;
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
| `Print_cache -> (* --print-cache *)
@@ -211,7 +253,7 @@ let main () =
fun (name,
{ Index.revision = revision; file_uri = file_uri;
proxy = proxy }) ->
let template = name, arch, revision in
let template = name, cmdline.arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
ignore (Downloader.download downloader ~template ~progress_bar
@@ -223,26 +265,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 arg l
) index in
fst item
with Not_found -> arg in
let item =
try List.find (
fun (name, { Index.arch = a }) ->
name = arg && arch = a
) index
with Not_found ->
error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
arg 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
@@ -264,12 +288,21 @@ 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 =
let { Index.revision = revision; file_uri = file_uri;
proxy = proxy } = entry in
let template = arg, arch, revision in
let template = arg, cmdline.arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
Downloader.download downloader ~template ~progress_bar ~proxy
@@ -282,7 +315,11 @@ let main () =
match entry with
(* New-style: Using a checksum. *)
| { Index.checksums = Some csums } ->
Checksums.verify_checksums csums template
(try Checksums.verify_checksums csums template
with Checksums.Mismatched_checksum (csum, csum_actual) ->
error (f_"%s checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\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!")
(Checksums.string_of_csum_t csum) csum_actual (Checksums.string_of_csum csum)
)
| { Index.checksums = None } ->
(* Old-style: detached signature. *)
@@ -319,7 +356,7 @@ let main () =
(* Planner: Goal. *)
let output_filename, output_format =
match output, format with
match cmdline.output, cmdline.format with
| None, None -> sprintf "%s.img" arg, "raw"
| None, Some "raw" -> sprintf "%s.img" arg, "raw"
| None, Some format -> sprintf "%s.%s" arg format, format
@@ -344,7 +381,7 @@ let main () =
let { Index.size = original_image_size } = entry in
let size =
match size with
match cmdline.size with
| Some size -> size
(* --size parameter missing, output to file: use original image size *)
| None when not output_is_block_dev -> original_image_size
@@ -372,13 +409,15 @@ let main () =
goal_must, goal_must_not in
let cache_dir = (open_guestfs ())#get_cachedir () in
(* Planner: Transitions. *)
let transitions itags =
let is t = List.mem_assoc t itags in
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
@@ -388,7 +427,7 @@ let main () =
(* Since the final plan won't run in parallel, we don't only need
* to choose unique tempfiles per transition, so this is OK:
*)
let tempfile = Filename.temp_file "vb" ".img" in
let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in
unlink_on_exit tempfile;
(* Always possible to copy from one place to another. The only
@@ -447,10 +486,9 @@ let main () =
* Don't run 'qemu-img resize' on an auto format. This is to
* force an explicit conversion step to a real format.
*)
else if output_size > old_size && is_not `Template && List.mem_assoc `Format itags then (
else if output_size > old_size && is_not `Template
&& List.mem_assoc `Format itags then
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
);
(* qemu-img convert is always possible, and quicker. It doesn't
* resize, but it does change the format.
@@ -518,7 +556,7 @@ let main () =
* if it's block device, or if --no-delete-on-failure is set.
*)
let delete_output_file =
ref (delete_on_failure && not output_is_block_dev) in
ref (cmdline.delete_on_failure && not output_is_block_dev) in
let delete_file () =
if !delete_output_file then
try unlink output_filename with _ -> ()
@@ -532,16 +570,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
@@ -562,27 +598,23 @@ let main () =
(human_size osize);
let preallocation = if oformat = "qcow2" then Some "metadata" else None in
let () =
let g = new G.guestfs () in
if trace () then g#set_trace true;
if verbose () then g#set_verbose true;
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 %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
@@ -592,8 +624,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
@@ -601,34 +632,27 @@ let main () =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let oformat = List.assoc `Format otags in
message (f_"Converting %s to %s")
(match iformat with None -> "auto" | Some f -> f) oformat;
(match iformat with
| None -> message (f_"Converting to %s") oformat
| Some f -> message (f_"Converting %s to %s") f oformat
);
let cmd = sprintf "qemu-img convert%s %s -O %s %s%s"
(match iformat with
| None -> ""
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote ofile)
(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. *)
message (f_"Opening the new disk");
let g =
let g = new G.guestfs () in
if trace () then g#set_trace true;
if verbose () then g#set_verbose true;
let g = open_guestfs () in
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
(match smp with None -> () | Some smp -> 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;
may g#set_memsize cmdline.memsize;
may g#set_smp cmdline.smp;
g#set_network cmdline.network;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
@@ -637,7 +661,7 @@ let main () =
List.iter (
fun (format, file) ->
g#add_drive_opts ?format ~readonly:true file;
) attach;
) cmdline.attach;
g#launch ();
@@ -647,21 +671,13 @@ 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.")
in
Customize_run.run g root ops;
Customize_run.run g root cmdline.customize_ops;
(* Collect some stats about the final output file.
* Notes:
@@ -715,7 +731,7 @@ let main () =
* and therefore bypasses the host cache). In general you should not
* use cache=none.
*)
if sync then
if cmdline.sync then
Fsync.file output_filename;
(* Now that we've finished the build, don't delete the output file on
@@ -727,8 +743,6 @@ let main () =
Pervasives.flush Pervasives.stdout;
Pervasives.flush Pervasives.stderr;
match stats with
| None -> ()
| Some stats -> print_string stats
may print_string stats
let () = run_main_and_handle_errors main

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -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;
@@ -40,7 +40,7 @@ let create ~directory =
}
let cache_of_name t name arch revision =
t.directory // sprintf "%s.%s.%d" name arch revision
t.directory // sprintf "%s.%s.%s" name arch (string_of_revision revision)
let is_cached t name arch revision =
let filename = cache_of_name t name arch revision in

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -27,16 +27,16 @@ type t
val create : directory:string -> t
(** Create the abstract type. *)
val cache_of_name : t -> string -> string -> int -> string
val cache_of_name : t -> string -> string -> Utils.revision -> string
(** [cache_of_name t name arch revision] return the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
val is_cached : t -> string -> string -> int -> bool
val is_cached : t -> string -> string -> Utils.revision -> bool
(** [is_cached t name arch revision] return whether the file with
specified name, architecture and revision is cached. *)
val print_item_status : t -> header:bool -> (string * string * int) list -> unit
val print_item_status : t -> header:bool -> (string * string * Utils.revision) list -> unit
(** [print_item_status t header items] print the status in the cache
of the specified items (which are tuples of name, architecture,
and revision).

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -20,6 +20,7 @@
open Common_gettext.Gettext
open Common_utils
open Getopt.OptionName
open Customize_cmdline
@@ -30,6 +31,30 @@ module G = Guestfs
open Unix
open Printf
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
customize_ops : Customize_cmdline.ops;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : List_entries.format;
memsize : int option;
network : bool;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
let parse_cmdline () =
let mode = ref `Install in
let list_mode () = mode := `List in
@@ -47,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
@@ -59,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
@@ -89,83 +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)";
"--short-options", Arg.Unit display_short_options, " " ^ s_"List short options";
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"--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";
"--quiet", Arg.Unit set_quiet, " " ^ s_"No progress messages";
"--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";
"-v", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"-V", Arg.Unit print_version_and_exit,
" " ^ s_"Display version and exit";
"--version", Arg.Unit print_version_and_exit,
" " ^ s_"Display version and exit";
"-x", Arg.Unit set_trace, " " ^ s_"Enable tracing of libguestfs calls";
[ 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 =
let cmp (arg1, _, _) (arg2, _, _) =
let arg1 = skip_dashes arg1 and arg2 = skip_dashes arg2 in
compare (String.lowercase arg1) (String.lowercase arg2)
in
List.sort cmp argspec in
let argspec = Arg.align argspec in
long_options := argspec;
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
@@ -182,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
@@ -206,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 (
@@ -233,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
@@ -293,13 +300,14 @@ read the man page virt-builder(1).
(* Check the architecture. *)
let arch =
match arch with
| "" -> Config.host_cpu
| "" -> Guestfs_config.host_cpu
| arch -> arch in
let arch = normalize_arch arch in
(* If user didn't elect any root password, that means we set a random
* root password.
*)
let ops =
let customize_ops =
let has_set_root_password = List.exists (
function `RootPassword _ -> true | _ -> false
) ops.ops in
@@ -309,7 +317,13 @@ read the man page virt-builder(1).
{ ops with ops = ops.ops @ [ `RootPassword pw ] }
) in
mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
network, ops, output, size, smp, sources, sync
{ mode = mode; arg = arg;
arch = arch; attach = attach; cache = cache;
check_signature = check_signature; curl = curl;
customize_ops = customize_ops;
delete_on_failure = delete_on_failure; format = format;
gpg = gpg; list_format = list_format; memsize = memsize;
network = network; output = output;
size = size; smp = smp; sources = sources; sync = sync;
warn_if_partition = warn_if_partition;
}

45
builder/cmdline.mli Normal file
View File

@@ -0,0 +1,45 @@
(* virt-builder
* Copyright (C) 2013-2017 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.
*)
(** Command line argument parsing. *)
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
customize_ops : Customize_cmdline.ops;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : List_entries.format;
memsize : int option;
network : bool;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
val parse_cmdline : unit -> cmdline

View File

@@ -29,24 +29,21 @@ type filename = string
type t = {
curl : string;
tmpdir : string;
cache : Cache.t option; (* cache for templates *)
}
type proxy_mode =
| UnsetProxy
| SystemProxy
| ForcedProxy of string
let create ~curl ~cache = {
let create ~curl ~tmpdir ~cache = {
curl = curl;
tmpdir = tmpdir;
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. *)
let tmpfile = Filename.temp_file "vbcache" ".txt" in
let tmpfile = Filename.temp_file ~temp_dir:t.tmpdir "vbcache" ".txt" in
download_to t ?progress_bar ~proxy uri tmpfile;
(tmpfile, true)
@@ -79,28 +76,42 @@ and download_to t ?(progress_bar = false) ~proxy uri filename =
* fails, we download to a random name in the cache and then
* atomically rename it to the final filename.
*)
let filename_new = filename ^ "." ^ string_random8 () in
let filename_new = filename ^ "." ^ String.random8 () in
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 -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 ~tmpdir:t.tmpdir !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 +125,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 -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 ~tmpdir:t.tmpdir !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
val create : curl:string -> tmpdir:string -> cache:Cache.t option -> t
(** Create the abstract type. *)
val download : t -> ?template:(string*string*int) -> ?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,12 +23,14 @@
#include <string.h>
#include <limits.h>
#include <getopt.h>
#include <error.h>
#include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <guestfs.h>
#include "getprogname.h"
#include "guestfs-internal-frontend.h"
#include "index-struct.h"
@@ -39,7 +41,7 @@ extern int do_parse (struct parse_context *context, FILE *in);
static void
usage (int exit_status)
{
printf ("%s index\n", guestfs_int_program_name);
printf ("%s index\n", getprogname ());
exit (exit_status);
}
@@ -47,7 +49,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,16 +83,15 @@ 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':
printf ("%s %s%s\n",
guestfs_int_program_name,
getprogname (),
PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);
exit (EXIT_SUCCESS);
@@ -108,30 +109,27 @@ 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);
if (fclose (in) == EOF) {
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
guestfs_int_program_name, input);
getprogname (), input);
}
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 +140,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 +151,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 +171,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

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -32,7 +32,7 @@ and entry = {
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : int;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
@@ -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;
@@ -63,20 +63,11 @@ let print_entry chan (name, { printable_name = printable_name;
hidden = hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
(match printable_name with
| None -> ()
| Some name -> fp "name=%s\n" name
);
(match osinfo with
| None -> ()
| Some id -> fp "osinfo=%s\n" id
);
may (fp "name=%s\n") printable_name;
may (fp "osinfo=%s\n") osinfo;
fp "file=%s\n" file_uri;
fp "arch=%s\n" arch;
(match signature_uri with
| None -> ()
| Some uri -> fp "sig=%s\n" uri
);
may (fp "sig=%s\n") signature_uri;
(match checksums with
| None -> ()
| Some checksums ->
@@ -86,24 +77,12 @@ let print_entry chan (name, { printable_name = printable_name;
(Checksums.string_of_csum_t c) (Checksums.string_of_csum c)
) checksums
);
fp "revision=%d\n" revision;
(match format with
| None -> ()
| Some format -> fp "format=%s\n" format
);
fp "revision=%s\n" (string_of_revision revision);
may (fp "format=%s\n") format;
fp "size=%Ld\n" size;
(match compressed_size with
| None -> ()
| Some size -> fp "compressed_size=%Ld\n" size
);
(match expand with
| None -> ()
| Some expand -> fp "expand=%s\n" expand
);
(match lvexpand with
| None -> ()
| Some lvexpand -> fp "lvexpand=%s\n" lvexpand
);
may (fp "compressed_size=%Ld\n") compressed_size;
may (fp "expand=%s\n") expand;
may (fp "lvexpand=%s\n") lvexpand;
List.iter (
fun (lang, notes) ->
match lang with

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -24,7 +24,7 @@ and entry = {
arch : string;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : int;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
@@ -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

@@ -32,7 +32,7 @@ let get_index ~downloader ~sigchecker
let rec get_index () =
(* Get the index page. *)
let tmpfile, delete_tmpfile = Downloader.download downloader ~proxy uri in
let tmpfile, _ = Downloader.download downloader ~proxy uri in
(* Check index file signature (also verifies it was fully
* downloaded and not corrupted in transit).
@@ -41,8 +41,6 @@ let get_index ~downloader ~sigchecker
(* Try parsing the file. *)
let sections = Ini_reader.read_ini tmpfile in
if delete_tmpfile then
(try Unix.unlink tmpfile with _ -> ());
(* Check for repeated os-version+arch combination. *)
let name_arch_map = List.map (
@@ -112,10 +110,10 @@ let get_index ~downloader ~sigchecker
try Some (List.assoc ("checksum", None) fields)
with Not_found -> None in
let revision =
try int_of_string (List.assoc ("revision", None) fields)
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
| Not_found -> 1
| Failure "int_of_string" ->
| Not_found -> Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse 'revision' field for '%s'\n") prog n;
corrupt_file () in
let format =
@@ -126,7 +124,7 @@ let get_index ~downloader ~sigchecker
| Not_found ->
eprintf (f_"%s: no 'size' field for '%s'\n") prog n;
corrupt_file ()
| Failure "int_of_string" ->
| Failure _ ->
eprintf (f_"%s: cannot parse 'size' field for '%s'\n") prog n;
corrupt_file () in
let compressed_size =
@@ -134,7 +132,7 @@ let get_index ~downloader ~sigchecker
with
| Not_found ->
None
| Failure "int_of_string" ->
| Failure _ ->
eprintf (f_"%s: cannot parse 'compressed_size' field for '%s'\n")
prog n;
corrupt_file () in
@@ -159,13 +157,13 @@ let get_index ~downloader ~sigchecker
try bool_of_string (List.assoc ("hidden", None) fields)
with
| Not_found -> false
| Failure "bool_of_string" ->
| Failure _ ->
eprintf (f_"%s: cannot parse 'hidden' field for '%s'\n")
prog n;
corrupt_file () in
let aliases =
let l =
try string_nsplit " " (List.assoc ("aliases", None) fields)
try String.nsplit " " (List.assoc ("aliases", None) fields)
with Not_found -> [] in
match l with
| [] -> None
@@ -209,7 +207,7 @@ let get_index ~downloader ~sigchecker
eprintf (f_"%s: zero length path in the index file\n") prog;
corrupt_file ()
)
else if string_find path "://" >= 0 then (
else if String.find path "://" >= 0 then (
eprintf (f_"%s: cannot use a URI ('%s') in the index file\n") prog path;
corrupt_file ()
)

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2015 Red Hat Inc.
* Copyright (C) 2013-2017 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
@@ -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 (
@@ -35,10 +48,7 @@ and list_entries_short index =
if not hidden then (
printf "%-24s" name;
printf " %-10s" arch;
(match printable_name with
| None -> ()
| Some s -> printf " %s" s
);
may (printf " %s") printable_name;
printf "\n"
)
) index
@@ -69,10 +79,7 @@ and list_entries_long ~sources index =
hidden = hidden }) ->
if not hidden then (
printf "%-24s %s\n" "os-version:" name;
(match printable_name with
| None -> ()
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
);
may (printf "%-24s %s\n" (s_"Full name:")) printable_name;
printf "%-24s %s\n" (s_"Architecture:") arch;
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
(match compressed_size with

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

3
builder/opensuse.conf.in Normal file
View File

@@ -0,0 +1,3 @@
[opensuse.org]
uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg

21
builder/opensuse.gpg Normal file
View File

@@ -0,0 +1,21 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ
Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX
C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl
ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT
6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD
DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u
IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+
iQE7BBMBAgAmBQJSJgJdAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwECHgECF4AA
CgkQoZP7tXIXT8ITnwf3SVUUoVjVLFCjhIxdet8BL011cJDwr9TwKEQfq4Ybsq5L
5Y1/Zk86rTzrVOZrODLwNRIC3fMuegZV5f85KMggXu37Di+UvX+dQW9v1hte+hAT
+gsqb60kOnE/Yacgkb6D3xIzRudAB2q/xfvHl/hgfn416yGI8NvntT7n4Hk9wT28
9JSFkun0uaessg77aXlAdsqHwdugm9hELeva89OoYoiZ4d9r4ScTMSj0UkNgnh7g
CyIScZHYqiiOeosUtAX9u1PyUFfFsg9s5snfud7aF48EfXU0RTtZAGKtG4GPDv3q
bYc5TJ2pQzs9y5Bk/jAMR/QQw8CKglBsn1cjYkKViEYEExECAAYFAlImAl0ACgkQ
OzARt2udZSO5yACgr6Ei7QZ+PAmg4Mr5db+4M3aepAEAniU33RaTKBCGkwQi6kHr
4VaII2/E
=l8DH
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -36,6 +36,6 @@ let xdg_config_dirs () =
let dirs =
try Sys.getenv "XDG_CONFIG_DIRS"
with Not_found -> "/etc/xdg" in
let dirs = string_nsplit ":" dirs in
let dirs = String.nsplit ":" dirs in
let dirs = List.filter (fun x -> x <> "") dirs in
List.map (fun x -> x // prog) dirs

View File

@@ -51,8 +51,8 @@
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
#if defined (HAVE_LIBLZMA) && \
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
#if defined (HAVE_LIBLZMA) && \
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
defined (HAVE_LZMA_INDEX_STREAM_PADDING)
#define PARALLEL_XZCAT 1
#else
@@ -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);
@@ -670,7 +683,7 @@ worker_thread (void *vp)
*/
if (!is_zero (outbuf, wsz)) {
if (xpwrite (global->ofd, outbuf, wsz, oposition) == -1) {
perror (global->filename);
perror (global->outputfile);
return &state->status;
}
}

View File

@@ -30,26 +30,25 @@ type t = {
subkeys_fingerprints : string list;
check_signature : bool;
gpghome : string;
tmpdir : string;
}
(* Import the specified key file. *)
let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile =
let status_file = Filename.temp_file ~temp_dir:tmpdir "vbstat" ".txt" in
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
let status = string_nsplit "\n" status in
let status = String.nsplit "\n" status in
let key_id = ref "" in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
| "[GNUPG:]" :: "IMPORTED" :: key :: _ -> key_id := key
@@ -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,13 +67,12 @@ 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
List.iter (
fun line ->
let line = string_nsplit ":" line in
let line = String.nsplit ":" line in
match line with
| "sub" :: ("u"|"-") :: _ :: _ :: id :: _ ->
current := Some id
@@ -83,9 +80,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
(match !current with
| None -> ()
| Some k ->
if string_suffix id k then (
subkeys := id :: !subkeys;
);
if String.is_suffix id k then push_front id subkeys;
current := None
)
| _ -> ()
@@ -93,10 +88,9 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
!subkeys in
!fingerprint, subkeys
let rec create ~gpg ~gpgkey ~check_signature =
let rec create ~gpg ~gpgkey ~check_signature ~tmpdir =
(* Create a temporary directory for gnupg. *)
let tmpdir = Mkdtemp.temp_dir "vb.gpghome." "" in
rmdir_on_exit tmpdir;
let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." "" in
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
@@ -108,27 +102,24 @@ let rec create ~gpg ~gpgkey ~check_signature =
* cannot.
*)
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
gpg gpgtmpdir (if verbose () then "" else " >/dev/null 2>&1") 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
| No_Key ->
assert false
| KeyFile kf ->
import_keyfile gpg tmpdir kf
import_keyfile gpg gpgtmpdir tmpdir kf
| Fingerprint fp ->
let filename = Filename.temp_file "vbpubkey" ".asc" in
unlink_on_exit filename;
let filename = Filename.temp_file ~temp_dir:tmpdir "vbpubkey" ".asc" in
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
import_keyfile gpg gpgtmpdir tmpdir filename
) else
"", [] in
{
@@ -136,7 +127,8 @@ let rec create ~gpg ~gpgkey ~check_signature =
fingerprint = fingerprint;
subkeys_fingerprints = subkeys;
check_signature = check_signature;
gpghome = tmpdir;
gpghome = gpgtmpdir;
tmpdir = tmpdir;
}
(* Compare two strings of hex digits ignoring whitespace and case. *)
@@ -186,13 +178,10 @@ and verify_and_remove_signature t filename =
if t.check_signature then (
(* Copy the input file as temporary file with the .asc extension,
* 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 out_file = Filename.temp_file "vbfile" "" in
unlink_on_exit out_file;
let asc_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" ".asc" in
let cmd = [ "cp"; filename; asc_file ] in
if run_command cmd <> 0 then exit 1;
let out_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" "" in
let args = sprintf "--yes --output %s %s" (quote out_file) (quote filename) in
do_verify ~verify_only:false t args;
Some out_file
@@ -200,27 +189,25 @@ and verify_and_remove_signature t filename =
None
and do_verify ?(verify_only = true) t args =
let status_file = Filename.temp_file "vbstat" ".txt" in
unlink_on_exit status_file;
let status_file = Filename.temp_file ~temp_dir:t.tmpdir "vbstat" ".txt" in
let cmd =
sprintf "%s --homedir %s %s%s --status-file %s %s"
t.gpg t.gpghome
(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!");
(* Check the fingerprint is who it should be. *)
let status = read_whole_file status_file in
let status = string_nsplit "\n" status in
let status = String.nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = string_nsplit " " line in
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp
| _ -> ()

View File

@@ -18,7 +18,7 @@
type t
val create : gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> t
val create : gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> tmpdir:string -> t
val verifying_signatures : t -> bool
(** Return whether signatures are being verified by this

View File

@@ -0,0 +1,154 @@
(* virt-builder
* Copyright (C) 2015 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 Yajl
open Utils
open Printf
let ensure_trailing_slash str =
if String.length str > 0 && str.[String.length str - 1] <> '/' then str ^ "/"
else str
let get_index ~downloader ~sigchecker
{ Sources.uri = uri; proxy = proxy } =
let uri = ensure_trailing_slash uri in
let download_and_parse uri =
let tmpfile, _ = Downloader.download downloader ~proxy uri in
let file =
if Sigchecker.verifying_signatures sigchecker then (
let tmpunsigned =
Sigchecker.verify_and_remove_signature sigchecker tmpfile in
match tmpunsigned with
| None -> assert false (* only when not verifying signatures *)
| Some f -> f
) else
tmpfile in
yajl_tree_parse (read_whole_file file) in
let downloads =
let uri_index =
if Sigchecker.verifying_signatures sigchecker then
uri ^ "streams/v1/index.sjson"
else
uri ^ "streams/v1/index.json" in
let tree = download_and_parse uri_index in
let format = object_get_string "format" tree in
if format <> "index:1.0" then
error (f_"%s is not a Simple Streams (index) v1.0 JSON file (format: %s)")
uri format;
let index = Array.to_list (object_get_object "index" tree) in
filter_map (
fun (_, desc) ->
let format = object_get_string "format" desc in
let datatype = object_get_string "datatype" desc in
match format, datatype with
| "products:1.0", "image-downloads" ->
Some (object_get_string "path" desc)
| _ -> None
) index in
let scan_product_list path =
let tree = download_and_parse (uri ^ path) in
let format = object_get_string "format" tree in
if format <> "products:1.0" then
error (f_"%s is not a Simple Streams (products) v1.0 JSON file (format: %s)")
uri format;
let products_node = object_get_object "products" tree in
let products = Array.to_list products_node in
filter_map (
fun (prod, prod_desc) ->
let arch = object_get_string "arch" prod_desc in
let prods = Array.to_list (object_get_object "versions" prod_desc) in
let prods = filter_map (
fun (rel, rel_desc) ->
let pubname = objects_get_string "pubname" [rel_desc; prod_desc] in
let items = object_find_object "items" rel_desc in
let disk_items = object_find_objects (
function
| (("disk.img"|"disk1.img"), v) -> Some v
| _ -> None
) items in
(match disk_items with
| [] -> None
| disk_item :: _ ->
let printable_name = Some pubname in
let file_uri = uri ^ (object_get_string "path" disk_item) in
let checksums =
let checksums = object_find_objects (
function
(* Since this catches all the keys, and not just
* the ones related to checksums, explicitly filter
* the supported checksums.
*)
| ("sha256"|"sha512" as t, Yajl_string c) ->
Some (Checksums.of_string t c)
| _ -> None
) disk_item in
match checksums with
| [] -> None
| x -> Some x in
let revision = Rev_string rel in
let size = object_get_number "size" disk_item in
let aliases = Some [pubname;] in
let entry = { Index.printable_name = printable_name;
osinfo = None;
file_uri = file_uri;
arch = arch;
signature_uri = None;
checksums = checksums;
revision = revision;
format = None;
size = size;
compressed_size = None;
expand = None;
lvexpand = None;
notes = [];
hidden = false;
aliases = aliases;
sigchecker = sigchecker;
proxy = proxy; } in
Some (rel, (prod, entry))
)
) prods in
(* Select the disk image with the bigger version (i.e. usually
* the most recent one. *)
let reverse_revision_compare (rev1, _) (rev2, _) = compare rev2 rev1 in
let prods = List.sort reverse_revision_compare prods in
match prods with
| [] -> None
| (_, entry) :: _ -> Some entry
) products in
let entries = List.flatten (List.map scan_product_list downloads) in
if verbose () then (
printf "simplestreams tree (%s) after parsing:\n" uri;
List.iter (Index.print_entry Pervasives.stdout) entries
);
entries

View File

@@ -0,0 +1,19 @@
(* virt-builder
* Copyright (C) 2015 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.
*)
val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> Index.index

View File

@@ -26,18 +26,17 @@ type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
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 (
@@ -54,39 +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" -> 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
@@ -99,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
@@ -142,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,10 +20,11 @@ type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
proxy : Curl.proxy;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
val read_sources : unit -> source list

View File

@@ -1,5 +1,5 @@
# libguestfs virt-builder tool
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-2017 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
@@ -17,34 +17,29 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
.gitignore \
compress.sh \
test-guest.sh \
validate.sh \
README \
index \
index.asc \
centos.sh \
debian.preseed \
debian.sh \
fedora.sh \
fedora-aarch64.sh \
fedora-armv7l.sh \
fedora-ppc64.sh \
fedora-ppc64le.sh \
rhel.sh \
rhel-ppc64.sh \
rhel-ppc64le.sh \
scientificlinux.sh \
ubuntu.preseed \
ubuntu.sh
index_fragments = $(wildcard *.index-fragment)
CLEANFILES = *~
EXTRA_DIST = \
$(index_fragments) \
*.ks \
debian.preseed \
make-template.ml \
ubuntu.preseed \
validate.sh
# Create the index file under the top level website/ directory.
noinst_DATA = $(top_builddir)/website/download/builder/index
$(top_builddir)/website/download/builder/index: $(index_fragments)
rm -f $@ $@-t
cat *.index-fragment > $@-t
mv $@-t $@
@echo "NOTE: $@.asc must be updated by running:"
@echo " gpg --clearsign --armor $@"
# Validates the index file.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = validate.sh
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
$(MAKE) VG="@VG@" check

View File

@@ -0,0 +1,23 @@
[centos-6]
name=CentOS 6.6
osinfo=centos6.6
arch=x86_64
file=centos-6.xz
revision=6
checksum=fc403ea3555a5608a25ad30ce2514b67288311a7197ddf9fb664475820f26db2bd95a86be9cd6e3f772187b384a02e0965430456dd518d343a80457057bc5441
format=raw
size=6442450944
compressed_size=199265736
expand=/dev/sda3
notes=CentOS 6.6
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.sh
Note that `virt-builder centos-6' will always install the latest
6.x release.

View File

@@ -0,0 +1,19 @@
[centos-7.0]
name=CentOS 7.0
osinfo=centos7.0
arch=x86_64
file=centos-7.0.xz
checksum=cf9ae295f633fbd04e575eeca16f372e933c70c3107c44eb06864760d04354aa94b4f356bfc9a598c138e687304a52e96777e4467e7db1ec0cb5b2d2ec61affc
format=raw
size=6442450944
compressed_size=213203844
expand=/dev/sda3
notes=CentOS 7.0
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.sh

View File

@@ -0,0 +1,19 @@
[centos-7.1]
name=CentOS 7.1
osinfo=centos7.1
arch=x86_64
file=centos-7.1.xz
checksum=4bd2536710daa27a70ff69a96d8a694bde1ecf48d811e75d5e6881cfdcd214c0af6949d5a8252ace06e4e8b33337f65ccb16305c85ff88156d49ac559e840b5c
format=raw
size=6442450944
compressed_size=238579176
expand=/dev/sda3
notes=CentOS 7.1
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.sh

View File

@@ -0,0 +1,19 @@
[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

View File

@@ -0,0 +1,19 @@
[centos-7.2]
name=CentOS 7.2
osinfo=centos7.2
arch=x86_64
file=centos-7.2.xz
checksum=b32e6003d1f15e3a97e3644e35bb3fdc345a9b2e7448655d951ec331af6cd2b5548d6acfc9d92f09ac3a8a6439069c27fa539997118cb8a3f77d3bfa45c659d0
format=raw
size=6442450944
compressed_size=252158848
expand=/dev/sda3
notes=CentOS 7.2
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.sh

View File

@@ -0,0 +1,21 @@
[centos-7.3]
name=CentOS 7.3
osinfo=centos7.3
arch=x86_64
file=centos-7.3.xz
revision=2
checksum[sha512]=07c8941506b1104a2571912060dc275455924415222397316fe28efd5501979c75a23c59b946acad481160b5260f61585c64777a4a9fe6f8365f9fa29df68e6c
format=raw
size=6442450944
compressed_size=294531760
expand=/dev/sda2
lvexpand=/dev/cl/root
notes=CentOS 7.3
This CentOS image contains only unmodified @Core group packages.
This template was generated by a script in the libguestfs source tree:
builder/templates/make-template.ml
Associated files used to prepare this template can be found in the
same directory.

View File

@@ -0,0 +1,28 @@
# Kickstart file for centos-7.3
# Generated by libguestfs.git/builder/templates/make-template.ml
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
selinux --enforcing
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
autopart --type=lvm
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
# EOF

View File

@@ -0,0 +1,19 @@
[cirros-0.3.1]
name=CirrOS 0.3.1
arch=x86_64
file=cirros-0.3.1.xz
checksum=096209f00eb62d5722accf3d22ca3a4ee5baaac6d7d4ce0be93b56bbd1c8ab2e3eb4f5db1deffcb570e2c3d41f4d721798a1c499675346cee9546554a4b10388
format=raw
size=41126400
compressed_size=11419004
expand=/dev/sda1
notes=CirrOS 0.3.1
CirrOS is a commonly used test image, ideal because it is very
small and boots into a minimally usable Linux system.
Note this is not a real Linux distribution, and several virt-builder
features such as installing packages will not (and cannot) work.
This CirrOS image comes from https://launchpad.net/cirros

View File

@@ -0,0 +1,32 @@
[debian-6]
name=Debian 6 (Squeeze)
osinfo=debian6
arch=x86_64
file=debian-6.xz
revision=2
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
format=raw
size=4294967296
compressed_size=139615908
expand=/dev/sda1
notes=Debian 6 (Squeeze).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-6 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"

View File

@@ -0,0 +1,35 @@
[debian-7]
name=Debian 7 (Wheezy) (sparc64)
osinfo=debian7
arch=sparc64
file=debian-7-sparc64.xz
checksum=a81530ec2335d578e54fcf3c62b979a2985faee8e6480a49e7d24269097c89585f39a04b00d99e82aca00f3304c44dfbed843ce6ce5dcd7828256a51219b701f
format=raw
size=4294967296
compressed_size=96292208
expand=/dev/sda3
notes=Debian 7 (Wheezy).
This is a Debian 7 (Wheezy) sparc64 image. This was not built using
a reproducible script, but by installing Debian by hand, so don't use
this in production.
There is also a 'debian' account which you should be aware of and
may need to remove.
To build the image, use:
virt-builder [...] \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,' \
--firstboot-command "dpkg-reconfigure openssh-server"
Resizing the image will not work because virt-builder does not
understand the partition format.
To boot the image:
qemu-system-sparc64 -drive file=debian-7.img,format=raw -serial stdio
Console messages are lost after the bootconsole is disabled, but it
is still booting and will eventually give you a login prompt.

View File

@@ -0,0 +1,32 @@
[debian-7]
name=Debian 7 (Wheezy)
osinfo=debian7
arch=x86_64
file=debian-7.xz
revision=2
checksum=c980a7d878c086b14619b3b9f644ab131c1f88b87729062f2832de12a938ba9e5a511c49402a9d02b740a30876f51889d20e7d0ed4997755f542650b8485f013
format=raw
size=4294967296
compressed_size=150734028
expand=/dev/sda1
notes=Debian 7 (Wheezy).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-7 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"

View File

@@ -0,0 +1,30 @@
[debian-8]
name=Debian 8 (Jessie)
osinfo=debian8
arch=x86_64
file=debian-8.xz
checksum=67700928c435a7a3cd3b611a390ae3f3dfb1b4d882157b6617aa7ea5d693dff3eb4951e5968bdb6859b5f82aa6fe95cc636f053344867d34178ecd5acefe8e91
format=raw
size=4294967296
compressed_size=229866456
expand=/dev/sda1
notes=Debian 8 (Jessie).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"
The serial console is not working in this image. To enable it, do:
--edit '/etc/default/grub:
s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"/' \
--run-command update-grub

View File

@@ -99,7 +99,7 @@ d-i netcfg/wireless_wep string
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.uk.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string @CACHE@
#d-i mirror/http/proxy string
# Suite to install.
#d-i mirror/suite string testing

View File

@@ -0,0 +1,22 @@
[fedora-18]
name=Fedora® 18
osinfo=fedora18
arch=x86_64
file=fedora-18.xz
checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f
format=raw
size=6442450944
compressed_size=148947524
expand=/dev/sda3
notes=Fedora 18.
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/

View File

@@ -0,0 +1,23 @@
[fedora-19]
name=Fedora® 19
osinfo=fedora19
arch=x86_64
file=fedora-19.xz
revision=2
checksum=acecd8d4bca0d6a3f937e0c9386f3185c916df3eaf5f825988c73d41e946a6dc4fda06cdd74a12bc60932edd65846097547b11aca2309a61dd6d0e91ab9d16f3
format=raw
size=6442450944
compressed_size=169531628
expand=/dev/sda3
notes=Fedora 19.
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/

View File

@@ -0,0 +1,23 @@
[fedora-20]
name=Fedora® 20
osinfo=fedora20
arch=x86_64
file=fedora-20.xz
revision=2
checksum=983a1b33c34cb311ea3a283f06312d24dc81041b64ebc90e40ef2fd7587362acd1a5654b13252f9f57001870aa95495065537e730d5225b49389c1a0478cb028
format=raw
size=6442450944
compressed_size=181164220
expand=/dev/sda3
notes=Fedora 20.
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/

View File

@@ -0,0 +1,25 @@
[fedora-21]
name=Fedora® 21 Server (aarch64)
osinfo=fedora21
arch=aarch64
file=fedora-21-aarch64.xz
checksum=57026dd867cbc2e49894dd056ffdc1c397548f4f7e296f393a77ee55343a17f684ddcd3ff7661f514b54209c472f41fce809f2e36064fb66d4f92d8dce5e9b62
format=raw
size=6442450944
compressed_size=186616612
expand=/dev/sda4
notes=Fedora 21 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
Please note you will need to use the associated EFI NVRAM variables:
http://libguestfs.org/download/builder/fedora-21-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/

View File

@@ -0,0 +1,22 @@
[fedora-21]
name=Fedora® 21 Server (armv7l)
osinfo=fedora21
arch=armv7l
file=fedora-21-armv7l.xz
checksum=eb44c66f04781064850380fa1747cadc8645c2f3fd8f2dc1b45cbf5b3f31b91383fa9b7b8b2c951556de2ca499a9251487845208aa1a3881ada6d15e49d24300
format=raw
size=6442450944
compressed_size=199232964
expand=/dev/sda3
notes=Fedora 21 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/

View File

@@ -0,0 +1,23 @@
[fedora-21]
name=Fedora® 21 Server (ppc64)
osinfo=fedora21
arch=ppc64
file=fedora-21-ppc64.xz
revision=3
checksum=acdd9bbd2a434cae48b8f8cf715b00a0cedbb8d276d76a9d4a4f1d469c9522755e82dd03e5f499c1447e09d9bb5a33ada8a061a601d91c007704edfdd80cddb2
format=raw
size=6442450944
compressed_size=233099788
expand=/dev/sda3
notes=Fedora 21 Server (ppc64 big endian)
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-ppc64.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/

View File

@@ -0,0 +1,23 @@
[fedora-21]
name=Fedora® 21 Server (ppc64le)
osinfo=fedora21
arch=ppc64le
file=fedora-21-ppc64le.xz
revision=3
checksum=490aeb5f1bd8754a3c2ed705d3ca84ccec26f839492c6955f40289c4ce9754ad40f22710e24449aeda4177ae16541dc61c989e3c1751f657ffbd4740240c13c4
format=raw
size=6442450944
compressed_size=233706980
expand=/dev/sda3
notes=Fedora 21 Server (ppc64le)
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-ppc64le.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/

View File

@@ -0,0 +1,23 @@
[fedora-21]
name=Fedora® 21 Server
osinfo=fedora21
arch=x86_64
file=fedora-21.xz
revision=1
checksum=4dc92cbf540d3a0745ffe1fa01ffae15f17e7a8aa45c70ad975a1dda82b7f1ebe42f912be74d91a5866a91ee2ca3be3c2be274b5da29db930fe1ec8c2286575b
format=raw
size=6442450944
compressed_size=209059864
expand=/dev/sda3
notes=Fedora 21 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/

View File

@@ -0,0 +1,25 @@
[fedora-22]
name=Fedora® 22 Server (aarch64)
osinfo=fedora22
arch=aarch64
file=fedora-22-aarch64.xz
checksum=a9606947c036d3aade6a0680857adf4bcfb31a62833475466ff4502087cc427926a28d89b684fbe882a65752be263c567b655a988ff5563fee002e2d6f1ccecb
format=raw
size=6442450944
compressed_size=215050068
expand=/dev/sda4
notes=Fedora 22 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
Please note you will need to use the associated EFI NVRAM variables:
http://libguestfs.org/download/builder/fedora-22-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/

View File

@@ -0,0 +1,22 @@
[fedora-22]
name=Fedora® 22 Server (armv7l)
osinfo=fedora22
arch=armv7l
file=fedora-22-armv7l.xz
checksum=8c5c39890409e3fe6f0204834289776bb7a8dca95da2f4d3459a99282f5ed100d7ada1caac2234dd0b357ad4047ef441b128c9ba6256b76df79dee6b5c9e33f8
format=raw
size=6442450944
compressed_size=242234088
expand=/dev/sda3
notes=Fedora 22 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/

View File

@@ -0,0 +1,22 @@
[fedora-22]
name=Fedora® 22 Server (i686)
osinfo=fedora22
arch=i686
file=fedora-22-i686.xz
checksum=3547b94d5c418792e722786cfae41decd41f0725d529d65a2c719094c0b815eaa4fae195514a14d42fa19b57b895bcdbfdb305edf918b1b3722f30f338042d31
format=raw
size=6442450944
compressed_size=225185592
expand=/dev/sda3
notes=Fedora 22 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/

View File

@@ -0,0 +1,22 @@
[fedora-22]
name=Fedora® 22 Server
osinfo=fedora22
arch=x86_64
file=fedora-22.xz
checksum=59f8b32ba363b64ad37a4bd3d17abd049e80691b84ea9b6c4f0485bcc743b6c8dff5bacd4ed838c555487f750edfd132a22421976a0821d82f16811361d4d98d
format=raw
size=6442450944
compressed_size=228011712
expand=/dev/sda3
notes=Fedora 22 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/

View File

@@ -0,0 +1,25 @@
[fedora-23]
name=Fedora® 23 Server (aarch64)
osinfo=fedora23
arch=aarch64
file=fedora-23-aarch64.xz
checksum=aa1359b2a81841ac07e4e25bef9d3ef3b7cf10c171403505cbbd732644fe6c37938cf6c9e3251dae201b659b47033fb792cb29f587fd4d4816b6c0d100dc5be8
format=raw
size=6442450944
compressed_size=216417776
expand=/dev/sda4
notes=Fedora 23 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-23-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/

View File

@@ -0,0 +1,22 @@
[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/

View File

@@ -0,0 +1,23 @@
[fedora-23]
name=Fedora® 23 Server (i686)
osinfo=fedora23
arch=i686
file=fedora-23-i686.xz
revision=2
checksum=4b1badbb92f40ca1b3336e70b2564755d643bc00005fd6364c389a1f3078952968a6887c36c4f79fe3873cf42d41cb36dd226521fee32ed6e08c65d6d059af3c
format=raw
size=6442450944
compressed_size=322831152
expand=/dev/sda3
notes=Fedora 23 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/

View File

@@ -0,0 +1,22 @@
[fedora-23]
name=Fedora® 23 Server (ppc64)
osinfo=fedora23
arch=ppc64
file=fedora-23-ppc64.xz
checksum=99e0c8186b21525d49c0db074fd25bf6631d2fd2cef2ac22f1b1beb6cb492cfc9aed632a2ea091d39d8762fa892b6d2393fecbde7e140236ba4a88d8c54c3152
format=raw
size=6442450944
compressed_size=280692072
expand=/dev/sda3
notes=Fedora 23 Server (ppc64 big endian)
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-ppc64.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/

View File

@@ -0,0 +1,23 @@
[fedora-23]
name=Fedora® 23 Server (ppc64le)
osinfo=fedora23
arch=ppc64le
file=fedora-23-ppc64le.xz
revision=2
checksum=bb6a4cb02a4d7f99f3b8a0f73faa585a4c14e0120a4ace584e0c86062736302bd293072513510378ad30bbdb5fc905077f15ecb8fb5f2ab6ef50b0532af6b8a7
format=raw
size=6442450944
compressed_size=278241384
expand=/dev/sda3
notes=Fedora 23 Server (ppc64le)
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-ppc64le.sh
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/

View File

@@ -0,0 +1,23 @@
[fedora-23]
name=Fedora® 23 Server
osinfo=fedora23
arch=x86_64
file=fedora-23.xz
revision=3
checksum=90cd606923e16e2c01a08eaa360e213cdd49462e259a04cc6efb1d2516215fb4ac3c62811dfd1646d89650f717da030fa6dec693571e027a644eee589accb78d
format=raw
size=6442450944
compressed_size=317209280
expand=/dev/sda3
notes=Fedora 23 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/

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