Commit Graph

11300 Commits

Author SHA1 Message Date
Richard W.M. Jones
735529b393 v2v: Implement the --bandwidth* options to control network bandwidth.
For input methods which use nbdkit, we can cheaply add
nbdkit-rate-filter to control input-side network bandwidth.  These
options control that filter.  We can choose to set the bandwidth
statically and optionally change it dynamically:

  --bandwidth 10M
    # static bandwidth of 10 Mbps, no dynamic adjustment possible

  --bandwidth 5M --bandwidth-file /tmp/bw
    # initial static bandwidth of 5 Mbps, adjustable by writing to /tmp/bw

  --bandwidth-file /tmp/bw
    # no initial bandwidth cap, can be added later by writing to /tmp/bw

It only makes sense to control the input side since virt-v2v writes a
lot less data than it reads.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0aa3545e4d v2v: vCenter: Replace qemu block curl driver with nbdkit-curl-plugin.
Because of the self-configuring readahead plugin we can entirely get
rid of input#adjust_overlay_parameters, which is definitely a good
thing.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
bded1ee837 v2v: -i libvirtxml: Replace qemu block curl driver with nbdkit-curl-plugin.
‘virt-v2v -i libvirtxml’ has a little-known feature where it can read
network disks over HTTP or HTTPS.  This can be used to test VMware
conversions without needing VMware, although as far as I can tell the
current test suite does not use the feature.  This commit changes this
functionality to use nbdkit-curl-plugin instead of the qemu curl
driver.

This change shouldn't affect functionality.  The readahead size is
changed from a fixed 1M buffer to using the readahead filter which is
self-configuring.

See also commit 38bf2a0f97 which
originally introduced this functionality in 2017.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
d481598067 v2v: nbdkit: Add the readahead filter unconditionally if it is available.
The readahead filter is a self-configuring filter that makes
sequential reads faster when the plugin is slow (and all of the
plugins we use here are always slow).

I observed the behaviour of the readahead filter with our qcow2
overlay when converting a guest from a vCenter source.  Even when
doing random reads, qemu issues 64K reads which happen to also be the
minimum request size of the readahead filter, so there is no extra
overhead.  When doing the sequential copy the readahead filter
performed better than qemu curl’s readahead because it scaled the
prefetched data appropriately on long contiguous stretches and then
shrunk it back to 64K around fragmented parts of the base image.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0796092e05 v2v: nbdkit: Add a generic function to probe if filters are available.
This uses the technique described in the nbdkit-probing(1) man page.
It should work with a wide range of versions of nbdkit, and is the one
which the nbdkit developers currently recommend.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
56727f8431 v2v: nbdkit: Add support for nbdkit-curl-plugin. 2019-10-08 13:15:10 +01:00
Richard W.M. Jones
57f6c72a9d v2v: -i vmx -it ssh: Replace qemu block ssh driver with nbdkit-ssh-plugin.
One immediately advantage is we can use libvirt again.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0977f4b909 v2v: xen: Replace qemu block ssh driver with nbdkit-ssh-plugin.
Initially this is a like-for-like replacement, but in future commits
this will allow us to implement:

 - password authentication (instead of SSH agent)

 - bandwidth throttling

 - readahead

Note this requires nbdkit >= 1.12.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
8e5930b9a8 v2v: nbdkit: Add support for nbdkit-ssh-plugin. 2019-10-08 13:15:10 +01:00
Richard W.M. Jones
ca9f904b22 v2v: Generic code for querying nbdkit version and plugin.
In forthcoming commits we will be adding support for ssh, curl and
other features that require nbdkit >= 1.12.

As a prelude to that work, add generic code for querying ‘nbdkit
--dump-config’ and ‘nbdkit plugin --dump-plugin’ and checking the
minimum version number.

This changes the minimum version from 1.1.16 to 1.2, although that was
released about a year ago and is widely available, and in any case
we're going to require 1.12 in the next commit.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0899f876a1 v2v: Factor out the nbdkit VDDK code into a new module.
This refactoring takes the nbdkit-specific code from the ‘-it vddk’
mode and puts it into a separate module.  The idea is to reuse this
module (in future commits) to support ssh, curl and rate limiting.

This refactoring is not quite neutral because it moves some of the
prechecking into the Nbdkit.create function.  This means it will
happen a little bit later in the cycle (in input#source instead of
input#precheck - refer to the diagram in v2v/types.mli).  However it's
still almost in the same place and importantly still happens before we
start copying.
2019-10-08 13:15:10 +01:00
Tomáš Golembiovský
644a6e4637 build: define CGO_CFLAGS_ALLOW with -U option we need
cgo does not allow arbitrary CFLAGS to be used. Instead it contains a
list of flags (safelist) that are allowed to be passed to the compiler.
Sadly -U option (introduced in commit d8d8c856a1) is not among them.

See: https://github.com/golang/go/issues/23672

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-10-07 22:08:49 +01:00
Richard W.M. Jones
a3320aaa50 builder: templates: Add CentOS 8.0 2019-10-04 09:01:32 +01:00
Richard W.M. Jones
f7733f44c3 builder: templates: Work around for CentOS 8.0 kickstart brokenness. 2019-10-04 09:01:05 +01:00
Richard W.M. Jones
0177552375 daemon: btrfs: Fix parsing for new output from btrfs scrub.
The format changed at some point breaking our existing parsing code.
Typical example of the new format is below.

UUID:             b8604449-c7b5-4d3b-9fad-56114e8594f5
Scrub started:    Wed Oct  2 12:54:06 2019
Status:           finished
Duration:         0:00:00
\tdata_extents_scrubbed: 0
\ttree_extents_scrubbed: 16
\tdata_bytes_scrubbed: 0
\ttree_bytes_scrubbed: 262144
\tread_errors: 0
\tcsum_errors: 0
\tverify_errors: 0
\tno_csum: 0
\tcsum_discards: 0
\tsuper_errors: 0
\tmalloc_errors: 0
\tuncorrectable_errors: 0
\tunverified_errors: 0
\tcorrected_errors: 0
\tlast_physical: 253493248
2019-10-02 14:29:35 +01:00
Richard W.M. Jones
9f516b4fcc builder: templates: Increase RAM for installation to 4G on all architectures.
We thought this could solve the CentOS problem, but it did not.
However it's probably a useful change anyway.
2019-10-02 10:23:31 +01:00
Richard W.M. Jones
b8372310cc builder: templates: Add support for centos-8.0.
Unfortunately I could not get the install to work yet:
https://lists.centos.org/pipermail/centos-devel/2019-September/017813.html
2019-10-02 10:23:31 +01:00
Pino Toscano
0a5eaad7db v2v: -o rhv-upload: make -oo rhv-cafile optional
It makes little sense to require the oVirt certificate, especially when
the verification of the connection (-oo rhv-verifypeer) is disabled by
default.  The only work done with the certificate in that case is
checking that it is a valid certificate file.

Hence, make -oo rhv-cafile optional, requiring it only when
-oo rhv-verifypeer is enabled.
2019-09-27 13:56:42 +02:00
Pino Toscano
02890096d5 builder: templates: set "unassigned" hostname
By default the installer will set the hostname to what the DHCP returns,
exposing details of the machine where make-template.ml runs.

Instead, force "unassigned-hostname.unassigned-domain" as hostname, so
plays nicely with the hostname setting code in virt-customize.
2019-09-26 13:32:50 +02:00
Richard W.M. Jones
aee0f3b011 website: Update index file. 2019-09-20 10:34:45 +01:00
Richard W.M. Jones
7050f4a6a6 erlang: Avoid deprecation warnings.
According to the Erlang website:

  The old legacy erl_interface library (functions with prefix erl_) is
  deprecated as of OTP 22, and will be removed in OTP 23. This does
  not apply to the ei library. Reasonably new gcc compilers will issue
  deprecation warnings. In order to disable these warnings, define the
  macro EI_NO_DEPR_WARN.

That's a shame and probably means we will have to drop the Erlang
bindings soon unless someone ports them to this new API (stable APIs
FTW people!).  In the meantime add the flag to prevent warn-errors
about deprecation.
2019-09-20 10:34:45 +01:00
Pino Toscano
29dc045bc6 v2v: -o rhv-upload: use same tmpdir for Python scripts
Make use of the temporary directory of the rhv-upload mode also for the
Python scripts that the mode creates, instead of creating new
directories.
2019-09-20 11:14:07 +02:00
Pino Toscano
b659d044f7 v2v: add optional tmpdir parameter for Python_script
Add an optional parameter for Python_script.create, to specific the
temporary directory to use instead of creating a new one.
2019-09-20 11:11:38 +02:00
Pino Toscano
977fac2012 v2v: linux: do not install qemu-guest-agent if already installed
In case qemu-guest-agent is already installed in the guest, then do not
attempt to install it again.

Reported by Martin Kletzander.
2019-09-20 11:11:38 +02:00
Pino Toscano
1311842a64 v2v: linux: install linux tools after unconfigurations
Install the new tools after removing the old hypervisor tools.

It should not change the result of the conversion.
2019-09-20 11:11:38 +02:00
Pino Toscano
537ba8357e v2v: -o rhv-upload: add -oo rhv-disk-uuid option
This way it is possible to override the UUIDs of the uploaded disks,
instead of letting RHV generate them.

This can be useful to force certain UUIDs, and to specify the disks in
--no-copy mode (which now can be used).
2019-09-20 11:11:38 +02:00
Pino Toscano
0a9d7efb40 v2v: -o rhv-upload: check for a valid image transfer right away
Check for the INITIALIZING state of the image transfer right away,
without waiting 5 seconds even before the first time: this way, if the
transfer is already in the right state then there is no need to wait.
2019-09-20 11:11:38 +02:00
Pino Toscano
0f3686e9ed v2v: -o rhv-upload: cancel disk transfer on open failure
Make sure to cancel the trasfer in RHV in case of failure during the
open/creation of the disk in RHV, so it is automatically removed.
2019-09-20 11:11:38 +02:00
Martin Kletzander
da71714a9a build: Move po subdir after everything else except po-docs
Otherwise it complains about missing files that it has no rules for, for example
`builder/index-parser.c`.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-09-20 10:01:16 +01:00
Pino Toscano
27690f55ff v2v: -o rhv-upload: adapt phony ovirtsdk4 module to recent changes
Add the missing objects, methods, variables, and relations among the
various objects.

Followup/fixes commit c49aa4fe01, and
commit 8118f28b6f.
2019-09-19 12:27:23 +02:00
Richard W.M. Jones
bbf4aeaf2b builder: templates: Add centos-7.7. 2019-09-18 10:52:12 +01:00
Richard W.M. Jones
cece35e114 builder: templates: Add rhel-7.7 kickstart and virt-install command. 2019-09-18 10:52:12 +01:00
Pino Toscano
8118f28b6f v2v: -o rhv-upload: cancel disk transfer on failure
Make sure to cancel the trasfer in RHV in case of failure during the
copying of a disk: this way, the disk can be actually removed by RHV
itself.
2019-09-17 15:04:36 +02:00
Pino Toscano
145ae3db04 v2v: -o rhv-upload: remove uploaded disks on failure
In case the whole conversion fails, run a new Python script to cleanup
all the uploaded (and finalized) disks.
2019-09-17 15:04:36 +02:00
Pino Toscano
7b93ad6a32 v2v: -o rhv-upload: collect disks UUIDs right after copy
Instead of waiting for the completion of the nbdkit transfers to get the
UUIDs of the disks, use the new #disk_copied hook to do that after each
disk is copied.

This has almost no behaviour on rhv-upload, except for the --no-copy
mode:
- previously it used to hit the 5 minute timeout while waiting for the
  finalization of the first disk
- now it asserts on the different number of collected UUIDs vs the
  actual targets; at the moment there is nothing else that can be done,
  as this assumption is needed e.g. when creating the OVF file
2019-09-17 15:04:36 +02:00
Pino Toscano
74ee936505 v2v: add output#disk_copied hook
Add a simple method in the Output class to do work right after a disk
was successfully copied.
2019-09-17 15:04:36 +02:00
Pino Toscano
2b39c27b7f v2v: -o rhv-upload: tell whether a SD actually exists
If there is no DC with the specified storage domain attached to it, it
can mean that the SD does not exist.
2019-09-17 15:04:36 +02:00
Pino Toscano
c49aa4fe01 v2v: -o rhv-upload: improve lookup of specified resources (RHBZ#1612653)
Improve the way the precheck script checks for the specified resources:
- look directly for a data center with the specified storage domain
- get the storage domain object from the storage domains attached to the
  data center found
- similarly, look for the specified cluster among the ones attached to
  the data center found
When everything is found, return the UUID of the storage domain, and of
the cluster back to virt-v2v, which will store them.

Similarly, rework the createvm script to directly get the requested
cluster, instead of looking for it once again.  Also, since the UUID of
the storage domain is available in virt-v2v already, use it directly
instead of using a placeholder.

This should fix a number of issues:
- unexisting/unattached storage domains are rejected outright
- the cluster is rejected if not part of the same data center of the
  selected storage domain
- renaming the specified storage domain during the data copying will not
  cause the conversion to fail (which will still use the specified
  storage domain, no matter the new name)

Based on the hints by Daniel Erez in RHBZ#1612653.
2019-09-17 15:04:21 +02:00
Pino Toscano
cc6e2a7f9e v2v: -o rhv-upload: change precheck script to return a JSON
This way it is possible to communicate data from the precheck script
back to virt-v2v.

For now there are no results, so the resulting JSON is discarded.
2019-09-17 14:04:47 +02:00
Pino Toscano
6499fdc199 v2v: -o rhv-upload: split vmcheck out of precheck
Split the VM existance check out of the precheck script to a new vmcheck
script, and invoke that in #prepare_targets.  Invoke the precheck script
in #precheck, as now it can be run with only values of command line
options.

This does not change which checks are performed; however, an invalid
cluster name will make virt-v2v fail way earlier (even before connecting
to the source).
2019-09-17 14:03:13 +02:00
Pino Toscano
dea9636c59 Remove remaining virt-p2v bits
Remove (almost) all the remaining bits related to virt-p2v.
2019-09-10 17:52:16 +02:00
Pino Toscano
2c02adb8ba Remove virt-p2v
This removes only the tool itself, and all the bits strictly needed to
not break the build.

This is now available as separate tool in its own repository:
https://github.com/libguestfs/virt-p2v
2019-09-10 17:52:16 +02:00
Eric Blake
730642676b drives: Typo fix
Favor 'atomically' over 'atomicly'.

Signed-off-by: Eric Blake <eblake@redhat.com>
2019-09-10 16:40:17 +01:00
Daniel Erez
eeabb3fdc7 v2v: rhv-upload-plugin - improve wait logic after finalize (RHBZ#1680361)
After invoking transfer_service.finalize, check operation status by
examining DiskStatus.  This is done instead of failing after a
predefined timeout regardless the status.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1680361
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Ilanit Stein <istein@redhat.com>
2019-09-09 17:04:18 +01:00
Chris Lamb
d58c4e79d8 Make the build reproducible
Whilst working on the Reproducible Builds effort [0] we noticed
that libnbd could not be built reproducibly.

This is due to it shipping a pod generation wrapper that
does not use/respect SOURCE_DATE_EPOCH [1] and additionally
varies the output depending on the build user's current
timezone.

(This was originally filed in Debian as #939546 [2].)

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/docs/source-date-epoch/
 [2] https://bugs.debian.org/939546

Signed-off-by: Chris Lamb <lamby@debian.org>
2019-09-06 09:42:35 +01:00
Richard W.M. Jones
a0f9553d21 html: Link within all libguestfs projects. 2019-09-05 15:11:40 +01:00
Richard W.M. Jones
74ce7332db ocaml: Change calls to caml_named_value() to cope with const value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.

Based on Pino Toscano's original patch to ocaml-augeas.
2019-09-05 09:00:14 +01:00
Nir Soffer
fcfdbc9420 v2v: Set DISKTYPE=2 in RHV and VDSM meta files (RHBZ#1746699).
Added in virt-p2v commit:

  commit e83b6f50af34ce650063ecc520bfabab400e8e73
  Author: Matthew Booth <mbooth@redhat.com>
  Date:   Fri Mar 26 09:40:20 2010 +0000

    Add export to RHEV

    Allow guests to be written to a RHEV NFS export storage domain.

    Add 'rhev' output method and -osd command-line option.
    Example command line:

     virt-v2v -f virt-v2v.conf -ic 'esx://yellow.rhev.marston/' \
              -o rhev -osd blue:/export/export RHEL3-32

    This will connect to an ESX server and write the guest 'RHEL3-32' to
    blue:/export/export, which is a pre-initialised RHEV export storage domain.
2019-09-02 21:20:27 +01:00
Richard W.M. Jones
bf5ee2fb21 Version 1.41.4. v1.41.4 2019-09-02 19:45:12 +01:00
Richard W.M. Jones
bbe4490795 rust: Don't add Cargo.lock to EXTRA_DIST.
It's a file generated by cargo.  If cargo is not installed then this
breaks ‘make dist’.
2019-09-02 19:28:30 +01:00