virt-v2v/0005-o-rhv-upload-Dump-the-JSON-before-parsing.patch
Richard W.M. Jones 1d87979efe Fix RHV JSON transfer bug
resolves: RHEL-32105
2024-04-08 16:00:57 +01:00

35 lines
1.6 KiB
Diff

From 19ac262ceb03db2bf53a63302673d328737523de Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 5 Apr 2024 22:13:40 +0100
Subject: [PATCH] -o rhv-upload: Dump the JSON before parsing
Related: https://github.com/libguestfs/virt-v2v/issues/46
---
output/output_rhv_upload.ml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/output/output_rhv_upload.ml b/output/output_rhv_upload.ml
index 3926cfee..7a148b1e 100644
--- a/output/output_rhv_upload.ml
+++ b/output/output_rhv_upload.ml
@@ -273,6 +273,9 @@ See also the virt-v2v-output-rhv(1) manual.");
if Python_script.run_command ~stdout_fd:fd
precheck_script json_params [] <> 0 then
error (f_"failed server prechecks, see earlier errors");
+ if verbose () then
+ debug "precheck output before parsing: %s"
+ (read_whole_file precheck_json);
let json = JSON_parser.json_parser_tree_parse_file precheck_json in
debug "precheck output parsed as: %s"
(JSON.string_of_doc ~fmt:JSON.Indented ["", json]);
@@ -396,6 +399,9 @@ See also the virt-v2v-output-rhv(1) manual.");
if Python_script.run_command ~stdout_fd:fd
transfer_script json_params [] <> 0 then
error (f_"failed to start transfer, see earlier errors");
+ if verbose () then
+ debug "transfer output before parsing: %s"
+ (read_whole_file transfer_json);
let json = JSON_parser.json_parser_tree_parse_file transfer_json in
debug "transfer output parsed as: %s"
(JSON.string_of_doc ~fmt:JSON.Indented ["", json]);