Commit Graph

9877 Commits

Author SHA1 Message Date
Richard W.M. Jones
5b48a8d59d customize, v2v: Use %systemroot% and CurrentControlSet from inspection.
For reasons unknown virt-v2v recomputed the CurrentControlSet from
first principles, and passed %systemroot% around to all functions.
However that data is available from the libguestfs inspection APIs.
2017-02-21 12:08:45 +00:00
Richard W.M. Jones
441db174f5 customize: firstboot: Use Registry.with_hive_write instead of open coding. 2017-02-21 12:08:45 +00:00
Richard W.M. Jones
ca5e7233df mllib: Move Windows Registry functions from v2v to common code.
Move the functions decode_utf16le, encode_utf16le, get_node,
with_hive_readonly and with_hive_write to common code in a new module
called Registry.

This also defines types for nodes and values, instead of using int64
directly.

Just code motion.
2017-02-21 12:08:45 +00:00
Richard W.M. Jones
2643c4d5f4 tail: Fix mistake in the man page (RHBZ#1425306).
Thanks: Xianghua Chen
2017-02-21 12:06:44 +00:00
Richard W.M. Jones
08e7506aba p2v: Fix slow test to pass LIBGUESTFS_PATH & LIBGUESTFS_CACHEDIR to virt-v2v.
Adding a new optional parameter to hivex_open in
commit 1f99251223 reveals a subtle bug
in the virt-p2v slow test.

Because we didn't pass LIBGUESTFS_PATH through to the instance of
virt-v2v, it was running with the new binary and library code, but
with the installed appliance (or would have failed if libguestfs
wasn't installed on the host when running the test).  In particular
this bug was revealed when the new virt-v2v binary passed the
GUESTFS_HIVEX_OPEN_UNSAFE flag to the guestfs_hivex_open call, which
the (old, installed) daemon did not recognize and rejected with an
error.

For the same reason we also have to pass in LIBGUESTFS_CACHEDIR to
make sure that supermin doesn't reuse the cached appliance from
/var/tmp.
2017-02-20 20:16:49 +00:00
Richard W.M. Jones
3feb957c8a 9p: Update test for virtio-pci on aarch64.
Fixes commit 4a9af91e36.
2017-02-20 12:06:14 +00:00
Pino Toscano
911317dc66 dib: small documentation improvements
Improve the grammar, and the wording, and make few details explicit.
No change in the actual content.
2017-02-17 16:06:09 +01:00
Pino Toscano
654eb25407 dib: preserve xattrs and SELinux attributes when exporting as tar
When extracting the content of the guest as tar, save also the extended
attributes and the SELinux attributes.  This makes sure guests exported
as tar, tgz, and as docker image will work fine afterwards.

This is what disk-image-create does as well.
2017-02-17 16:06:09 +01:00
Richard W.M. Jones
8ee7da48c5 lib, tools, v2v: Use unsafe flag when reading (but NOT writing) hives.
Pass the HIVEX_OPEN_UNSAFE flag when opening hives for reading.
Do NOT pass it when opening hives for writing.

This should make inspection, virt-win-reg and virt-v2v more tolerant
about handling Windows Registry corruption, without increasing the
risk of causing new corruption in hives.
2017-02-17 14:51:15 +00:00
Richard W.M. Jones
1f99251223 hivex: Map new HIVEX_OPEN_UNSAFE flag into the API.
In hivex >= 1.3.14, there is a new HIVEX_OPEN_UNSAFE flag allowing
heuristics to be used to deal with corrupted hives.  Map this flag
into the libguestfs API.

If the flag is not supported (because libguestfs was compiled with
hivex < 1.3.14) then the flag is ignored.  This is safe behaviour:
opening corrupted hives will give an error, as happened previously.
2017-02-17 10:15:09 +00:00
Richard W.M. Jones
ad3c8fe7f4 v2v: Document conversion failure with RHEL 6.2 (RHBZ#1374232). 2017-02-16 14:06:18 +00:00
Richard W.M. Jones
7bc618c89d Version 1.35.25. v1.35.25 2017-02-15 15:37:23 +00:00
Richard W.M. Jones
462cc4a502 docs/C_SOURCE_FILES, po/POTFILES, po/POTFILES-ml: Update these files. 2017-02-15 15:37:21 +00:00
Richard W.M. Jones
e46b07ca1b docs/C_SOURCE_FILES, po/POTFILES: Remove duplicate files.
Because v2v/test-harness is a subdirectory of v2v, and because both
paths are listed in $(DIST_SUBDIRS), using find $(DIST_SUBDIRS) will
list files in v2v/test-harness twice.  (This probably happens in other
directories too, but I noticed it here.)  The easiest fix for this is
simply to use 'sort -u' to remove the duplicates.
2017-02-15 15:05:47 +00:00
Richard W.M. Jones
6dcfd85623 Update gnulib to latest. 2017-02-15 15:05:47 +00:00
Pino Toscano
3c0bd14852 dib: add squashfs output format
Implement the "squash" output format, i.e. a squashfs compressed
filesystem.

This was implemented in diskimage-builder upstream as
commit 9d13084c4183b63587e1f5e4b03395a8df6538f6.
2017-02-15 14:44:13 +01:00
Pino Toscano
7a3854001e New API: mksquashfs
Introduce a new API to create a new squashfs filesystem out of a path
in the guest.  It can be configured to exclude paths based on patterns,
and to select which compression use for the filesystem.

The advantage of running mksquashfs directly in the appliance is that
ownerships are properly saved, as opposed to tar_out + local untar.
2017-02-15 14:44:13 +01:00
Pino Toscano
35d97daa5a daemon: move make_exclude_from_file as common helper
It will be useful also for APIs different than tar-out, so move it to
guestfsd.c, and add it a parameter to specify the function name that
invoked it.

This is mostly code motion.
2017-02-15 14:44:12 +01:00
Pino Toscano
468d335fdf dib: add appliance check hook in Output_format
Add a new hook for Output_format's to check for prerequisites on the
appliance (which can be done only when the appliance is run).
2017-02-15 11:08:01 +01:00
Pino Toscano
c8236b2f1c dib: cleanup logs at end of build
Recently, diskimage-builder moved the log cleanup from the 'base'
element to disk-image-create proper; the cleanup done is:
- truncate any file in /var/log
- remove *.log files in /root

This was implemented in diskimage-builder upstream as
commit 022d93ee822e71245af52c4cf8f8a8e82f599af3.
2017-02-15 11:08:01 +01:00
Pino Toscano
8ee51ee396 dib: re-read list of scripts when running in-chroot hooks
Scripts (especially root.d and extra-data.d) may add new scripts to the
existing set during their execution: in this case, re-read the list of
available scripts, so we do not miss any new addition.
2017-02-15 11:08:00 +01:00
Pino Toscano
551eb2072f dib: change hooks path when running extra-data.d scripts
It looks like scripts (in particular in the extra-data.d phase) may
in-flight add new scripts to the existing ones.  As first step to
handle this situation, change the path of hooks passed for extra-data.d
scripts: instead of the local temporary directory, use the in-guest
location that is visible as result of the local fuse-based mount of the
guest.
2017-02-15 11:08:00 +01:00
Pino Toscano
dfc700d2b5 dib: source dib "die" script in some phases
Source the "die" script, part of the diskimage-builder library, when
running hooks that run outside the guest chroot.  This is what
disk-image-create does, and scripts expect to use the "die" function
without sourcing the "die" script containing it.
2017-02-15 11:08:00 +01:00
Pino Toscano
0ab539d82f dib: fix listing envvars in fake-sudo
Query awk for the list of environment variables, instead of trying to
extract the list from the output of `env`: the old approach breaks when
any of the environment variable contains more than one line.
2017-02-15 11:08:00 +01:00
Richard W.M. Jones
a75076f271 GCC 7: Allocate sufficient space for sprintf output.
GCC 7.0.1 can determine if there is likely to be sufficient space in
the output buffer when using sprintf/snprintf, based on the format
string.

The errors were all either of this form:

bindtests.c:717:29: error: '%zu' directive output may be truncated writing between 1 and 19 bytes into a region of size 16 [-Werror=format-truncation=]
     snprintf (strs[i], 16, "%zu", i);
                             ^~~
bindtests.c:717:28: note: directive argument in the range [0, 2305843009213693951]
     snprintf (strs[i], 16, "%zu", i);
                             ^~~~~

or this form:

sync.c: In function 'fsync_devices':
sync.c:108:50: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 251 [-Werror=format-truncation=]
       snprintf (dev_path, sizeof dev_path, "/dev/%s", d->d_name);
                                                  ^~

Fixed by converting these into dynamic allocation, or making the
output buffer larger, whichever was easier.

There is a gnulib macro we can use to make this simpler for integers.
It requires a new gnulib module (intprops), but it turns out that we
were already pulling that in through dependencies, so the change to
bootstrap is a no-op.  (thanks: Dan Berrange)
2017-02-14 17:53:28 +00:00
Richard W.M. Jones
0b3a5a0b00 GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.
This happens with GCC 7.0.1.  The errors were all of the form:

qemu-speed-test.c: In function 'main':
qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
       usage (EXIT_SUCCESS);
       ^~~~~~~~~~~~~~~~~~~~
qemu-speed-test.c:155:5: note: here
     default:
     ^~~~~~~
2017-02-14 15:25:25 +00:00
Cédric Bosdonnat
39daa04181 mllib: add Xml.parse_file helper
Provide a helper function rather than having callers read the
file and then parse the string.
2017-02-14 15:25:25 +00:00
Cédric Bosdonnat
2fe2e17f7d Move xml and xpath_helpers OCAML code to mllib
To allow other pieces of code to process XML files easily, move the
xml.ml* and xpath_helpers.ml* from v2v to mllib.
2017-02-14 15:25:25 +00:00
Cédric Bosdonnat
c45ce1a7bb mllib: factorize code to add Checksum.get_checksum function
Getting checksum involves the same code than verifying them. Create
a get_checksum function and use it in verify_checksum.
2017-02-14 14:33:11 +00:00
Richard W.M. Jones
1230543f71 fish: Link to libtinfo (RHBZ#1417549).
Fixes commit a8c5739fd2.

Reported by: Jean-Christophe Manciot
2017-02-14 13:18:57 +01:00
Richard W.M. Jones
23c2351e36 Version 1.35.24. v1.35.24 2017-02-11 09:15:25 +00:00
Richard W.M. Jones
53317e3f07 test-data: Use qemu-img instead of guestfish to create blank disks.
Since this step runs during make (not make check), guestfish
hasn't been built yet.

Fixes commit fa83b47876
and commit 74ded0dbc1.
2017-02-11 09:07:09 +00:00
Richard W.M. Jones
e9deb6fab4 Version 1.35.23. v1.35.23 2017-02-10 22:54:04 +00:00
Richard W.M. Jones
fa83b47876 test-data: Use ./run script to run 'guestfish disk-create'.
Commit 74ded0dbc1 changes existing calls
to truncate to run 'guestfisk disk-create' instead.  However this
fails if guestfish has not been installed.  By using the ./run script,
we can use the just-built guestfish instead.

Fixes commit 74ded0dbc1.
2017-02-10 22:41:55 +00:00
Richard W.M. Jones
74660366f6 Version 1.35.22. v1.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