IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
When set, run up to N copies of nbdcopy in parallel. This only
applies for guests with multiple disks.
The default, as for all older versions of virt-v2v, is to copy disks
one at a time.
In theory, ./configure --with-virt-v2v-nbdkit-python-plugin=<name>
allowed you to override the default nbdkit-python-plugin name (usually
"python"). However:
(a) nbdkit no longer provides a Python version 2 plugin and hasn't
since nbdkit 1.16 (2019),
(b) we no longer support older RHEL where there were parallel Python
2 & 3 plugins and this was an issue, and
(c) the result wasn't actually used in the code (it used to be, but I
think I replaced it with "python" and forgot about this ./configure
parameter).
This models a UEFI NVRAM variable which controls whether or not EFI
binary signatures are verified, which is an initial step in the long
chain of operations commonly known as "secure boot". I added plenty
of documentation explaining what this really means as it is
non-obvious.
Thanks: Daniel Berrange, Andrea Bolognani
Update the qemu shell script to simply find the UEFI paths as
required.
Remove lib/uefi.ml:find_uefi_firmware as this function is no longer
needed.
Remove common/mlv2v/ everywhere. This contained a list of UEFI code
and NVRAM files which is no longer used.
Update common submodule. This pulls in:
Richard W.M. Jones (5):
mlcustomize/customize_run.ml: Move 'in' to new line
mlstdutils/guestfs_config: Define host_os
mlcustomize, mltools: Check guest OS is compatible before allowing --run
Remove mlv2v/ subdirectory
qemuopts: Add ability to add raw, unquoted output to qemu scripts
qemuopts: Fix missing break statement
Unfortunately support has not yet been added to oVirt. However I have
inferred the correct ostype value based on existing entries.
Also pull in the following commit from the common submodule:
Richard W.M. Jones (1):
mlcustomize: Add heuristic support for Windows Server 2025
Related: https://issues.redhat.com/browse/RHEL-65009
Related: https://issues.redhat.com/browse/RHEL-65010
Reported-by: Ming Xie
Another weird corner case in YAML is that empty dictionaries have a
special representation. Empty lists also have a special
representation, that we got wrong.
Link: https://stackoverflow.com/a/33510095
Currently we only print it in debugging output, but we might use it in
future. It costs nothing to get it as it is already collected for
Windows guests (and is empty for other guests).
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:
The configuration (--dump-config) and version of nbdkit won't change
while we are running, so we only need to get it once. We also don't
need the config parameter to Nbdkit.version so drop that.
This function was used by -o libvirt / -o local to check that we have
UEFI firmware for the target architecture. All it does is called
find_uefi_firmware early so that we fail early.
The same check was copied into -o qemu, probably wrongly as we call
find_uefi_firmware just below, so the early fail is not necessary.
This allows us to remove error_unless_uefi_firmware completely since
it is no longer used anywhere.
Almost every Linux guest expects the motherboard Real Time Clock (RTC)
to be set to UTC and they adjust the time displayed based on their
timezone (which may be different for each user).
Most Windows guests expect the RTC to be set to the local time.
Windows can be configured to use a UTC clock. We can detect this by
looking at the Windows registry.
To cope with this difference we need to add a guestcaps flag based on
what we think the guest is expecting. (We might also use the source
hypervisor RTC setting, but it is not thought to be as reliable as
inspecting the guest.)
This change simply adds the flag to guestcaps, and sets it to always
true, so there is no change to the output.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Currently "chown_for_libvirt_rhbz_1045069" is best effort; if it fails, we
suppress the exception (we log it in verbose mode only, even).
That's not proved helpful: it almost certainly leads to later errors, but
those errors are less clear than the original (suppressed) exception.
Namely, the user sees something like
> Failed to connect to '/tmp/v2v.sKlulY/in0': Permission denied
rather than
> Failed to connect socket to '/var/run/libvirt/virtqemud-sock-ro':
> Connection refused
So just allow the exception to propagate outwards.
And then, now that "chown_for_libvirt_rhbz_1045069" will be able to fail,
hoist the call to "On_exit.rm_rf" before the call to
"chown_for_libvirt_rhbz_1045069", after creating the v2v temporary
directory. In the current order, if "chown_for_libvirt_rhbz_1045069" threw
an exception, then we'd leak the temp dir in the filesystem.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2182024
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230629123443.188350-3-lersek@redhat.com>
[lersek@redhat.com: reinstate parens under "then" [Rich]]
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Fix a small comment typo from commit 4e7f20684373 ("lib: Improve security
of in/out sockets when running virt-v2v as root", 2022-03-23).
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2182024
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230629123443.188350-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
This code is needed to check whether virtio-scsi driver was installed.
This reverts commit f0afc439524853508938b2bfc758896f053462e3.
Message-Id: <20230310175433.781335-2-andrey.drobyshev@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
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
As with the prior commit, prefer -cpu host for all guests (except when
we have more information from the source hypervisor). Although there
is the disadvantage that -cpu host is non-migratable, in practice it
would be very difficult to live migrate a host launched using direct
qemu commands.
Note that after this change, gcaps_arch_min_version is basically an
informational field. No output uses it, but it will appear in debug
output and there's the possibility we might use it for a future output
mode.
Thanks: Laszlo Ersek
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Some guests require not just a specific architecture, but cannot run
on qemu's default CPU model, eg. requiring x86_64-v2. Since we
anticipate future guests requiring higher versions, let's encode the
minimum architecture version instead of a simple boolean.
This patch essentially just remaps:
gcaps_default_cpu = true => gcaps_arch_min_version = 0
gcaps_default_cpu = false => gcaps_arch_min_version = 2
I removed a long comment about how this capability is used because we
intend to completely remove use of the capability in a coming commit.
Updates: commit a50b975024ac5e46e107882e27fea498bf425685
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
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
Update common submodule, picking up:
mltools: Move DOM code from virt-v2v to mltools
This is a simple library for generating XML output. We would like to
use this in the new guestfs-tools program 'virt-drivers', so move it
to common/mltools.
This is a straightforward code move, the library has no significant
dependencies.
The existing function Inspect_source.get_firmware_bootable_device
detected if the guest could boot using UEFI through inspection (rather
than whatever the hypervisor told us).
Move this function to a new module, renaming it as
Firmware.detect_firmware.
Since we intend to move this into common/ (so it can be used in
guestfs-tools), remove the i_firmware field from the inspect struct
and pass it around as a separate argument.
This was the only guest type which did not support ACPI. It also only
supported direct to libvirt output. It hasn't been tested for a long
time, and hasn't been supported by Red Hat for very much longer.
Removing this means we no longer have to think about non-ACPI guests.
Reflect commit 38b35f3b7e5c ("rhv: Use osinfo to distinguish Windows >= 10
variants", 2022-12-02) to the "ovirt:id" field in the OVF as well. Take
the values from "packaging/conf/osinfo-defaults.properties" in the
ovirt-engine tree, as the comment on "get_ovirt_osid" explains.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2152465
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230101140926.260265-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
This is only enough to be able to generate Kubevirt machine
descriptions so it does not have to deal with all the general
complexity of YAML. Only associative arrays, lists, simple types like
strings, and blocks of lines are supported.
Unfortunately even generating simple YAML safely is not easy. There
are many quirks to the format and many traps, including the dependency
between lists and associative arrays, and the lack of type safety.
So that Windows conversion can use the same function.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149629
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20221202124409.11741-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Windows versions >= 10 no longer use the NT major.minor numbering
scheme (it is fixed at 10.0). Libguestfs >= 1.49.8 can distinguish
these versions and it sets <osinfo> correctly, so use that instead.
After this change the OVF will contain:
<Info>Windows 10 Pro</Info>
<Description>windows_11</Description>
which is strange, but apparently what Microsoft intended. As far as
RHV is concerned it only needs <Description> to choose the correct
devices etc.
Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2149863
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This function was renamed to make it clearer what it does (and that
it's potentially dangerous). The functionality is unchanged.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
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.
Conversion will set "gcaps_default_cpu" to true iff the guest OS is
capable of running on QEMU's default VCPU model.
This capability will only matter for the QEMU and libvirt output modules,
where, in case the capability is false *and* the source hypervisor does
not specify a VCPU model, we'll have to manually present the guest OS with
a VCPU that looks as close as possible to a physical CPU. (In that case,
we'll specify host-passthrough.)
The management applications targeted by the RHV and OpenStack output
modules have their own explicit VCPU defaults, overriding the QEMU default
model even in case the source hypervisor does not specify a VCPU model;
those modules will ignore this capability therefore.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2076013
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220420162333.24069-2-lersek@redhat.com>
[lersek@redhat.com: mention "-cpu qemu64" near the new field def (Rich)]
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
We model NVMe devices in the source hypervisor.
We currently assume that no one is using the namespaces feature of
NVMe, ie. that each source device will appear in a Linux guest as
/dev/nvme0n1, /dev/nvme1n1, etc. We could fix this if it is a
problem, but it requires adjusting the current assumption for
removable devices that slots are simple integers.
The devices are mapped to virtio-blk, so in the target the device name
has to change from /dev/nvme0 to /dev/vda (etc.)
Reported-by: Ming Xie
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2070530
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
At this point, virt-v2v never relies on the Unix domain sockets created
inside the "run_unix" implementations. Simplify the code by removing this
option.
Consequently, the internally created temporary directory only holds the
NBD server's PID file, and never its UNIX domain socket. Therefore:
(1) we no longer need the libguestfs socket dir to be our temp dir,
(2) we need not change the file mode bits on the temp dir,
(3) we can rename "tmpdir" to the more specific "piddir".
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066773
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220323104330.9667-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
When using the libvirt backend and running as root, libvirt will run
qemu as a non-root user (eg. qemu:qemu). The v2v directory stores NBD
endpoints that qemu must be able to open and so we set the directory
to mode 0711. Unfortunately this permits any non-root user to open
the sockets (since, by design, they have predictable names within the
directory).
Additionally we were setting the sockets themselves to 0777 mode.
Instead of using directory permissions, change the owner of the
directory and sockets to precisely give access to the qemu user and no
one else.
Reported-by: Xiaodai Wang
Thanks: Dr David Gilbert, Daniel Berrangé, Laszlo Ersek
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2066773
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
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.
This was used before we turned the helpers into OCaml modules but is
now dead code, remove it.
Fixes: commit 4de22686fe74e1711efd9bfed3f663b67e7ad69e
Fixes: commit 724ecb5e887e5b71db836143ec0c0d8a20b05903
Fixes: commit 5609c73c615a8f12c5c6d50908bb4761bdc16173
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.
When we decide which output name to use, we start with the source name
(source.s_name), and override it with the output name specified on the
command line (-on option).
This calculation is done in quite a few places.
One place is in the conversion function. This is completely
unnecessary and the commit removes it.
Also all the output functions do it, but they don't do it during other
option parsing code (ie. parse_options). I have rationalized this
slightly by moving the calculation in all output modules to the
parse_options function and passing the computed value around in the
same structure as all the other parsed options. (This change will
make more sense in the context of the following commit which further
rationalizes option parsing across all output modules.)
The change is quite large but is only refactoring and should make no
semantic change.
The default for qemu-nbd is to ignore discard requests. This meant
that for input files in qcow2 format the "Mapping ..." (ie. fstrim)
step did nothing, all the work was ignored and we copied deleted data
over to the destination.
This was detected by the test-v2v-trim.sh test.
Fixes: commit 255722cbf39afc0b012e2ac00d16fa6ba2f8c21f
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
qemu-nbd --shared (-e) flag controls how many clients can connect
concurrently. 0 means unlimited.
We want to allow the sockets to be queried by other processes while
virt-v2v is running and it should be safe to do this. The default
configuration of qemu-nbd doesn't allow this so add --shared=0.
Note this does not (in current qemu) enable multi-conn because we
aren't using the -r (read-only) flag.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Adapt our "Utils.get_disk_allocated" function to the changed signature of
"NBD.block_status", coming from libnbd patch
ocaml: map C's uint32_t to OCaml's int64
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2027598
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220114135048.25243-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
It makes no sense for the NBD server to return a zero-length block, plus
it used to be a bug in the libnbd OCaml bindings to wrap 32-bit block
lengths with the MSB set around to negative (signed) 32-bit integers
(which would then be widened to negative (signed) 64-bit integers).
Any non-positive "len" value breaks the progression of "fetch_offset",
potentially leading to an infinite loop.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2027598
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220114135048.25243-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
If using virt-v2v in verbose mode, pass the debug flag when using
libnbd. This provides additional debugging.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Make the meta_contexts parameter of Utils.with_nbd_connect_unix
optional and erasable. This involves three connected changes, we
first make it optional (ie. '?meta_contexts'), providing the obvious
default of empty list. We then need to move it to the first parameter
so OCaml can erase it even if we partially apply this function.
Finally remove the label from the function parameter 'f'.
Explanation for why the final change was necessary here:
https://listman.redhat.com/archives/libguestfs/2022-January/msg00082.html
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Add a new field to the "guestcaps" record to track whether the guest
supports the virtio devices that it does at the virtio-1.0 protocol level.
Virt-v2v's current assumption is that virtio-1.0 is supported by any
guest, namely for those virtio devices specifically that the guest
supports -- which in fact may be the empty set. Make this assumption
explicit by setting the new field to "true" in "convert/convert_linux.ml"
and "convert/convert_windows.ml".
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220106140910.13695-4-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
The "string_of_guestcaps" function is out of date; the following commits
did not update it, when they introduced new fields to the "guestcaps"
record type:
- d295d6e510a4 ("v2v: Extend guestcaps to record drivers for virtio-rng,
balloon and pvpanic.", 2017-04-06)
- 05f780c16f01 ("v2v: support configuration of viosock driver",
2021-02-26)
Print those fields now.
Fixes: d295d6e510a4fb251d545c52c0a9d6dccabe6f78
Fixes: 05f780c16f0135c657615520c2245b42de1efc3e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220106140910.13695-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
The printf format string in "string_of_guestcaps" is hard to read, because
it is not indented properly wrt. the rest of the source code. Indent it
properly without changing its behavior.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220106140910.13695-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Nir reports that, despite the comment we removed in commit a2a4f7a09996,
we generally cannot access the output NBD servers in the finalization
stage. In particular, in the "rhv_upload_finalize" function
[output/output_rhv_upload.ml], the output disks are disconnected before
"create_ovf" is called.
Consequently, the "get_disk_allocated" call in the "create_ovf" ->
"add_disks" -> "get_disk_allocated" chain fails.
Rich suggests that we explicitly restrict the "get_disk_allocated" call
with a new optional boolean parameter to the one output plugin that really
needs it, namely the old RHV one.
Accordingly, revert the VDSM test case to its state at (a2a4f7a09996^).
Cc: Nir Soffer <nsoffer@redhat.com>
Fixes: a2a4f7a09996a5e66d027d0d9692e083eb0a8128
Reported-by: Nir Soffer <nsoffer@redhat.com>
Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034240
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211220135640.12436-1-lersek@redhat.com>
Tested-by: Nir Soffer <nsoffer@redhat.com>
[lersek@redhat.com: drop parens around condition in "if"; thanks: Rich]
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>