Blame SOURCES/0018-RHEL-8-v2v-Disable-the-virt-v2v-in-place-option.patch

62f9b7
From d55dcb095a383ff924acbfbe1c81a3a1eb4f4495 Mon Sep 17 00:00:00 2001
62f9b7
From: "Richard W.M. Jones" <rjones@redhat.com>
62f9b7
Date: Thu, 14 Jan 2016 11:53:42 -0500
62f9b7
Subject: [PATCH] RHEL 8: v2v: Disable the virt-v2v --in-place option.
62f9b7
62f9b7
This disables the virt-v2v --in-place option which we do not
62f9b7
wish to support in RHEL.
62f9b7
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
62f9b7
---
62f9b7
 docs/test-v2v-docs.sh      |   1 +
62f9b7
 docs/virt-v2v.pod          |  48 +----------------
62f9b7
 tests/Makefile.am          |   2 -
62f9b7
 tests/test-v2v-in-place.sh | 108 -------------------------------------
62f9b7
 v2v/cmdline.ml             |   8 +--
62f9b7
 5 files changed, 7 insertions(+), 160 deletions(-)
62f9b7
 delete mode 100755 tests/test-v2v-in-place.sh
62f9b7
62f9b7
diff --git a/docs/test-v2v-docs.sh b/docs/test-v2v-docs.sh
62f9b7
index dd2b1233..8fef46cc 100755
62f9b7
--- a/docs/test-v2v-docs.sh
62f9b7
+++ b/docs/test-v2v-docs.sh
62f9b7
@@ -27,6 +27,7 @@ $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
62f9b7
 --debug-overlay,\
62f9b7
 --ic,\
62f9b7
 --if,\
62f9b7
+--in-place,\
62f9b7
 --io,\
62f9b7
 --ip,\
62f9b7
 --it,\
62f9b7
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
62f9b7
index a19f0a73..6f9f323e 100644
62f9b7
--- a/docs/virt-v2v.pod
62f9b7
+++ b/docs/virt-v2v.pod
62f9b7
@@ -8,10 +8,6 @@ virt-v2v - Convert a guest to use KVM
62f9b7
           [-o mode] [other -o* options]
62f9b7
           [guest|filename]
62f9b7
 
62f9b7
- virt-v2v --in-place
62f9b7
-          [-i mode] [other -i* options]
62f9b7
-          [guest|filename]
62f9b7
-
62f9b7
 =head1 DESCRIPTION
62f9b7
 
62f9b7
 Virt-v2v converts a single guest from a foreign hypervisor to run on
62f9b7
@@ -39,9 +35,6 @@ these sides of virt-v2v are documented separately in this manual.
62f9b7
 
62f9b7
 Virt-v2v normally copies from the input to the output, called "copying
62f9b7
 mode".  In this case the source guest is always left unchanged.
62f9b7
-In-place conversion (I<--in-place>) only uses the I<-i*> options and
62f9b7
-modifies the source guest in-place.  (See L</In-place conversion>
62f9b7
-below.)
62f9b7
 
62f9b7
 =head2 Other virt-v2v topics
62f9b7
 
62f9b7
@@ -301,20 +294,6 @@ For I<-i disk> only, this specifies the format of the input disk
62f9b7
 image.  For other input methods you should specify the input
62f9b7
 format in the metadata.
62f9b7
 
62f9b7
-=item B<--in-place>
62f9b7
-
62f9b7
-Do not create an output virtual machine in the target hypervisor.
62f9b7
-Instead, adjust the guest OS in the source VM to run in the input
62f9b7
-hypervisor.
62f9b7
-
62f9b7
-This mode is meant for integration with other toolsets, which take the
62f9b7
-responsibility of converting the VM configuration, providing for
62f9b7
-rollback in case of errors, transforming the storage, etc.
62f9b7
-
62f9b7
-See L</In-place conversion> below.
62f9b7
-
62f9b7
-Conflicts with all I<-o *> options.
62f9b7
-
62f9b7
 =item B<-io> OPTION=VALUE
62f9b7
 
62f9b7
 Set input option(s) related to the current input mode or transport.
62f9b7
@@ -1332,7 +1311,7 @@ have at least 100 available inodes.
62f9b7
 =head3 Minimum free space check in the host
62f9b7
 
62f9b7
 You must have sufficient free space in the host directory used to
62f9b7
-store temporary overlays (except in I<--in-place> mode).  To find out
62f9b7
+store temporary overlays.  To find out
62f9b7
 which directory this is, use:
62f9b7
 
62f9b7
  $ df -h "`guestfish get-cachedir`"
62f9b7
@@ -1435,31 +1414,6 @@ that instead.
62f9b7
    </devices>
62f9b7
  </domain>
62f9b7
 
62f9b7
-=head2 In-place conversion
62f9b7
-
62f9b7
-It is also possible to use virt-v2v in scenarios where a foreign VM
62f9b7
-has already been imported into a KVM-based hypervisor, but still needs
62f9b7
-adjustments in the guest to make it run in the new virtual hardware.
62f9b7
-
62f9b7
-In that case it is assumed that a third-party tool has created the
62f9b7
-target VM in the supported KVM-based hypervisor based on the source VM
62f9b7
-configuration and contents, but using virtual devices more appropriate
62f9b7
-for KVM (e.g. virtio storage and network, etc.).
62f9b7
-
62f9b7
-Then, to make the guest OS boot and run in the changed environment,
62f9b7
-one can use:
62f9b7
-
62f9b7
- virt-v2v -ic qemu:///system converted_vm --in-place
62f9b7
-
62f9b7
-Virt-v2v will analyze the configuration of C<converted_vm> in the
62f9b7
-C<qemu:///system> libvirt instance, and apply various fixups to the
62f9b7
-guest OS configuration to make it match the VM configuration.  This
62f9b7
-may include installing virtio drivers, configuring the bootloader, the
62f9b7
-mountpoints, the network interfaces, and so on.
62f9b7
-
62f9b7
-Should an error occur during the operation, virt-v2v exits with an
62f9b7
-error code leaving the VM in an undefined state.
62f9b7
-
62f9b7
 =head2 Machine readable output
62f9b7
 
62f9b7
 The I<--machine-readable> option can be used to make the output more
62f9b7
diff --git a/tests/Makefile.am b/tests/Makefile.am
62f9b7
index 871dc3c9..eee4e1af 100644
62f9b7
--- a/tests/Makefile.am
62f9b7
+++ b/tests/Makefile.am
62f9b7
@@ -76,7 +76,6 @@ TESTS = \
62f9b7
 	test-v2v-floppy.sh \
62f9b7
 	test-v2v-i-disk.sh \
62f9b7
 	test-v2v-i-ova.sh \
62f9b7
-	test-v2v-in-place.sh \
62f9b7
 	test-v2v-mac.sh \
62f9b7
 	test-v2v-machine-readable.sh \
62f9b7
 	test-v2v-networks-and-bridges.sh \
62f9b7
@@ -225,7 +224,6 @@ EXTRA_DIST += \
62f9b7
 	test-v2v-i-vmx-3.vmx \
62f9b7
 	test-v2v-i-vmx-4.vmx \
62f9b7
 	test-v2v-i-vmx-5.vmx \
62f9b7
-	test-v2v-in-place.sh \
62f9b7
 	test-v2v-it-vddk-io-query.sh \
62f9b7
 	test-v2v-machine-readable.sh \
62f9b7
 	test-v2v-mac-expected.xml \
62f9b7
diff --git a/tests/test-v2v-in-place.sh b/tests/test-v2v-in-place.sh
62f9b7
deleted file mode 100755
62f9b7
index 6f7d78f3..00000000
62f9b7
--- a/tests/test-v2v-in-place.sh
62f9b7
+++ /dev/null
62f9b7
@@ -1,108 +0,0 @@
62f9b7
-#!/bin/bash -
62f9b7
-# libguestfs virt-v2v test script
62f9b7
-# Copyright (C) 2014 Red Hat Inc.
62f9b7
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
62f9b7
-#
62f9b7
-# This program is free software; you can redistribute it and/or modify
62f9b7
-# it under the terms of the GNU General Public License as published by
62f9b7
-# the Free Software Foundation; either version 2 of the License, or
62f9b7
-# (at your option) any later version.
62f9b7
-#
62f9b7
-# This program is distributed in the hope that it will be useful,
62f9b7
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
62f9b7
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62f9b7
-# GNU General Public License for more details.
62f9b7
-#
62f9b7
-# You should have received a copy of the GNU General Public License
62f9b7
-# along with this program; if not, write to the Free Software
62f9b7
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
62f9b7
-
62f9b7
-# Test --in-place.
62f9b7
-
62f9b7
-unset CDPATH
62f9b7
-export LANG=C
62f9b7
-set -e
62f9b7
-
62f9b7
-$TEST_FUNCTIONS
62f9b7
-skip_if_skipped
62f9b7
-skip_if_backend uml
62f9b7
-skip_unless_phony_guest windows.img
62f9b7
-
62f9b7
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
62f9b7
-
62f9b7
-export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
62f9b7
-export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
62f9b7
-
62f9b7
-d=$PWD/test-v2v-in-place.d
62f9b7
-rm -rf $d
62f9b7
-mkdir $d
62f9b7
-
62f9b7
-img="$d/test.qcow2"
62f9b7
-rm -f $img
62f9b7
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
62f9b7
-md5="$(do_md5 $img_base)"
62f9b7
-
62f9b7
-libvirt_xml="$d/test.xml"
62f9b7
-rm -f $libvirt_xml
62f9b7
-n=windows-overlay
62f9b7
-cat > $libvirt_xml <
62f9b7
-<node>
62f9b7
-  <domain type='test'>
62f9b7
-    <name>$n</name>
62f9b7
-    <memory>1048576</memory>
62f9b7
-    <os>
62f9b7
-      <type>hvm</type>
62f9b7
-      <boot dev='hd'/>
62f9b7
-    </os>
62f9b7
-    <devices>
62f9b7
-      <disk type='file' device='disk'>
62f9b7
-        <driver name='qemu' type='qcow2'/>
62f9b7
-        <source file='$img'/>
62f9b7
-        <target dev='vda' bus='virtio'/>
62f9b7
-      </disk>
62f9b7
-    </devices>
62f9b7
-  </domain>
62f9b7
-</node>
62f9b7
-EOF
62f9b7
-
62f9b7
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
62f9b7
-
62f9b7
-# Test that the drivers have been copied over into the guest
62f9b7
-script="$d/test.fish"
62f9b7
-expected="$d/expected"
62f9b7
-response="$d/response"
62f9b7
-
62f9b7
-mktest ()
62f9b7
-{
62f9b7
-    local cmd="$1" exp="$2"
62f9b7
-
62f9b7
-    echo "echo '$cmd'" >> "$script"
62f9b7
-    echo "$cmd" >> "$expected"
62f9b7
-
62f9b7
-    echo "$cmd" >> "$script"
62f9b7
-    echo "$exp" >> "$expected"
62f9b7
-}
62f9b7
-
62f9b7
-:> "$script"
62f9b7
-:> "$expected"
62f9b7
-
62f9b7
-firstboot_dir="/Program Files/Guestfs/Firstboot"
62f9b7
-mktest "is-dir \"$firstboot_dir\"" true
62f9b7
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
62f9b7
-mktest "is-dir \"$firstboot_dir/scripts\"" true
62f9b7
-virtio_dir="/Windows/Drivers/VirtIO"
62f9b7
-mktest "is-dir \"$virtio_dir\"" true
62f9b7
-for drv in netkvm qxl vioscsi viostor; do
62f9b7
-    for sfx in cat inf sys; do
62f9b7
-        mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
62f9b7
-    done
62f9b7
-done
62f9b7
-
62f9b7
-guestfish --ro -a "$img" -i < "$script" > "$response"
62f9b7
-diff -u "$expected" "$response"
62f9b7
-
62f9b7
-# Test the base image remained untouched
62f9b7
-test "$md5" = "$(do_md5 $img_base)"
62f9b7
-
62f9b7
-# Clean up.
62f9b7
-rm -r $d
62f9b7
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
62f9b7
index df69e2e0..7b79d462 100644
62f9b7
--- a/v2v/cmdline.ml
62f9b7
+++ b/v2v/cmdline.ml
62f9b7
@@ -252,8 +252,7 @@ let parse_cmdline () =
62f9b7
                                     s_"Use password from file to connect to input hypervisor";
62f9b7
     [ M"it" ],       Getopt.String ("transport", set_string_option_once "-it" input_transport),
62f9b7
                                     s_"Input transport";
62f9b7
-    [ L"in-place" ], Getopt.Set in_place,
62f9b7
-                                    s_"Only tune the guest in the input VM";
62f9b7
+    [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description;
62f9b7
     [ L"mac" ],      Getopt.String ("mac:network|bridge|ip:out", add_mac),
62f9b7
                                     s_"Map NIC to network or bridge or assign static IP";
62f9b7
     [ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
62f9b7
@@ -396,7 +395,6 @@ read the man page virt-v2v(1).
62f9b7
     pr "vddk\n";
62f9b7
     pr "colours-option\n";
62f9b7
     pr "vdsm-compat-option\n";
62f9b7
-    pr "in-place\n";
62f9b7
     pr "io/oo\n";
62f9b7
     pr "mac-option\n";
62f9b7
     pr "bandwidth-option\n";
62f9b7
@@ -572,6 +570,10 @@ read the man page virt-v2v(1).
62f9b7
            error (f_"only ‘-it ssh’ can be used here") in
62f9b7
       Input_vmx.input_vmx input_password input_transport arg in
62f9b7
 
62f9b7
+  (* Prevent use of --in-place option in RHEL. *)
62f9b7
+  if in_place then
62f9b7
+    error (f_"--in-place cannot be used in RHEL");
62f9b7
+
62f9b7
   (* Common error message. *)
62f9b7
   let error_option_cannot_be_used_in_output_mode mode opt =
62f9b7
     error (f_"-o %s: %s option cannot be used in this output mode") mode opt
62f9b7
-- 
62f9b7
2.27.0
62f9b7