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

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