|
|
5ce0c7 |
From 8f8fbe96bfcb6f284590ddd17b960247ec87bde9 Mon Sep 17 00:00:00 2001
|
|
|
46b2f6 |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
46b2f6 |
Date: Mon, 16 Sep 2019 14:07:22 +0200
|
|
|
46b2f6 |
Subject: [PATCH] v2v: -o rhv-upload: collect disks UUIDs right after copy
|
|
|
46b2f6 |
|
|
|
46b2f6 |
Instead of waiting for the completion of the nbdkit transfers to get the
|
|
|
46b2f6 |
UUIDs of the disks, use the new #disk_copied hook to do that after each
|
|
|
46b2f6 |
disk is copied.
|
|
|
46b2f6 |
|
|
|
46b2f6 |
This has almost no behaviour on rhv-upload, except for the --no-copy
|
|
|
46b2f6 |
mode:
|
|
|
46b2f6 |
- previously it used to hit the 5 minute timeout while waiting for the
|
|
|
46b2f6 |
finalization of the first disk
|
|
|
46b2f6 |
- now it asserts on the different number of collected UUIDs vs the
|
|
|
46b2f6 |
actual targets; at the moment there is nothing else that can be done,
|
|
|
46b2f6 |
as this assumption is needed e.g. when creating the OVF file
|
|
|
46b2f6 |
|
|
|
46b2f6 |
(cherry picked from commit 7b93ad6a32f09043bf870202b59bea83d47e0c3a)
|
|
|
46b2f6 |
---
|
|
|
46b2f6 |
v2v/output_rhv_upload.ml | 32 ++++++++++++++++----------------
|
|
|
46b2f6 |
1 file changed, 16 insertions(+), 16 deletions(-)
|
|
|
46b2f6 |
|
|
|
46b2f6 |
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
|
|
|
46b2f6 |
index 19bdfcf05..382ad0d93 100644
|
|
|
46b2f6 |
--- a/v2v/output_rhv_upload.ml
|
|
|
46b2f6 |
+++ b/v2v/output_rhv_upload.ml
|
|
|
46b2f6 |
@@ -231,6 +231,8 @@ object
|
|
|
46b2f6 |
val mutable rhv_storagedomain_uuid = None
|
|
|
46b2f6 |
(* The cluster UUID. *)
|
|
|
46b2f6 |
val mutable rhv_cluster_uuid = None
|
|
|
46b2f6 |
+ (* List of disk UUIDs. *)
|
|
|
46b2f6 |
+ val mutable disks_uuids = []
|
|
|
46b2f6 |
|
|
|
46b2f6 |
method precheck () =
|
|
|
46b2f6 |
Python_script.error_unless_python_interpreter_found ();
|
|
|
46b2f6 |
@@ -379,23 +381,21 @@ If the messages above are not sufficient to diagnose the problem then add the
|
|
|
46b2f6 |
TargetURI ("json:" ^ JSON.string_of_doc json_params)
|
|
|
46b2f6 |
) overlays
|
|
|
46b2f6 |
|
|
|
46b2f6 |
- method create_metadata source targets _ guestcaps inspect target_firmware =
|
|
|
46b2f6 |
- (* Get the UUIDs of each disk image. These files are written
|
|
|
46b2f6 |
- * out by the nbdkit plugins on successful finalization of the
|
|
|
46b2f6 |
+ method disk_copied t i nr_disks =
|
|
|
46b2f6 |
+ (* Get the UUID of the disk image. This file is written
|
|
|
46b2f6 |
+ * out by the nbdkit plugin on successful finalization of the
|
|
|
46b2f6 |
* transfer.
|
|
|
46b2f6 |
*)
|
|
|
46b2f6 |
- let nr_disks = List.length targets in
|
|
|
46b2f6 |
- let image_uuids =
|
|
|
46b2f6 |
- List.mapi (
|
|
|
46b2f6 |
- fun i t ->
|
|
|
46b2f6 |
- let id = t.target_overlay.ov_source.s_disk_id in
|
|
|
46b2f6 |
- let diskid_file = diskid_file_of_id id in
|
|
|
46b2f6 |
- if not (wait_for_file diskid_file finalization_timeout) then
|
|
|
46b2f6 |
- error (f_"transfer of disk %d/%d failed, see earlier error messages")
|
|
|
46b2f6 |
- (i+1) nr_disks;
|
|
|
46b2f6 |
- let diskid = read_whole_file diskid_file in
|
|
|
46b2f6 |
- diskid
|
|
|
46b2f6 |
- ) targets in
|
|
|
46b2f6 |
+ let id = t.target_overlay.ov_source.s_disk_id in
|
|
|
46b2f6 |
+ let diskid_file = diskid_file_of_id id in
|
|
|
46b2f6 |
+ if not (wait_for_file diskid_file finalization_timeout) then
|
|
|
46b2f6 |
+ error (f_"transfer of disk %d/%d failed, see earlier error messages")
|
|
|
46b2f6 |
+ (i+1) nr_disks;
|
|
|
46b2f6 |
+ let diskid = read_whole_file diskid_file in
|
|
|
46b2f6 |
+ disks_uuids <- disks_uuids @ [diskid];
|
|
|
46b2f6 |
+
|
|
|
46b2f6 |
+ method create_metadata source targets _ guestcaps inspect target_firmware =
|
|
|
46b2f6 |
+ assert (List.length disks_uuids = List.length targets);
|
|
|
46b2f6 |
|
|
|
46b2f6 |
(* The storage domain UUID. *)
|
|
|
46b2f6 |
let sd_uuid =
|
|
|
46b2f6 |
@@ -411,7 +411,7 @@ If the messages above are not sufficient to diagnose the problem then add the
|
|
|
46b2f6 |
let ovf =
|
|
|
46b2f6 |
Create_ovf.create_ovf source targets guestcaps inspect
|
|
|
46b2f6 |
target_firmware output_alloc
|
|
|
46b2f6 |
- sd_uuid image_uuids vol_uuids vm_uuid
|
|
|
46b2f6 |
+ sd_uuid disks_uuids vol_uuids vm_uuid
|
|
|
46b2f6 |
OVirt in
|
|
|
46b2f6 |
let ovf = DOM.doc_to_string ovf in
|
|
|
46b2f6 |
|
|
|
46b2f6 |
--
|
|
|
5ce0c7 |
2.18.4
|
|
|
46b2f6 |
|