Blame SOURCES/0024-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch

e9bfca
From fb3e89b0fb2d0de3c12a668c00d07c5cfcac9ec0 Mon Sep 17 00:00:00 2001
151578
From: "Richard W.M. Jones" <rjones@redhat.com>
151578
Date: Thu, 14 Jan 2016 11:53:42 -0500
151578
Subject: [PATCH] RHEL 7: v2v: Disable the virt-v2v --in-place option.
151578
151578
This disables the virt-v2v --in-place option which we do not
151578
wish to support in RHEL.
151578
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
151578
---
151578
 v2v/Makefile.am          |   2 -
e9bfca
 v2v/cmdline.ml           |   8 +--
151578
 v2v/test-v2v-docs.sh     |   2 +-
e9bfca
 v2v/test-v2v-in-place.sh | 108 ---------------------------------------
e9bfca
 v2v/virt-v2v.pod         |  46 +----------------
e9bfca
 5 files changed, 7 insertions(+), 159 deletions(-)
151578
 delete mode 100755 v2v/test-v2v-in-place.sh
151578
151578
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
e9bfca
index 0c3224b24..424530b1d 100644
151578
--- a/v2v/Makefile.am
151578
+++ b/v2v/Makefile.am
e9bfca
@@ -330,7 +330,6 @@ if HAVE_LIBVIRT
151578
 TESTS += \
151578
 	test-v2v-cdrom.sh \
151578
 	test-v2v-floppy.sh \
151578
-	test-v2v-in-place.sh \
151578
 	test-v2v-networks-and-bridges.sh \
151578
 	test-v2v-no-copy.sh \
151578
 	test-v2v-o-glance.sh \
e9bfca
@@ -469,7 +468,6 @@ EXTRA_DIST += \
e9bfca
 	test-v2v-i-vmx-3.vmx \
e9bfca
 	test-v2v-i-vmx-4.vmx \
e9bfca
 	test-v2v-i-vmx-5.vmx \
151578
-	test-v2v-in-place.sh \
151578
 	test-v2v-machine-readable.sh \
151578
 	test-v2v-networks-and-bridges-expected.xml \
151578
 	test-v2v-networks-and-bridges.sh \
151578
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
e9bfca
index d6f99fa00..0bc5e9055 100644
151578
--- a/v2v/cmdline.ml
151578
+++ b/v2v/cmdline.ml
e9bfca
@@ -194,8 +194,7 @@ let parse_cmdline () =
e9bfca
                                     s_"Input format (for -i disk)";
e9bfca
     [ M"it" ],       Getopt.String ("transport", set_string_option_once "-it" input_transport),
e9bfca
                                     s_"Input transport";
e9bfca
-    [ L"in-place" ], Getopt.Set in_place,
e9bfca
-                                    s_"Only tune the guest in the input VM";
e9bfca
+    [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description;
e9bfca
     [ L"machine-readable" ], Getopt.Set machine_readable,
e9bfca
                                     s_"Make output machine readable";
e9bfca
     [ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
e9bfca
@@ -338,7 +337,6 @@ read the man page virt-v2v(1).
e9bfca
     printf "vddk\n";
e9bfca
     printf "colours-option\n";
e9bfca
     printf "vdsm-compat-option\n";
e9bfca
-    printf "in-place\n";
e9bfca
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
e9bfca
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
e9bfca
     List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
e9bfca
@@ -438,6 +436,10 @@ read the man page virt-v2v(1).
e9bfca
            error (f_"only ‘-it ssh’ can be used here") in
e9bfca
       Input_vmx.input_vmx input_transport arg in
151578
 
151578
+  (* Prevent use of --in-place option in RHEL. *)
151578
+  if in_place then
151578
+    error (f_"--in-place cannot be used in RHEL 7");
151578
+
151578
   (* Common error message. *)
151578
   let error_option_cannot_be_used_in_output_mode mode opt =
151578
     error (f_"-o %s: %s option cannot be used in this output mode") mode opt
151578
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
e9bfca
index 5d034c465..c8ca193eb 100755
151578
--- a/v2v/test-v2v-docs.sh
151578
+++ b/v2v/test-v2v-docs.sh
151578
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
151578
 skip_if_skipped
151578
 
151578
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
e9bfca
-  --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
e9bfca
+  --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
151578
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
151578
deleted file mode 100755
151578
index 6f7d78f39..000000000
151578
--- a/v2v/test-v2v-in-place.sh
151578
+++ /dev/null
151578
@@ -1,108 +0,0 @@
151578
-#!/bin/bash -
151578
-# libguestfs virt-v2v test script
151578
-# Copyright (C) 2014 Red Hat Inc.
151578
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
151578
-#
151578
-# This program is free software; you can redistribute it and/or modify
151578
-# it under the terms of the GNU General Public License as published by
151578
-# the Free Software Foundation; either version 2 of the License, or
151578
-# (at your option) any later version.
151578
-#
151578
-# This program is distributed in the hope that it will be useful,
151578
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
151578
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151578
-# GNU General Public License for more details.
151578
-#
151578
-# You should have received a copy of the GNU General Public License
151578
-# along with this program; if not, write to the Free Software
151578
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
151578
-
151578
-# Test --in-place.
151578
-
151578
-unset CDPATH
151578
-export LANG=C
151578
-set -e
151578
-
151578
-$TEST_FUNCTIONS
151578
-skip_if_skipped
151578
-skip_if_backend uml
151578
-skip_unless_phony_guest windows.img
151578
-
151578
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
151578
-
151578
-export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
151578
-export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
151578
-
151578
-d=$PWD/test-v2v-in-place.d
151578
-rm -rf $d
151578
-mkdir $d
151578
-
151578
-img="$d/test.qcow2"
151578
-rm -f $img
151578
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
151578
-md5="$(do_md5 $img_base)"
151578
-
151578
-libvirt_xml="$d/test.xml"
151578
-rm -f $libvirt_xml
151578
-n=windows-overlay
151578
-cat > $libvirt_xml <
151578
-<node>
151578
-  <domain type='test'>
151578
-    <name>$n</name>
151578
-    <memory>1048576</memory>
151578
-    <os>
151578
-      <type>hvm</type>
151578
-      <boot dev='hd'/>
151578
-    </os>
151578
-    <devices>
151578
-      <disk type='file' device='disk'>
151578
-        <driver name='qemu' type='qcow2'/>
151578
-        <source file='$img'/>
151578
-        <target dev='vda' bus='virtio'/>
151578
-      </disk>
151578
-    </devices>
151578
-  </domain>
151578
-</node>
151578
-EOF
151578
-
151578
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
151578
-
151578
-# Test that the drivers have been copied over into the guest
151578
-script="$d/test.fish"
151578
-expected="$d/expected"
151578
-response="$d/response"
151578
-
151578
-mktest ()
151578
-{
151578
-    local cmd="$1" exp="$2"
151578
-
151578
-    echo "echo '$cmd'" >> "$script"
151578
-    echo "$cmd" >> "$expected"
151578
-
151578
-    echo "$cmd" >> "$script"
151578
-    echo "$exp" >> "$expected"
151578
-}
151578
-
151578
-:> "$script"
151578
-:> "$expected"
151578
-
151578
-firstboot_dir="/Program Files/Guestfs/Firstboot"
151578
-mktest "is-dir \"$firstboot_dir\"" true
151578
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
151578
-mktest "is-dir \"$firstboot_dir/scripts\"" true
151578
-virtio_dir="/Windows/Drivers/VirtIO"
151578
-mktest "is-dir \"$virtio_dir\"" true
151578
-for drv in netkvm qxl vioscsi viostor; do
151578
-    for sfx in cat inf sys; do
151578
-        mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
151578
-    done
151578
-done
151578
-
151578
-guestfish --ro -a "$img" -i < "$script" > "$response"
151578
-diff -u "$expected" "$response"
151578
-
151578
-# Test the base image remained untouched
151578
-test "$md5" = "$(do_md5 $img_base)"
151578
-
151578
-# Clean up.
151578
-rm -r $d
151578
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
e9bfca
index f33f9bf62..0e0fa0f64 100644
151578
--- a/v2v/virt-v2v.pod
151578
+++ b/v2v/virt-v2v.pod
151578
@@ -15,8 +15,6 @@ virt-v2v - Convert a guest to use KVM
151578
 
151578
  virt-v2v -i disk disk.img -o glance
151578
 
151578
- virt-v2v -ic qemu:///system qemu_guest --in-place
151578
-
151578
 =head1 DESCRIPTION
151578
 
151578
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
e9bfca
@@ -162,9 +160,6 @@ booting the guest directly in qemu (mainly for testing).
151578
 I<-o rhv> is used to write to a RHV / oVirt target.  I<-o vdsm>
151578
 is only used when virt-v2v runs under VDSM control.
151578
 
151578
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
151578
-virtual machine, instead of creating a new VM in the target hypervisor.
151578
-
e9bfca
 =head1 OPTIONS
151578
 
e9bfca
 =over 4
e9bfca
@@ -278,20 +273,6 @@ For I<-i disk> only, this specifies the format of the input disk
151578
 image.  For other input methods you should specify the input
151578
 format in the metadata.
151578
 
151578
-=item B<--in-place>
151578
-
151578
-Do not create an output virtual machine in the target hypervisor.
151578
-Instead, adjust the guest OS in the source VM to run in the input
151578
-hypervisor.
151578
-
151578
-This mode is meant for integration with other toolsets, which take the
151578
-responsibility of converting the VM configuration, providing for
151578
-rollback in case of errors, transforming the storage, etc.
151578
-
151578
-See L</IN PLACE CONVERSION> below.
151578
-
151578
-Conflicts with all I<-o *> options.
151578
-
e9bfca
 =item B<-it> B<ssh>
151578
 
e9bfca
 When using I<-i vmx>, this enables the ssh transport.
e9bfca
@@ -1979,7 +1960,7 @@ Minimum free space: 10 MB
151578
 =head2 Minimum free space check in the host
151578
 
151578
 You must have sufficient free space in the host directory used to
151578
-store temporary overlays (except in I<--in-place> mode).  To find out
151578
+store temporary overlays.  To find out
151578
 which directory this is, use:
151578
 
151578
  $ df -h "`guestfish get-cachedir`"
e9bfca
@@ -2111,31 +2092,6 @@ that instead.
151578
    </devices>
151578
  </domain>
151578
 
151578
-=head1 IN PLACE CONVERSION
151578
-
151578
-It is also possible to use virt-v2v in scenarios where a foreign VM
151578
-has already been imported into a KVM-based hypervisor, but still needs
151578
-adjustments in the guest to make it run in the new virtual hardware.
151578
-
151578
-In that case it is assumed that a third-party tool has created the
151578
-target VM in the supported KVM-based hypervisor based on the source VM
151578
-configuration and contents, but using virtual devices more appropriate
151578
-for KVM (e.g. virtio storage and network, etc.).
151578
-
151578
-Then, to make the guest OS boot and run in the changed environment,
151578
-one can use:
151578
-
151578
- virt-v2v -ic qemu:///system converted_vm --in-place
151578
-
151578
-Virt-v2v will analyze the configuration of C<converted_vm> in the
151578
-C<qemu:///system> libvirt instance, and apply various fixups to the
151578
-guest OS configuration to make it match the VM configuration.  This
151578
-may include installing virtio drivers, configuring the bootloader, the
151578
-mountpoints, the network interfaces, and so on.
151578
-
151578
-Should an error occur during the operation, virt-v2v exits with an
151578
-error code leaving the VM in an undefined state.
151578
-
151578
 =head1 MACHINE READABLE OUTPUT
151578
 
151578
 The I<--machine-readable> option can be used to make the output more
151578
-- 
e9bfca
2.17.1
151578