After finalizing the transfer, virt-v2v try to connect to the output
socket and query disk allocation. This may work for some outputs
supporting block status, but for rhv_upload output this cannot work for
2 reasons:
- The rhv-upload-plugin does not support extents
- The transfer was finalized before this call, so the plugin lost access
to the image.
Here is an example failure log:
[ 74.2] Creating output metadata
python3 '/tmp/v2v.WMq8Tk/rhv-upload-finalize.py'
'/tmp/v2v.WMq8Tk/params6.json'
finalizing transfer b03fe3ba-a4ff-4634-a0a0-10b3daba3cc2
...
transfer b03fe3ba-a4ff-4634-a0a0-10b3daba3cc2 finalized in 2.118 seconds
...
nbdkit: debug: accepted connection
...
nbdkit: python[4]: debug: python: close
virt-v2v: error: exception: NBD.Error("nbd_block_status: request out of
bounds: Invalid argument", 22)
Fix by using the input socket.
---
lib/utils.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils.ml b/lib/utils.ml
index d6861d08..f6c85543 100644
--- a/lib/utils.ml
+++ b/lib/utils.ml
@@ -171,21 +171,21 @@ let with_nbd_connect_unix ~socket ~meta_contexts ~f =
~f:(fun () ->
List.iter (NBD.add_meta_context nbd) meta_contexts;
NBD.connect_unix nbd socket;
protect
~f:(fun () -> f nbd)
~finally:(fun () -> NBD.shutdown nbd)
)
~finally:(fun () -> NBD.close nbd)
let get_disk_allocated ~dir ~disknr =
- let socket = sprintf "%s/out%d" dir disknr
+ let socket = sprintf "%s/in%d" dir disknr
and alloc_ctx = "base:allocation" in
with_nbd_connect_unix ~socket ~meta_contexts:[alloc_ctx]
~f:(fun nbd ->
if NBD.can_meta_context nbd alloc_ctx then (
(* Get the list of extents, using a 2GiB chunk size as hint. *)
let size = NBD.get_size nbd
and allocated = ref 0_L
and fetch_offset = ref 0_L in
while !fetch_offset < size do
let remaining = size -^ !fetch_offset in
--
2.33.1