11283 Commits

Author SHA1 Message Date
Richard W.M. Jones
a7ed7752cf Version 1.41.8. v1.41.8 2019-11-19 16:18:03 +00:00
Richard W.M. Jones
31272305fa po-docs: Remove virt-v2v man pages.
Fixes commit 85c99edec1.
2019-11-19 15:56:03 +00:00
Richard W.M. Jones
43e44477ec po-docs: Split language release notes by release too.
Fixes commit e9eaf4d889.
2019-11-19 15:49:53 +00:00
Sam Eiderman
e6f9e0b0f6 python: Don't call Python functions if Python interpreter has already gone.
If you've registered a callback in Python and the handle is implicitly
closed when the Python interpreter exits, then it can be that the
following happens:

 - Python interpreter is finalized.
 - guestfs_close is called
 - callback is invoked (eg. close event or to display a debug message)
 - Python code runs from the callback wrapper

This cause a segfault on shutdown.  Catch this case and stop the
callback from running (we lose the event but given the above sequence
of events there's not much we can do about it).

See:
https://bugzilla.redhat.com/show_bug.cgi?id=1773520#c7
2019-11-18 15:35:17 +00:00
Sam Eiderman
7757eb8d0c Python: Fix GIL usage in guestfs_int_py_event_callback_wrapper (RHBZ#1773520)
All Py_* functions should be protected by the GIL.
Otherwise internal python data structures can get corrupted.

Move PyGILState_Ensure to the beginning of the block and
PyGILState_Release to the bottom.

Signed-off-by: Sam Eiderman <sameid@google.com>
2019-11-18 15:30:01 +00:00
Richard W.M. Jones
62c36fa297 Update common to latest. 2019-11-16 08:38:51 +00:00
Richard W.M. Jones
bd42180006 Version 1.41.7. 2019-11-13 12:49:55 +00:00
Richard W.M. Jones
85c99edec1 v2v: Remove virt-v2v.
It has moved to a new repository:
https://github.com/libguestfs/virt-v2v
2019-11-13 12:49:55 +00:00
Richard W.M. Jones
ededdce3c1 autogen: Fix detection of gnulib submodule status.
Don't require a rebuild every time the common module changes status.
2019-11-13 12:49:54 +00:00
Richard W.M. Jones
e9eaf4d889 docs: Split release notes by release.
See analogous change in nbdkit for the rationale:

98395d6f7a
2019-11-13 12:49:54 +00:00
Richard W.M. Jones
7c05fc91dc website: Update builder index with fedora-31.
Updates commit 9c693ca0e8.
2019-11-12 12:28:36 +00:00
Richard W.M. Jones
9c693ca0e8 builder: templates: Add Fedora 31. 2019-11-12 09:58:46 +00:00
Richard W.M. Jones
696b1b059a common: Update to latest. 2019-10-16 14:39:31 +01:00
Richard W.M. Jones
8097dc16e7 Version 1.41.6. v1.41.6 2019-10-15 13:34:40 +01:00
Richard W.M. Jones
435b70f564 customize, v2v: Remove existing file before copying.
The generator creates these files with 0444 mode, so they cannot be
overwritten by a simple ‘cp’ command.  We could use ‘cp -f’ or ‘rm -f’.

Fixes commit 15394cb4dd.
2019-10-15 13:34:39 +01:00
Richard W.M. Jones
8f3210c875 Replace common/ with git submodule.
This directory contains code which is shared between libguestfs and
the tools.  It now points to a new repository:

https://github.com/libguestfs/libguestfs-common
2019-10-15 13:34:39 +01:00
Richard W.M. Jones
15394cb4dd common/{mlcustomize,mlv2v}: Add generated files to git.
With the proposed split we will only run the generator from the
libguestfs repo.  When compiling virt-v2v or the guestfs-tools we will
need certain generated files to be present already in the
libguestfs-common repo, and therefore these files must be added to
git.  Hopefully they won't change very often.
2019-10-14 19:38:36 +01:00
Richard W.M. Jones
20c2dfbe00 generator, customize, v2v: Only place generated files in libguestfs or common.
After the proposed split of the libguestfs repo, we will end up with
the following layout:

  libguestfs.git
      common -> git submodule libguestfs-common.git
      generator

  virt-v2v.git
      common -> git submodule libguestfs-common.git

  guestfs-tools.git
      common -> git submodule libguestfs-common.git

The generator will only be able to write to libguestfs directories and
the common directory/submodule.  This is mostly the case already with
only 6 exceptions:

  customize/customize-options.pod
  customize/customize-synopsis.pod
  customize/customize_cmdline.ml
  customize/customize_cmdline.mli
  v2v/uefi.ml
  v2v/uefi.mli

This commit moves these files around so they appear under common/ml*

It is somewhat unsatisfactory because it involves copying files
around, but there are some mitigating factors:

(1) Any changes now give us more freedom to develop faster and thus
clean things up in future.

(2) The v2v/uefi files ought to go away in future anyway.

This is simple code motion and should have no effect on the built
programs or tests.
2019-10-14 18:37:29 +01:00
Richard W.M. Jones
a07b9a2cda v2v: virt-v2v doesn't need to link directly with -lutils.
It is linked indirectly via mlcutils.cmxa.
2019-10-14 15:28:28 +01:00
Richard W.M. Jones
ddfec6a97d customize: Move Firstboot and SELinux_relabel modules to common/mlcustomize.
These two modules are a dependency of virt-v2v.  Since we intend to
split virt-v2v from the other OCaml virt-* programs, we cannot have a
dependency between virt-v2v and virt-customize.  Instead we must move
the modules to a common directory (common/mlcustomize) and have both
tools depending on the modules from there.

This is simple refactoring and should not affect how the programs work
or are tested.
2019-10-14 12:36:47 +01:00
Richard W.M. Jones
a1c036b4a6 .gitignore: Ignore website/download/builder/*.xz.
This makes it easier to run the slow tests by copying the virt-builder
templates into this directory.
2019-10-14 12:36:47 +01:00
Richard W.M. Jones
b85dd3dee1 v2v: Split out source and source_disks.
Remove the source.s_disks field and keep it as a separate list.

This is just refactoring.  For more about the purpose of this change:
https://www.redhat.com/archives/libguestfs/2019-October/msg00072.html
2019-10-11 16:29:57 +01:00
Richard W.M. Jones
e3a3c2fd6c v2v: Remove 4 unused parameters to output#prepare_targets.
Not used by any existing output mode, remove the parameters.
2019-10-11 16:12:41 +01:00
Richard W.M. Jones
50a4a41ef3 v2v: Don't pass full metadata to output#prepare_targets.
The existing output objects only used the s_name field so pass that
instead.  (There was one minor exception: -o libvirt adjusted an error
message based on the hypervisor field but that was simply to fix.)
2019-10-11 16:03:33 +01:00
Richard W.M. Jones
624fff6461 v2v: Pass source.s_disks to conversion fn instead of whole metadata.
Existing conversions do not use anything except the source disks, so
only pass this.

This also renames src_disks -> source_disks in a few places for
consistency.

Pure refactoring with no change in function, designed to reduce
coupling between stages.
2019-10-11 15:57:47 +01:00
Richard W.M. Jones
ee400894f9 virt-tools: Remove -Ifish from various tools.
Appears to be a copy and paste error.  At least, I cannot understand
why any of these tools would borrow source code from guestfish.
2019-10-11 15:33:51 +01:00
Tomáš Golembiovský
00b4ed312b v2v: windows: install QEMU Guest Agent MSI
Use firstboot script to install MSI with QEMU-GA from virtio-win ISO or
oVirt/RHV guest tools ISO.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-10-10 17:14:51 +01:00
Richard W.M. Jones
2299154dc8 Version 1.41.5. v1.41.5 2019-10-09 19:15:07 +01:00
Richard W.M. Jones
dfd9fac743 v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
For Linux the guest itself remembers the IP address associated with
each MAC address.  Thus it doesn't matter if the interface type
changes (ie. to virtio-net), because as long as we preserve the MAC
address the guest will use the same IP address or the same DHCP
configuration.

However on Windows this association is not maintained by MAC address.
In fact the MAC address isn't saved anywhere in the guest registry.
(It seems instead this is likely done through PCI device type and
address which we don't record at the moment and is almost impossible
to preserve.)  When a guest which doesn't use DHCP is migrated, the
guest sees the brand new virtio-net devices and doesn't know what to
do with them, and meanwhile the right static IPs are still associated
with the old and now-defunct interfaces in the registry.

We cannot collect the required information from within the guest.
However we can collect it outside the tool by some other means
(eg. using VMware Tools APIs) and present this information to virt-v2v
which then writes it into the Windows guest at firstboot time.

This commit adds the --mac ..:ip:.. sub-option which creates a
Powershell script to set network adapters at firstboot.  An option
such as:

  --mac 00:0c:29:e6:3d:9d:ip:192.168.0.89,192.168.0.1,24,192.168.0.254

approximately turns into this script:

  # Wait for the netkvm (virtio-net) driver to become active.
  $adapters = @()
  While (-Not $adapters) {
      Start-Sleep -Seconds 5
      $adapters = Get-NetAdapter -Physical |
                     Where DriverFileName -eq "netkvm.sys"
  }
  $mac_address = '00-0c-29-e6-3d-9d'
  $ifindex = (Get-NetAdapter -Physical |
                 Where MacAddress -eq $mac_address).ifIndex
  if ($ifindex) {
      New-NetIPAddress -InterfaceIndex $ifindex
                       -IPAddress '192.168.0.89'
                       -DefaultGateway '192.168.0.1'
                       -PrefixLength 24
      Set-DnsClientServerAddress -InterfaceIndex $ifindex
                       -ServerAddresses ('192.168.0.254')
  }

Thanks: Brett Thurber for diagnosing the problem and suggesting paths
towards a fix.
2019-10-08 13:32:34 +01:00
Richard W.M. Jones
e1e9b3845e v2v: windows: Add a helper function for installing Powershell firstboot scripts. 2019-10-08 13:30:05 +01:00
Richard W.M. Jones
d4840bd29f Update website/download/builder/index.
Fixes commit a3320aaa50.
2019-10-08 13:29:23 +01:00
Richard W.M. Jones
12f5e2eb90 v2v: nbdkit: Add the retry filter unconditionally if it exists.
This experimental filter can be used to work around brief
interruptions in service, such as the network going down, firewalls
timing out connections etc., without requiring virt-v2v to be rerun.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
4ad6e184a9 v2v: Implement SSH password authentication for Xen and VMX over SSH.
For example:
$ virt-v2v -i vmx -it ssh -ip /tmp/passwd \
    'ssh://root@esxi/vmfs/volumes/datastore1/Windows/Windows.vmx' -o null
2019-10-08 13:15:10 +01:00
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