Commit Graph

10810 Commits

Author SHA1 Message Date
Pino Toscano
21cf4aaafb uefi: remove last references to kraxel's old edk2 builds
Commit 889386f8c6 removed most of them
already, so remove the last ones, and the supporting code.
2018-08-09 16:27:48 +02:00
Daniel Erez
bc2ba2f47b v2v: rhv plugin - case-sensitive search queries
Changed both search queries to case-sensitive (to ensure an exact match).
2018-08-09 16:26:58 +02:00
Daniel Erez
c0f9ab6665 v2v: rhv plugin - fix DC search string
Search for DC by 'storage.name=' to make it explicit.
I.e. "storage=" uses regex, so similar names can be
found in the search query. For example, searching for
a domain named FCSD, will find FCSD1 as well.
2018-08-09 16:26:58 +02:00
Pino Toscano
bb6b81861e v2v: -o rhv-upload: check for ovirtsdk4 (RHBZ#1601943)
Check earlier whether the ovirtsdk4 Python can be imported correctly,
to avoid errors later on during the migration.
2018-08-09 16:26:58 +02:00
Pino Toscano
77604b91ec v2v: change QXL ResourceType in OVirt flavour (RHBZ#1598715)
Due to a conflict with the IDs of the OVF standard, and the existing
implementation in ovirt-engine, the ID of QXL devices changed to a
different value.

As a consequence, change the ResourceType of QXL devices, but only in
OVirt flavour to avoid breaking vdsm mode.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1598715#c5
(cherry picked from commit aa9e18f6d1)
2018-08-09 16:26:58 +02:00
Daniel Erez
e1401de974 v2v: rhv plugin - find suitable host (RHBZ#1596810) (RHBZ#1596851)
For direct upload, a suitable host must be in status 'Up'
and belong to the same datacenter as the created disk.
Added these criteria to the host search query.

(cherry picked from commit 4ed1bc5a79)
2018-08-09 16:26:58 +02:00
Nir Soffer
7b5ec5a647 v2v: rhv-upload-plugin: Optimize only direct upload
The optimization to start the transfer on the local host makes sense
only when using the rhv-direct=true option. When using a proxy, let the
engine choose a host.

(cherry picked from commit 891b5a0ec0)
2018-08-09 16:26:58 +02:00
Nir Soffer
8aaf7d89ef v2v: rhv-upload-plugin: Improve error handling
When optimizing the connection using unix socket, we handle these cases:

- The local host is not an oVirt host (no /etc/vdsm/vdsm.id).
- The local host is an oVirt host, but is not registered with engine.
- Creating UnixHTTPConnection() fails. Unlikely and probably a bug in
  the plugin, but we can recover by using the https connection.

The current code handle these cases silently, making it harder to
understand why the unix socket optimization did no happen. Add debug
message to make this clear.

Also comment in the error handler why we take this path instead of
failing the operation.

(cherry picked from commit f5442d2f04)
2018-08-09 16:26:58 +02:00
Nir Soffer
a3e99c84e1 v2v: rhv-upload-plugin: Remove unneeded auth
Old imageio proxy was using Authorization header for GET and PUT
requests. Remove unneeded authorization when sending OPTIONS request.

Remove unneeded duplicated comments about authorization for old
imageio, and replace them with a comment when we set needs_auth.

(cherry picked from commit d5f36bacf9)
2018-08-09 16:26:58 +02:00
Pino Toscano
da504873e1 v2v: improve -os documentation for rhv-upload
Thanks to: Ming Xie

(cherry picked from commit 8d33ff8ba4)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
db7e06935b v2v: -o rhv-upload: Use Unix domain socket to access imageio (RHBZ#1588088).
In the case where virt-v2v runs on the same server as the imageio
daemon that we are talking to, it may be possible to optimize access
using a Unix domain socket.

This is only an optimization.  If it fails or if we're not running on
the same server it will fall back to the usual HTTPS over TCP
connection.

Thanks: Nir Soffer, Daniel Erez.
(cherry picked from commit b7a2e6270d)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
1d2058c08b v2v: -o rhv-upload: Always fetch server options when opening the connection.
Previously we lazily requested the server options in the can_*
callbacks.  The can_* callbacks are always called by nbdkit straight
after open, so this just adds complexity for no benefit.  This change
simply makes the code always fetch the server options during the open
callback.

This is — functionally at least — mostly just refactoring.  However I
also added a useful debug message so we can see what features the
imageio server is offering.

(cherry picked from commit a1e1f6ec88)
2018-08-09 16:26:58 +02:00
Nir Soffer
6e683fa651 v2v: rhv-upload-plugin: Remove unused variables
Remove some instances of "transfer" and "transfer_service" that are not
used in current code.

(cherry picked from commit 32ab53cecd)
2018-08-09 16:26:58 +02:00
Nir Soffer
47fd85a883 v2v: rhv-upload-plugin: Fix name error
"http" and "transfer" variables were missing in emulate_zero, so the
code would fail with NameError.  This can happen only when communicating
with old imageio versions not supporting the "zero" feature.

Testing with qemu-img 2.12 show that we never send emulated zero request
because of the highestwrite mechanism, but it can break with older
qemu-img-rhev used on RHEL.

(cherry picked from commit 0ae61ce99c)
2018-08-09 16:26:58 +02:00
Nir Soffer
6cd873ff9a v2v: rvh-upload-plugin: Always read the response
Python manual warns[1]:

    Note that you must have read the whole response before you can send
    a new request to the server.

The reason for this warning is exposed only when the server is using
keep alive connections. When the response is not read, sending a new
request will fail with:

    httplib.ResponseNotReady

Even if Content-Length was 0 or the request has no content. The failure
looks like this when using --verbose:

nbdkit: python[1]: debug: zero count=33554432 offset=0 may_trim=1 fua=0
nbdkit: python[1]: debug: zero count=33554432 offset=33554432 may_trim=1 fua=0
nbdkit: python[1]: error: /home/nsoffer/src/libguestfs/tmp/rhvupload.Au2B5I/rhv-upload-plugin.py: zero: error: Request-sent
nbdkit: python[1]: debug: sending error reply: Input/output error
qemu-img: error writing zeroes at offset 0: Input/output error

Change all requests to read the whole response.

Tested with imageio patch supporting keep alive connections:
https://gerrit.ovirt.org/#/c/92296/

[1] https://docs.python.org/3.8/library/http.client.html#http.client.HTTPConnection.getresponse

(cherry picked from commit f4e0a8342d)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
c2ed35e2bc v2v: -o rhv-upload: Log full imageio response on failure.
Thanks: Nir Soffer
(cherry picked from commit 831a75cd11)
2018-08-09 16:26:58 +02:00
Nir Soffer
5917bdc15f v2v: -o rhv-upload: Optimize http request sending
When sending request with small or no payload, it is simpler and
possibly more efficient to use the high level HTTPSConnection.request(),
instead of the lower level APIs.

The only reason to use the lower level APIs is to avoid copying the
payload, or on python 2, to use a bigger buffer size when streaming a
file-like object.

(cherry picked from commit 77a412c0a1)
2018-08-09 16:26:58 +02:00
Pino Toscano
ee00f39eea inspector: show the per-OS osinfo guess (RHBZ#1544842)
Output also the osinfo guess for each OS in the generated XML output;
adapt the RNG schema, and the test data to it.

(cherry picked from commit 2f8ec91fc1)
2018-08-09 16:26:58 +02:00
Pino Toscano
24aef5baa9 New API: inspect_get_osinfo
Try to guess the possible osinfo-db short ID for the specified OS.

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1544842

(cherry picked from commit 286b88891c)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
e61cbd740b v2v: -o rhv-upload: Set inactivity timeout (RHBZ#1586198).
This increases the inactivity timeout for transfers from the default
(60 seconds in oVirt < 4.2.3, 600 seconds in >= 4.2.3), up to 1 hour,
so that we should never hit it for ordinary transfers.

Note this requires oVirt >= 4.2.3.  The corresponding oVirt fix was
https://bugzilla.redhat.com/1563278

I also replaced the deprecated ‘image’ parameter with ‘disk’.

Thanks: Nir Soffer, Daniel Erez.
(cherry picked from commit f25404c65f)
2018-08-09 16:26:58 +02:00
Pino Toscano
973810a232 v2v: add and use Create_ovf.ovf_flavour_to_string
Add an helper to convert an OVF flavour to string, and use it in
-o vdsm to print the actual value of the vdsm-ovf-flavour option.

Thanks to Ming Xie.

(cherry picked from commit c0da02f90d)
2018-08-09 16:26:58 +02:00
Pino Toscano
bd2afb6e11 v2v: fix "rhevexp" typo in documentation
Spotted by Ming Xie.

(cherry picked from commit c021ac5e64)
2018-08-09 16:26:58 +02:00
Pino Toscano
b31fcaf987 v2v: fix build rules for output_rhv_upload_*_source.ml files
Use the $(srcdir) variable where needed, to make sure it builds also
with srcdir != builddir.

Furthermore, make sure that the OCaml dependencies calculation depend on
the generated output_rhv_upload_*_source.ml files, otherwise there will
be incomplete OCaml rules for them in the generated .depend.

Fixes commit cc04573927.

(cherry picked from commit a4e3b7c059)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
c2570c81e8 v2v: Map Windows Server 2012 R2 x86-64 to ovirt ID 25.
Thanks: Michal Skrivanek

Fixes commit 593a19cc86.

(cherry picked from commit c6e8929929)
2018-08-09 16:26:58 +02:00
Tomáš Golembiovský
1ddbe89dbc v2v: -o rhv-upload: install RHV tools (RHBZ#1561828).
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
(cherry picked from commit f3f00d3f9c)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
2e9cc6b230 v2v: -o rhv-upload: Don't require ‘-of raw’ parameter.
Because we checked the limitation of raw+sparse during command line
processing, it had the effect of forcing you to use ‘-of raw’ even if
the input was already in raw format.  Move the checking to the output
mode to avoid this.

Fixes commit cc04573927.

(cherry picked from commit b3769afaec)
2018-08-09 16:26:58 +02:00
Pino Toscano
2648e807fa v2v: refer to the right embed script in EXTRA_DIST
Fixes commit cc04573927.

(cherry picked from commit cf49fe1003)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
79aa92b800 v2v: Add -o rhv-upload output mode (RHBZ#1557273).
This adds a new output mode to virt-v2v.  virt-v2v -o rhv-upload
streams images directly to an oVirt or RHV >= 4 Data Domain using the
oVirt SDK v4.  It is more efficient than -o rhv because it does not
need to go via the Export Storage Domain, and is possible for humans
to use unlike -o vdsm.

The implementation uses the Python SDK (‘ovirtsdk4’ module).  An
nbdkit Python 3 plugin translates NBD calls from qemu into HTTPS
requests to oVirt via the SDK.

(cherry picked from commit cc04573927)
2018-08-09 16:26:58 +02:00
Pino Toscano
b96a2119b2 v2v: OVF: fix ovf:id for VirtualSystem in OVirt flavour
When writing the OVF in OVirt flavour, write the actual UUID of the
VM as ovf:id attribute for <VirtualSystem>, instead of a dummy value.

Suggested by Arik Hadas in
https://www.redhat.com/archives/libguestfs/2018-April/msg00005.html

(cherry picked from commit 9dce43931a)
2018-08-09 16:26:58 +02:00
Pino Toscano
1b4c00a3ec v2v: OVF: write ovirt:id attribute for the OS in OVirt flavour
When writing the OVF in OVirt flavour, add a ovirt:id attribute to the
OperatingSystemSection tag: this attribute represents the numeric value
of the ostype ID, which is ignored by oVirt when parsing OVFs in API
mode.

(cherry picked from commit 593a19cc86)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
5198d704e9 v2v: Add general mechanism for input and output options (-io/-oo).
Currently we have a bunch of ad hoc options like --vddk* and --vdsm*
(and proposed to add --rhv*) to handle extra parameters for input and
output modes/transports.  This complicates the command line parsing
and also the clarity of the command line (becauseit's not very obvious
which options apply to which side of the conversion).

Replace these with a general mechanism for handling input and output
options.

Thus (for example):

  --vddk-thumbprint=...   becomes   -io vddk-thumbprint=...
  --vdsm-compat=0.10                -oo vdsm-compat=0.10

The responsibility for parsing input and output options moves into the
input and output drivers.

This improves error checking so it's harder now for wrong flags to be
included on the command line when they don't apply to the current mode.

The old option names are preserved for compatibility.

(cherry picked from commit 6327e716cd)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
311d8dff12 v2v: cmdline: Move definition to before its only use.
(cherry picked from commit 3167ce1f91)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
ae2d0a507a v2v: Add -op (output password file) option.
Currently unused, in a future commit this will allow you to pass in a
password to be used when connecting to the target hypervisor.

(cherry picked from commit a4e181137a)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
83b5f58923 v2v: DOM: Add doc_to_string function.
Convert a document to an in-memory string.

(cherry picked from commit 802c8635cc)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
00ed208050 v2v: OVF: Code formatting.
Updates commit a52ed4b445
("v2v: ovf: Create OVF more aligned with the standard") with some
small code refactoring and formatting.

(cherry picked from commit 9e83f3a2cc)
2018-08-09 16:26:58 +02:00
Tomáš Golembiovský
14cfe80643 v2v: vdsm: add --vdsm-fixed-ovf option
Add option for -o vdsm that enables output of the modified OVF. oVirt
engine should already be able to consume the OVF, but let's not take any
chances and enable it only by command line argument. It can be made
default later when it receives proper testing.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
(cherry picked from commit 285014b290)
2018-08-09 16:26:58 +02:00
Tomáš Golembiovský
d330b210b7 v2v: ovf: Create OVF more aligned with the standard
For historical reasons the OVF used in RHV export domain contains some
deviations from the OVF standard. The format used in -o rhv has to
remain fixed but for -o vdsm and we could produce much nicer OVF. This
patch serves as a preparatory step to this.

The main reason for creating different OVF is that it can be used to
create VM by oVirt REST API. The RHV export domain flavor cannot be used
that way.

For now the virt-v2v behavior is unchanged. The modified output will be
enabled in some later patch.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
(cherry picked from commit a52ed4b445)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
898e6c1e39 qemu: Fix transcription error in conversion of yajl to jansson.
This broke qemu mandatory locking detection.

Fixes commit bd1c5c9f4d.

(cherry picked from commit e79286f717)
2018-08-09 16:26:58 +02:00
Pino Toscano
21f0a22072 Switch from YAJL to Jansson
While YAJL mostly works fine, it did not see any active development in
the last 3 years.  OTOH, Jansson is another JSON C implementation, with
a very liberal license, and a much nicer API.

Hence, switch all of libguestfs from YAJL to Jansson:
- configure checks, and buildsystem in general
- packages pulled in the appliance
- actual implementations
- contrib scripts
- documentation

This also makes use of the better APIs available (e.g. json_object_get,
json_array_foreach, and json_object_foreach).  This does not change the
API of our OCaml Yajl module.

(cherry picked from commit bd1c5c9f4d)
2018-08-09 16:26:58 +02:00
Richard W.M. Jones
daabd0138b Version 1.38.4. v1.38.4 2018-08-09 15:23:38 +01:00
Pino Toscano
8d5f54b45c btrfs_balance_status: delay allocation of 'ret'
Allocate 'ret' as late as possible, so there is no risk that early
returns will leak it.

(cherry picked from commit 31ee088812)
2018-08-08 19:26:58 +01:00
Pino Toscano
961c37995e daemon: inspect: ignore fstab devs that cannot be resolved (RHBZ#1608131)
If the /etc/fstab of a guest contains devices specified with UUID or
LABEL, then the new OCaml inspection code will report the findfs failure
as general failure of the inspection.  OTOH, the old C inspection code
simply ignored all the devices that cannot be resolved.

Hence, restore the old behaviour by ignoring unresolvable devices.

(cherry picked from commit 67c36779c3)
2018-08-08 19:26:58 +01:00
Richard W.M. Jones
72a97dc0bc inspector: Add a regression test for LUKS images (RHBZ#1602353).
(cherry picked from commit ec2228ea05)
2018-08-08 19:26:58 +01:00
Richard W.M. Jones
0845072201 test-data/phony-guests: Add Fedora LUKS phony image for testing.
This is not added to guests-all-good since it cannot be used in
automated tests -- a password must be supplied.

(cherry picked from commit 16e64b8988)
2018-08-08 16:49:57 +01:00
Richard W.M. Jones
9be59a4817 Revert "lvm: do not pass --cache to vgscan"
This reverts commit 19b0ae6c65.

(cherry picked from commit 83fb657bec)
2018-08-08 16:49:53 +01:00
Richard W.M. Jones
435ebc5211 test-data/phony-guests: Add comment to Makefile above Fedora btrfs image.
Fixes commit 754e819438.

(cherry picked from commit 3a87c4bb44)
2018-08-08 16:47:31 +01:00
Pino Toscano
76f6f73bda uefi: add non-deprecated Fedora paths for OVMF w/ secboot
Add new paths for the Secure Boot variant of OVMF as found in Fedora.

(cherry picked from commit 4167ee2173)
2018-08-08 16:44:38 +01:00
Richard W.M. Jones
51c9d30c74 build: Disable warnings about attribute malloc functions.
(cherry picked from commit 2280c501ff)
2018-07-14 12:07:17 +01:00
Richard W.M. Jones
4c354ed410 v2v: Remove old TODO file.
(cherry picked from commit 32202e3917)
2018-07-14 12:06:55 +01:00
Richard W.M. Jones
eef61c112d build: Disable -Wabi warning as it is broken with GCC 8.1.
(cherry picked from commit aeabe622ac)
2018-07-14 12:06:33 +01:00