virt-v2v/0024-v2v-Send-nbdinfo-debug...

53 lines
1.8 KiB
Diff

From aef0dcabe2257c234e1acb745f016b61824af014 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 25 Jan 2022 10:39:49 +0000
Subject: [PATCH] v2v: Send nbdinfo debug information to stderr not stdout
When running in verbose mode (virt-v2v -vx) debug messages are
supposed to only be written to stderr. This allows virt-p2v and other
wrappers to separate ordinary progress messages and warnings, from
debugging information.
However when we added nbdinfo output (only printed in verbose mode),
the output was wrongly sent to stdout instead of stderr. You can show
this as follows:
$ virt-v2v -vx -i disk /var/tmp/fedora-35.qcow2 -o null 2>/dev/null
[ 0.0] Setting up the source: -i disk /var/tmp/fedora-35.qcow2
[ 1.0] Opening the source
... some messages elided ...
protocol: newstyle-fixed without TLS <-- debug output to stdout
export="":
export-size: 6442450944 (6G)
content: DOS/MBR boot sector
uri: nbd+unix:///?socket=/tmp/v2v.Xqvaml/in0
... etc ...
This patch sends the nbdinfo debugging output to stderr instead.
Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2044922
Fixes: commit 255722cbf39afc0b012e2ac00d16fa6ba2f8c21f
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 68af35d48ca845133ede948d36ee351d171e3de8)
---
v2v/v2v.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1c74f01f..92546940 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -616,7 +616,7 @@ and nbdcopy output_alloc input_uri output_uri =
*)
and nbdinfo ?(content = false) uri =
let cmd =
- sprintf "nbdinfo%s %s"
+ sprintf "nbdinfo%s %s >&2"
(if content then " --content" else " --no-content") (quote uri) in
ignore (Sys.command cmd)
--
2.19.1.3.g30247aa5d201