16 Commits

Author SHA1 Message Date
Richard W.M. Jones
f720aff7d6 v2v: Don't include virt-customize --inject* options
Commit ade62ebdb5 ("v2v: Add support for virt-customize options")
included --inject* options that covered facilities for injecting QEMU
guest agent etc which are already part of virt-v2v.  We shouldn't add
the options for that.

The generator in libguestfs was changed so we can now exclude those
options from virt-v2v.

Update common submodule to include:

Richard W.M. Jones (1):
      mlcustomize: Update generated options for virt-v2v

Fixes: commit ade62ebdb50e32a05c336ffcf4c08c6996a3af36
2024-08-20 21:24:00 +01:00
Richard W.M. Jones
ade62ebdb5 v2v: Add support for virt-customize options
For higher level tools making further arbitrary changes to the guest
post-conversion, especially adding more firstboot scripts, it's useful
if we have various features from virt-customize.  Particularly the
ability to upload and run scripts.  Since we have the virt-customize
code in the common/ submodule, the easiest thing to do is to add the
virt-customize options, the same way it is done in virt-builder and
virt-sysprep.

Also updates the common submodule to get:

Richard W.M. Jones (1):
      mlcustomize: Move virt-customize modules to mlcustomize/
2024-08-20 11:46:31 +01:00
Richard W.M. Jones
0950ae3d75 convert: Tag some important information in debug output with ^info:
When we get large virt-v2v logs back from customers it is often
difficult to find relevant information about the guest.  Try to fix
this by tagging some important information so that it will match this
regular expression in searches:

  ^info:

Note I'm not including information about input and output drivers
here.  If we suspect a problem there, then more detailed review of the
log is always needed, plus that information is usually much easier to
find (eg. finding the kubevirt yaml or libvirt XML is obvious even in
large log files).

The main complexity here was to ensure that all of the nbdinfo
information appears together.  We need to run the command and collect
the output, otherwise it gets mixed in with debugging from nbdkit
which resulted from running nbdinfo.

Also update the common submodule to include:

  Richard W.M. Jones (1):
      mldrivers/linux_kernels.ml: Prefix general information with ^info:
2024-07-30 16:07:34 +01:00
Richard W.M. Jones
159fda411d v2v: --mac: Allow gw and len fields to be empty
Even if these appear in the middle of the list, allow them to be
empty.  For example this is now permitted whereas previously it was an
error:

  virt-v2v --mac <MAC>:ip:<ADDR>,,,nameserver

Reported-by: Arik Hadas
2024-07-28 14:49:42 +01:00
Richard W.M. Jones
565de67420 v2v, in-place: introduce --block-driver command line option
The option takes values of "virtio-scsi", "virtio-blk" (with the latter
being the default).  It maps on the convert option with the same name
introduced in the previous commits, thus allowing us to alter the order in
which the VirtIO block drivers are going to be searched for.  This is
useful if we want the virtio-scsi driver to be installed during
conversion instead of the default virtio-blk.

Also update the docs accordingly.

Originally-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Message-Id: <20230310175433.781335-6-andrey.drobyshev@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: fix the docs to placate "test-v2v-docs.sh"]
2023-03-14 13:55:48 +01:00
Richard W.M. Jones
2b849d002d convert: introduce "block_driver" convert option
When injecting a block VirtIO driver during conversion, we rely on the
predefined list of names of such drivers.  Order in this list denotes the
priority (see common/mlcustomize/inject_virtio_win.ml).

This commit introduces the "block_driver" convert option, setting its
value to the default Virtio_blk and making sure it's being properly passed
to the conversion functions. Along with the means of altering the drivers
list (introduced in a separate commit in the common submodule), this option
will be brought to command line, giving us the opportunity to choose the
block driver to be used on conversion.

Originally-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Message-Id: <20230310175433.781335-4-andrey.drobyshev@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2023-03-14 13:02:20 +01:00
Richard W.M. Jones
8ad152afc4 Rework Std_utils.Option so it works like the OCaml stdlib module
OCaml 4.08 introduces a stdlib Option module which looks a bit like
ours but has a number of differences.  In particular our functions
Option.may and Option.default have no corresponding functions in
stdlib, although there are close enough equivalents.

This change was automated using this command:

$ perl -pi.bak \
  -e 's/Option.may/Option.iter/g; s/Option.default /Option.value ~default:/g' \
  `git ls-files`

Update common module to include:

  commit cffa077323fafcdfcf78e230c022afa891a6b3ff
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Mon Feb 20 12:11:51 2023 +0000

    mlstdutils: Rework the Option module to be compatible with stdlib

  commit 007d0506c538db0a43fec7e9986a95ecdcd48b56
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Mon Feb 20 12:18:29 2023 +0000

    mltools: Replace Option.may with Option.iter
2023-02-20 12:21:47 +00:00
Richard W.M. Jones
8c316ed125 v2v: Remove use of ~anchored
In various places we used PCRE.compile ~anchored:true (PCRE2_ANCHORED)
thinking it means that the regular expression is anchored at both
ends.  However this is not what it means (it only anchors the start).
Replace with ^...$
2023-01-30 09:27:07 +00:00
Richard W.M. Jones
d2b01e487f Split long lines in messages
This commit splits up any long lines found in errors, warnings or
other messages.  OCaml ignores whitespace following "\<CR>" within a
string, eg:

  "long string \
   more stuff"

is parsed as:

  "long string more stuff"

Thanks: Laszlo Ersek, for working out the OCaml syntax for this
2023-01-20 10:29:24 +00:00
Richard W.M. Jones
4b9c8e1560 convert: Move Linux driver detection code to common/
Update common to get this commit:

    mldrivers: New directory containing driver detection code

    Move the existing code from virt-v2v for handling driver detection.
    This is just code motion from virt-v2v, so that we can create a new
    tool (in guestfs-tools) called 'virt-drivers'.

    This so far only handles Linux (because virt-v2v doesn't do Windows
    driver detection), but we will add Windows support in future.

This is just code motion.
2023-01-19 10:49:27 +00:00
Richard W.M. Jones
9ca0774109 convert: Move OCaml bindings of libosinfo to common/mltools
This library is needed by Windows_virtio.  Since I intend to move that
functionality into common/mlcustomize, I must also move this library
into common/.
2023-01-16 17:13:15 +00:00
Richard W.M. Jones
5725309ad8 in-place: Fix typo in --help output 2022-11-15 15:33:39 +00:00
Richard W.M. Jones
3c4505c12a build: Remove bundled OCaml bindings for libvirt
The ocaml-libvirt project (https://gitlab.com/libvirt/libvirt-ocaml)
provides bindings for libvirt.  For historical reasons we bundled this
as it was throught ocaml-libvirt wasn't widespread on distros.  In
fact Fedora and Debian derivatives all have this.  Arch does not
(yet), but we can fix that.

It said in the README file in that directory, "before virt-v2v 1.42 is
released we hope to have unbundled this".  That didn't happen, but
let's remove it now.
2022-04-28 15:42:26 +01:00
Richard W.M. Jones
88aaf8263a v2v: Move creation of v2v directory until after option parsing
Only after option parsing does the -v (verbose) option take effect,
and so any debug messages emitted before this point are not seen.  In
particular, debug messages emitted when creating the v2v directory
were lost.  In any case there's no point creating this directory until
nearer the point when we might actually need it.
2022-03-22 15:41:35 +00:00
Richard W.M. Jones
5a60e9a4f6 lib, v2v: Move common code for creating v2v directory to Utils
I have also renamed the directory in the code from "tmpdir" to
"v2vdir" since tmpdir was a bit generic and didn't accurately describe
what this directory is for.

This is simple refactoring.
2022-03-22 14:33:30 +00:00
Richard W.M. Jones
2b27652013 Add in-place support back to virt-v2v
Add a new front end called virt-v2v-in-place which implements simple
in-place conversion support for local disks.

Commit 255722cbf3 ("v2v: Modular virt-v2v") temporarily dropped this
feature.  This commit adds it back.
2022-03-10 15:11:53 +00:00