Commit Graph

9819 Commits

Author SHA1 Message Date
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. v1.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