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

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