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

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