mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0116-p2v-Display-up-to-50-lines-of-the-virt-v2v-conversio.patch

e76f14
From d1f7ebc29a819c4ff1156169fa3a04efa7046685 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Mon, 20 Jun 2016 09:56:48 +0100
e76f14
Subject: [PATCH] p2v: Display up to 50 lines of the virt-v2v conversion log on
e76f14
 failure.
e76f14
e76f14
For some failures, 30 lines was not sufficient and only part of the
e76f14
error was shown.  Increase the number of lines shown to 50.
e76f14
e76f14
This also colourizes the failure message, and prominently displays the
e76f14
location of the full log.  The following message is now shown:
e76f14
e76f14
  *** virt-v2v command failed ***
e76f14
e76f14
  The full log is available on the conversion server in:
e76f14
      /tmp/virt-p2v-20160620-sga9rhk7/virt-v2v-conversion-log.txt
e76f14
  Only the last 50 lines are shown below.
e76f14
e76f14
  [followed by up to 50 lines of log]
e76f14
e76f14
Updates and fixes commit 7447fe2478e49f5121a40db973f8a1fb1daaec53.
e76f14
e76f14
(cherry picked from commit 6f5abc9539a4d47c98898b4c491d6b017d9abbbb)
e76f14
---
e76f14
 p2v/conversion.c | 16 +++++++++++++---
e76f14
 1 file changed, 13 insertions(+), 3 deletions(-)
e76f14
e76f14
diff --git a/p2v/conversion.c b/p2v/conversion.c
e76f14
index a7d1f11..fe18b4a 100644
e76f14
--- a/p2v/conversion.c
e76f14
+++ b/p2v/conversion.c
e76f14
@@ -1045,9 +1045,19 @@ generate_wrapper_script (struct config *config, const char *remote_dir)
e76f14
            "    echo\n"
e76f14
            "    echo\n"
e76f14
            "    echo\n"
e76f14
-           "    echo '*** virt-v2v command failed ***'\n"
e76f14
-           "    tail -30 $log\n"
e76f14
-           "fi\n");
e76f14
+           "    echo -ne '\\e[1;31m'\n"
e76f14
+           "    echo '***' virt-v2v command failed '***'\n"
e76f14
+           "    echo\n"
e76f14
+           "    echo The full log is available on the conversion server in:\n"
e76f14
+           "    echo '   ' %s/$log\n"
e76f14
+           "    echo Only the last 50 lines are shown below.\n"
e76f14
+           "    echo -ne '\\e[0m'\n"
e76f14
+           "    echo\n"
e76f14
+           "    echo\n"
e76f14
+           "    echo\n"
e76f14
+           "    tail -50 $log\n"
e76f14
+           "fi\n",
e76f14
+           remote_dir);
e76f14
 
e76f14
   fclose (fp);
e76f14
 
e76f14
-- 
e76f14
1.8.3.1
e76f14