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

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