mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0148-p2v-Remove-the-Enable-debugging-option-v-p2v.debug.patch

e76f14
From 9b713219612d9ad012729a98d58f033c2bb40ccf Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Wed, 6 Jul 2016 12:58:49 -0400
e76f14
Subject: [PATCH] p2v: Remove the Enable debugging option, -v, p2v.debug.
e76f14
e76f14
This is now enabled by default and cannot be changed/disabled by the
e76f14
user.  The output is saved into /tmp/.../virt-v2v-conversion-log.txt
e76f14
on the conversion server.
e76f14
e76f14
(cherry picked from commit 0c04919f50685c583842b48ca035626753e959e5)
e76f14
---
e76f14
 p2v/config.c     |  5 -----
e76f14
 p2v/conversion.c |  4 +---
e76f14
 p2v/gui.c        | 11 -----------
e76f14
 p2v/kernel.c     | 22 +++++++++-------------
e76f14
 p2v/main.c       |  4 +++-
e76f14
 p2v/p2v.h        |  7 -------
e76f14
 p2v/ssh.c        |  7 +++----
e76f14
 p2v/utils.c      | 10 +++++-----
e76f14
 p2v/virt-p2v.pod | 19 ++-----------------
e76f14
 9 files changed, 23 insertions(+), 66 deletions(-)
e76f14
e76f14
diff --git a/p2v/config.c b/p2v/config.c
e76f14
index 79b7e4d..40c758e 100644
e76f14
--- a/p2v/config.c
e76f14
+++ b/p2v/config.c
e76f14
@@ -40,9 +40,6 @@ new_config (void)
e76f14
     exit (EXIT_FAILURE);
e76f14
   }
e76f14
 
e76f14
-#if FORCE_REMOTE_DEBUG
e76f14
-  c->verbose = 1;
e76f14
-#endif
e76f14
   c->port = 22;
e76f14
 
e76f14
   c->output_allocation = OUTPUT_ALLOCATION_NONE;
e76f14
@@ -119,8 +116,6 @@ print_config (struct config *config, FILE *fp)
e76f14
   fprintf (fp, "local version   .  %s\n", PACKAGE_VERSION_FULL);
e76f14
   fprintf (fp, "remote version  .  %s\n",
e76f14
            v2v_version ? v2v_version : "unknown");
e76f14
-  fprintf (fp, "remote debugging   %s\n",
e76f14
-           config->verbose ? "true" : "false");
e76f14
   fprintf (fp, "conversion server  %s\n",
e76f14
            config->server ? config->server : "none");
e76f14
   fprintf (fp, "port . . . . . .   %d\n", config->port);
e76f14
diff --git a/p2v/conversion.c b/p2v/conversion.c
e76f14
index 484c0e4..2d125a8 100644
e76f14
--- a/p2v/conversion.c
e76f14
+++ b/p2v/conversion.c
e76f14
@@ -960,9 +960,7 @@ generate_wrapper_script (struct config *config, const char *remote_dir,
e76f14
   fprintf (fp, "{\n");
e76f14
   if (config->sudo)
e76f14
     fprintf (fp, "sudo -n ");
e76f14
-  fprintf (fp, "virt-v2v");
e76f14
-  if (config->verbose)
e76f14
-    fprintf (fp, " -v -x");
e76f14
+  fprintf (fp, "virt-v2v -v -x");
e76f14
   if (feature_colours_option)
e76f14
     fprintf (fp, " --colours");
e76f14
   fprintf (fp, " -i libvirtxml");
e76f14
diff --git a/p2v/gui.c b/p2v/gui.c
e76f14
index 9e9043a..e0b455a 100644
e76f14
--- a/p2v/gui.c
e76f14
+++ b/p2v/gui.c
e76f14
@@ -63,7 +63,6 @@ static GtkWidget *conv_dlg,
e76f14
   *vcpus_warning, *memory_warning, *target_warning_label,
e76f14
   *o_combo, *oc_entry, *os_entry, *of_entry, *oa_combo,
e76f14
   *info_label,
e76f14
-  *debug_button,
e76f14
   *disks_list, *removable_list, *interfaces_list,
e76f14
   *start_button;
e76f14
 
e76f14
@@ -674,14 +673,7 @@ create_conversion_dialog (struct config *config)
e76f14
   gtk_table_attach (GTK_TABLE (output_tbl), oa_combo,
e76f14
                     1, 2, 4, 5, GTK_FILL, GTK_FILL, 1, 1);
e76f14
 
e76f14
-  debug_button =
e76f14
-    gtk_check_button_new_with_label (_("Enable server-side debugging\n"
e76f14
-                                       "(This is saved in /tmp on the conversion server)"));
e76f14
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (debug_button),
e76f14
-                                config->verbose);
e76f14
-
e76f14
   gtk_box_pack_start (GTK_BOX (output_vbox), output_tbl, TRUE, TRUE, 0);
e76f14
-  gtk_box_pack_start (GTK_BOX (output_vbox), debug_button, TRUE, TRUE, 0);
e76f14
   gtk_container_add (GTK_CONTAINER (output_frame), output_vbox);
e76f14
 
e76f14
   info_frame = gtk_frame_new (_("Information"));
e76f14
@@ -1688,9 +1680,6 @@ start_conversion_clicked (GtkWidget *w, gpointer data)
e76f14
   config->vcpus = get_vcpus_from_conv_dlg ();
e76f14
   config->memory = get_memory_from_conv_dlg ();
e76f14
 
e76f14
-  config->verbose =
e76f14
-    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (debug_button));
e76f14
-
e76f14
   /* Get the list of disks to be converted. */
e76f14
   set_disks_from_ui (config);
e76f14
 
e76f14
diff --git a/p2v/kernel.c b/p2v/kernel.c
e76f14
index 6914ab5..455af3e 100644
e76f14
--- a/p2v/kernel.c
e76f14
+++ b/p2v/kernel.c
e76f14
@@ -35,17 +35,13 @@
e76f14
 #include "p2v.h"
e76f14
 
e76f14
 static void notify_ui_callback (int type, const char *data);
e76f14
-static void run_command (int verbose, const char *stage, const char *command);
e76f14
+static void run_command (const char *stage, const char *command);
e76f14
 
e76f14
 void
e76f14
 update_config_from_kernel_cmdline (struct config *config, char **cmdline)
e76f14
 {
e76f14
   const char *p;
e76f14
 
e76f14
-  p = get_cmdline_key (cmdline, "p2v.debug");
e76f14
-  if (p)
e76f14
-    config->verbose = 1;
e76f14
-
e76f14
   p = get_cmdline_key (cmdline, "p2v.server");
e76f14
   if (p) {
e76f14
     free (config->server);
e76f14
@@ -212,7 +208,7 @@ kernel_conversion (struct config *config, char **cmdline, int cmdline_source)
e76f14
   /* Pre-conversion command. */
e76f14
   p = get_cmdline_key (cmdline, "p2v.pre");
e76f14
   if (p)
e76f14
-    run_command (config->verbose, "p2v.pre", p);
e76f14
+    run_command ("p2v.pre", p);
e76f14
 
e76f14
   /* Connect to and interrogate virt-v2v on the conversion server. */
e76f14
   p = get_cmdline_key (cmdline, "p2v.skip_test_connection");
e76f14
@@ -245,7 +241,7 @@ kernel_conversion (struct config *config, char **cmdline, int cmdline_source)
e76f14
 
e76f14
     p = get_cmdline_key (cmdline, "p2v.fail");
e76f14
     if (p)
e76f14
-      run_command (config->verbose, "p2v.fail", p);
e76f14
+      run_command ("p2v.fail", p);
e76f14
 
e76f14
     exit (EXIT_FAILURE);
e76f14
   }
e76f14
@@ -261,7 +257,7 @@ kernel_conversion (struct config *config, char **cmdline, int cmdline_source)
e76f14
       p = "poweroff";
e76f14
   }
e76f14
   if (p)
e76f14
-    run_command (config->verbose, "p2v.post", p);
e76f14
+    run_command ("p2v.post", p);
e76f14
 }
e76f14
 
e76f14
 static void
e76f14
@@ -300,17 +296,17 @@ notify_ui_callback (int type, const char *data)
e76f14
 }
e76f14
 
e76f14
 static void
e76f14
-run_command (int verbose, const char *stage, const char *command)
e76f14
+run_command (const char *stage, const char *command)
e76f14
 {
e76f14
   int r;
e76f14
 
e76f14
   if (STREQ (command, ""))
e76f14
     return;
e76f14
 
e76f14
-  if (verbose) {
e76f14
-    printf ("%s\n", command);
e76f14
-    fflush (stdout);
e76f14
-  }
e76f14
+#if DEBUG_STDERR
e76f14
+  fprintf (stderr, "%s\n", command);
e76f14
+  fflush (stderr);
e76f14
+#endif
e76f14
 
e76f14
   r = system (command);
e76f14
   if (r == -1) {
e76f14
diff --git a/p2v/main.c b/p2v/main.c
e76f14
index c5ab233..4441b99 100644
e76f14
--- a/p2v/main.c
e76f14
+++ b/p2v/main.c
e76f14
@@ -181,7 +181,9 @@ main (int argc, char *argv[])
e76f14
       break;
e76f14
 
e76f14
     case 'v':
e76f14
-      config->verbose = 1;
e76f14
+      /* This option does nothing since 1.33.41.  Verbose is always
e76f14
+       * enabled.
e76f14
+       */
e76f14
       break;
e76f14
 
e76f14
     case 'V':
e76f14
diff --git a/p2v/p2v.h b/p2v/p2v.h
e76f14
index da30340..1282a17 100644
e76f14
--- a/p2v/p2v.h
e76f14
+++ b/p2v/p2v.h
e76f14
@@ -26,12 +26,6 @@
e76f14
  */
e76f14
 #define DEBUG_STDERR 1
e76f14
 
e76f14
-/* Force remote debugging even if user doesn't enable it.  Since
e76f14
- * remote debugging is mostly free, we might as well enable this even
e76f14
- * in production.
e76f14
- */
e76f14
-#define FORCE_REMOTE_DEBUG 1
e76f14
-
e76f14
 #include "miniexpect.h"
e76f14
 
e76f14
 /* We don't use libguestfs directly here, and we don't link to it
e76f14
@@ -66,7 +60,6 @@ extern int force_colour;
e76f14
 
e76f14
 /* config.c */
e76f14
 struct config {
e76f14
-  int verbose;
e76f14
   char *server;
e76f14
   int port;
e76f14
   char *username;
e76f14
diff --git a/p2v/ssh.c b/p2v/ssh.c
e76f14
index 4cae732..7507ed6 100644
e76f14
--- a/p2v/ssh.c
e76f14
+++ b/p2v/ssh.c
e76f14
@@ -374,7 +374,7 @@ start_ssh (unsigned spawn_flags, struct config *config,
e76f14
   args[j++] = NULL;
e76f14
   assert (j == nr_args);
e76f14
 
e76f14
-#if DEBUG_STDERR && 0
e76f14
+#if DEBUG_STDERR
e76f14
   fputs ("ssh command: ", stderr);
e76f14
   for (i = 0; i < nr_args - 1; ++i) {
e76f14
     if (i > 0) fputc (' ', stderr);
e76f14
@@ -583,6 +583,7 @@ scp_file (struct config *config, const char *localfile, const char *remotefile)
e76f14
   const int ovecsize = 12;
e76f14
   int ovector[ovecsize];
e76f14
   int using_password_auth;
e76f14
+  size_t i;
e76f14
 
e76f14
   if (cache_ssh_identity (config) == -1)
e76f14
     return -1;
e76f14
@@ -631,9 +632,7 @@ scp_file (struct config *config, const char *localfile, const char *remotefile)
e76f14
   args[j++] = NULL;
e76f14
   assert (j == nr_args);
e76f14
 
e76f14
-#if DEBUG_STDERR && 0
e76f14
-  size_t i;
e76f14
-
e76f14
+#if DEBUG_STDERR
e76f14
   fputs ("scp command: ", stderr);
e76f14
   for (i = 0; i < nr_args - 1; ++i) {
e76f14
     if (i > 0) fputc (' ', stderr);
e76f14
diff --git a/p2v/utils.c b/p2v/utils.c
e76f14
index c9fbd2f..71f5916 100644
e76f14
--- a/p2v/utils.c
e76f14
+++ b/p2v/utils.c
e76f14
@@ -247,11 +247,11 @@ get_if_vendor (const char *if_name, int truncate)
e76f14
 void
e76f14
 wait_network_online (const struct config *config)
e76f14
 {
e76f14
-  if (config->verbose) {
e76f14
-    printf ("waiting for the network to come online ...\n");
e76f14
-    printf ("%s\n", NETWORK_ONLINE_COMMAND);
e76f14
-    fflush (stdout);
e76f14
-  }
e76f14
+#ifdef DEBUG_STDERR
e76f14
+  fprintf (stderr, "waiting for the network to come online ...\n");
e76f14
+  fprintf (stderr, "%s\n", NETWORK_ONLINE_COMMAND);
e76f14
+  fflush (stderr);
e76f14
+#endif
e76f14
 
e76f14
   ignore_value (system (NETWORK_ONLINE_COMMAND));
e76f14
 }
e76f14
diff --git a/p2v/virt-p2v.pod b/p2v/virt-p2v.pod
e76f14
index ef6a9db..6532240 100644
e76f14
--- a/p2v/virt-p2v.pod
e76f14
+++ b/p2v/virt-p2v.pod
e76f14
@@ -177,14 +177,6 @@ first-time virt-p2v user.
e76f14
 All output options and paths are relative to the conversion server
e76f14
 (I<not> to the physical server).
e76f14
 
e76f14
-The final option in this panel enables server-side debugging.  This
e76f14
-produces a lot of output, but is essential if you are tracking down
e76f14
-virt-p2v or virt-v2v problems, and can generally be left enabled:
e76f14
-
e76f14
- │
e76f14
- │ [✔] Enable server-side debugging
e76f14
- │
e76f14
-
e76f14
 Finally in the left hand column is an information box giving the
e76f14
 version of virt-p2v (on the physical server) and virt-v2v (on the
e76f14
 conversion server).  You should supply this information when reporting
e76f14
@@ -371,14 +363,6 @@ C<p2v.memory=1G>.
e76f14
 The default is to use the same amount of RAM as on the physical
e76f14
 machine.
e76f14
 
e76f14
-=item B<p2v.debug>
e76f14
-
e76f14
-Use this to enable full debugging of virt-v2v.
e76f14
-
e76f14
-If asked to diagnose a problem with virt-p2v, you should add
e76f14
-C<p2v.debug> to the kernel command line, and examine the log file
e76f14
-which is left in F</tmp> on the conversion server.
e76f14
-
e76f14
 =item B<p2v.disks=sdX,sdY,..>
e76f14
 
e76f14
 A list of physical hard disks to convert, for example:
e76f14
@@ -615,7 +599,8 @@ features such as the Reboot button.
e76f14
 
e76f14
 =item B<--verbose>
e76f14
 
e76f14
-Enable debugging (on the conversion server).
e76f14
+In libguestfs E<ge> 1.33.41, debugging is always enabled on the
e76f14
+conversion server, and this option does nothing.
e76f14
 
e76f14
 =item B<-V>
e76f14
 
e76f14
-- 
7af31e
1.8.3.1
e76f14