Blob Blame History Raw
From e46c64da93c82c765a36c75df65094d0221f99fc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Jun 2016 11:18:43 +0100
Subject: [PATCH] p2v: virt-p2v-make-disk passes through --no-warn-if-partition
 to virt-builder.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1342337#c4

Thanks: Junqin Zhou
(cherry picked from commit 07137ea565653ca22e055cef09a08add6ad5f1c9)
---
 p2v/virt-p2v-make-disk.in  | 17 +++++++++++++----
 p2v/virt-p2v-make-disk.pod |  7 +++++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in
index d58e7f1..cbbc9ff 100644
--- a/p2v/virt-p2v-make-disk.in
+++ b/p2v/virt-p2v-make-disk.in
@@ -24,7 +24,7 @@ version="@PACKAGE_VERSION@"
 
 TEMP=`getopt \
         -o o:V \
-        --long help,inject-ssh-identity:,output:,verbose,version \
+        --long help,inject-ssh-identity:,no-warn-if-partition,output:,verbose,version \
         -n $program -- "$@"`
 if [ $? != 0 ]; then
     echo "$program: problem parsing the command line arguments"
@@ -35,6 +35,7 @@ eval set -- "$TEMP"
 output=
 upload=
 verbose=
+declare -a passthru
 
 usage ()
 {
@@ -57,11 +58,18 @@ while true; do
             set +x
             verbose=1
             shift;;
+
+        # virt-builder parameters that are passed through.
+        --no-warn-if-partition)
+            passthru[${#passthru[*]}]="$1"
+            shift;;
+
+        # help etc.
+        --help)
+            usage 0;;
         -V|--version)
             echo "$program $version"
             exit 0;;
-        --help)
-            usage 0;;
         --)
             shift
             break;;
@@ -206,7 +214,8 @@ virt-builder "$osversion"                                       \
         s/^[Login]/[Login]\nReserveVT=1\n/
     '                                                           \
     $upload                                                     \
-    $extra_args
+    $extra_args                                                 \
+    "${passthru[@]}"
 
 # We have to do this so the cleanup() handler runs.
 exit $?
diff --git a/p2v/virt-p2v-make-disk.pod b/p2v/virt-p2v-make-disk.pod
index d5a5db5..2e1bffb 100644
--- a/p2v/virt-p2v-make-disk.pod
+++ b/p2v/virt-p2v-make-disk.pod
@@ -99,6 +99,13 @@ Display help.
 Add an SSH identity (private key) file into the image.
 See L</ADDING AN SSH IDENTITY> above.
 
+=item B<--no-warn-if-partition>
+
+Normally you should not write to a partition on a USB drive (ie. don't
+use S<C<-o /dev/sdX1>>, use S<C<-o /dev/sdX>> to make a bootable USB
+drive).  If you do this, virt-builder prints a warning.  This option
+suppresses that warning.
+
 =item B<-o> OUTPUT
 
 =item B<--output> OUTPUT
-- 
1.8.3.1