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.
---
.gitignore| 3 +
TODO | 27 ++
v2v/Makefile.am | 30 +-
v2v/cmdline.ml| 41 +++
v2v/embed.sh | 48
v2v/output_rhv_upload.ml | 401 +++
v2v/output_rhv_upload.mli | 33 +++
v2v/output_rhv_upload_createvm_source.mli | 19 ++
v2v/output_rhv_upload_plugin_source.mli | 19 ++
v2v/output_rhv_upload_precheck_source.mli | 19 ++
v2v/rhv-upload-createvm.py| 86 ++
v2v/rhv-upload-plugin.py | 445 ++
v2v/rhv-upload-precheck.py| 73 +
v2v/test-v2v-o-rhv-upload-oo-query.sh | 38 +++
v2v/test-v2v-python-syntax.sh | 45 +++
v2v/virt-v2v.pod | 138 +++--
16 files changed, 1447 insertions(+), 18 deletions(-)
diff --git a/.gitignore b/.gitignore
index ec70c203d..c5bdcef56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -671,6 +671,9 @@ Makefile.in
/utils/qemu-speed-test/qemu-speed-test
/v2v/.depend
/v2v/oUnit-*
+/v2v/output_rhv_upload_createvm_source.ml
+/v2v/output_rhv_upload_plugin_source.ml
+/v2v/output_rhv_upload_precheck_source.ml
/v2v/real-*.d/
/v2v/real-*.img
/v2v/real-*.xml
diff --git a/TODO b/TODO
index 2e37ce67c..d196a3f6b 100644
--- a/TODO
+++ b/TODO
@@ -570,3 +570,30 @@ Subsecond handling in virt-diff, virt-ls
Handle nanoseconds properly. You should be able to specify them on
the command line and display them.
+
+virt-v2v -o rhv-upload
+--
+
+* Set or disable the ticket timeout. The default is going to be
+ increased (from current 60 seconds), so maybe we won't have to
+ set it. See also:
+ https://bugzilla.redhat.com/show_bug.cgi?id=1563278
+
+* qcow2 cannot be supported yet because there is not yet any
+ concept in imageio of read+write handles.
+ https://bugzilla.redhat.com/show_bug.cgi?id=1563299
+
+* preallocated cannot be supported yet because imageio doesn't
+ know how to zero the image efficiently, instead it runs an
+ fallocate process which writes to every block and that takes
+ many minutes.
+
+* Really check what insecure/rhv_cafile do and implement it correctly.
+
+* Measure and resolve performance problems.
+
+* Allocated image size is unknown for v2v uploads, but imageio needs
+ to know it. We pass initial_size == provisioned_size == virtual size.
+ That can't be fixed from the v2v side.
+
+* There are unresolved issues about how to clean up disks on failure.
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 6e71cae3c..f36731750 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -22,12 +22,19 @@ generator_built = \
uefi.mli
BUILT_SOURCES = \
- $(generator_built)
+ $(generator_built) \
+ output_rhv_upload_createvm_source.ml \
+ output_rhv_upload_plugin_source.ml \
+ output_rhv_upload_precheck_source.ml
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
copy_to_local.ml \
copy_to_local.mli \
+ embed-code.sh \
+ rhv-upload-createvm.py \
+ rhv-upload-plugin.py \
+ rhv-upload-precheck.py \
v2v_slow_unit_tests.ml \
v2v-slow-unit-tests.sh \
v2v_unit_tests.ml \
@@ -64,6 +71,10 @@ SOURCES_MLI = \
output_null.mli \
output_qemu.mli \
output_rhv.mli \
+ output_rhv_upload.mli \
+ output_rhv_upload_createvm_source.mli \
+ output_rhv_upload_plugin_source.mli \
+ output_rhv_upload_precheck_source.mli \
output_vdsm.mli \
parse_ovf_from_ova.mli \
parse_libvirt_xml.mli \
@@ -116,6 +127,10 @@ SOURCES_ML = \
output_local.ml \
output_qemu.ml \
output_rhv.ml \
+ output_rhv_upload_createvm_source.ml \
+ output_rhv_upload_plugin_source.ml \
+ output_rhv_upload_precheck_source.ml \
+ output_rhv_upload.ml \
output_vdsm.ml \
inspect_source.ml \
target_bus_assignment.ml \
@@ -126,6 +141,15 @@ SOURCES_C = \
libvirt_utils-c.c \
qemuopts-c.c
+# These files are generated and contain rhv-upload-*.py embedded as an
+# OCaml string.
+output_rhv_upload_createvm_source.ml: rhv-upload-createvm.py
+ ./embed.sh code $^ $@
+output_rhv_upload_plugin_source.ml: rhv-upload-plugin.py
+ ./embed.sh code $^ $@
+output_rhv_upload_precheck_source.ml: rhv-upload-precheck.py
+ ./embed.sh code $^ $@