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

df3bb2
From 4bdd05ea3ca6cfdeda7a9917593287d6e5ca3504 Mon Sep 17 00:00:00 2001
df3bb2
From: "Richard W.M. Jones" <rjones@redhat.com>
df3bb2
Date: Thu, 14 Jan 2016 11:53:42 -0500
df3bb2
Subject: [PATCH] RHEL 8: v2v: Disable the virt-v2v --in-place option.
df3bb2
df3bb2
This disables the virt-v2v --in-place option which we do not
df3bb2
wish to support in RHEL.
df3bb2
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
df3bb2
---
df3bb2
 v2v/Makefile.am          |   2 -
df3bb2
 v2v/cmdline.ml           |   8 +--
df3bb2
 v2v/test-v2v-docs.sh     |   1 +
df3bb2
 v2v/test-v2v-in-place.sh | 108 ---------------------------------------
df3bb2
 v2v/virt-v2v.pod         |  46 +----------------
df3bb2
 5 files changed, 7 insertions(+), 158 deletions(-)
df3bb2
 delete mode 100755 v2v/test-v2v-in-place.sh
df3bb2
df3bb2
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
df3bb2
index 7a1ac329e..156f8ad5b 100644
df3bb2
--- a/v2v/Makefile.am
df3bb2
+++ b/v2v/Makefile.am
df3bb2
@@ -358,7 +358,6 @@ if HAVE_LIBVIRT
df3bb2
 TESTS += \
df3bb2
 	test-v2v-cdrom.sh \
df3bb2
 	test-v2v-floppy.sh \
df3bb2
-	test-v2v-in-place.sh \
df3bb2
 	test-v2v-networks-and-bridges.sh \
df3bb2
 	test-v2v-no-copy.sh \
df3bb2
 	test-v2v-o-glance.sh \
df3bb2
@@ -497,7 +496,6 @@ EXTRA_DIST += \
df3bb2
 	test-v2v-i-vmx-3.vmx \
df3bb2
 	test-v2v-i-vmx-4.vmx \
df3bb2
 	test-v2v-i-vmx-5.vmx \
df3bb2
-	test-v2v-in-place.sh \
df3bb2
 	test-v2v-it-vddk-io-query.sh \
df3bb2
 	test-v2v-machine-readable.sh \
df3bb2
 	test-v2v-networks-and-bridges-expected.xml \
df3bb2
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
df3bb2
index 6bca12ce3..0efff4c1d 100644
df3bb2
--- a/v2v/cmdline.ml
df3bb2
+++ b/v2v/cmdline.ml
df3bb2
@@ -198,8 +198,7 @@ let parse_cmdline () =
df3bb2
                                     s_"Set option for input mode";
df3bb2
     [ M"it" ],       Getopt.String ("transport", set_string_option_once "-it" input_transport),
df3bb2
                                     s_"Input transport";
df3bb2
-    [ L"in-place" ], Getopt.Set in_place,
df3bb2
-                                    s_"Only tune the guest in the input VM";
df3bb2
+    [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description;
df3bb2
     [ L"machine-readable" ], Getopt.Set machine_readable,
df3bb2
                                     s_"Make output machine readable";
df3bb2
     [ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
df3bb2
@@ -336,7 +335,6 @@ read the man page virt-v2v(1).
df3bb2
     printf "vddk\n";
df3bb2
     printf "colours-option\n";
df3bb2
     printf "vdsm-compat-option\n";
df3bb2
-    printf "in-place\n";
df3bb2
     printf "io/oo\n";
df3bb2
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
df3bb2
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
df3bb2
@@ -485,6 +483,10 @@ read the man page virt-v2v(1).
df3bb2
            error (f_"only ‘-it ssh’ can be used here") in
df3bb2
       Input_vmx.input_vmx input_transport arg in
df3bb2
 
df3bb2
+  (* Prevent use of --in-place option in RHEL. *)
df3bb2
+  if in_place then
df3bb2
+    error (f_"--in-place cannot be used in RHEL");
df3bb2
+
df3bb2
   (* Common error message. *)
df3bb2
   let error_option_cannot_be_used_in_output_mode mode opt =
df3bb2
     error (f_"-o %s: %s option cannot be used in this output mode") mode opt
df3bb2
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
df3bb2
index e1e22b599..da98050ee 100755
df3bb2
--- a/v2v/test-v2v-docs.sh
df3bb2
+++ b/v2v/test-v2v-docs.sh
df3bb2
@@ -26,6 +26,7 @@ $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
df3bb2
 --debug-overlay,\
df3bb2
 --ic,\
df3bb2
 --if,\
df3bb2
+--in-place,\
df3bb2
 --io,\
df3bb2
 --it,\
df3bb2
 --no-trim,\
df3bb2
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
df3bb2
deleted file mode 100755
df3bb2
index 6f7d78f39..000000000
df3bb2
--- a/v2v/test-v2v-in-place.sh
df3bb2
+++ /dev/null
df3bb2
@@ -1,108 +0,0 @@
df3bb2
-#!/bin/bash -
df3bb2
-# libguestfs virt-v2v test script
df3bb2
-# Copyright (C) 2014 Red Hat Inc.
df3bb2
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
df3bb2
-#
df3bb2
-# This program is free software; you can redistribute it and/or modify
df3bb2
-# it under the terms of the GNU General Public License as published by
df3bb2
-# the Free Software Foundation; either version 2 of the License, or
df3bb2
-# (at your option) any later version.
df3bb2
-#
df3bb2
-# This program is distributed in the hope that it will be useful,
df3bb2
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
df3bb2
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
df3bb2
-# GNU General Public License for more details.
df3bb2
-#
df3bb2
-# You should have received a copy of the GNU General Public License
df3bb2
-# along with this program; if not, write to the Free Software
df3bb2
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
df3bb2
-
df3bb2
-# Test --in-place.
df3bb2
-
df3bb2
-unset CDPATH
df3bb2
-export LANG=C
df3bb2
-set -e
df3bb2
-
df3bb2
-$TEST_FUNCTIONS
df3bb2
-skip_if_skipped
df3bb2
-skip_if_backend uml
df3bb2
-skip_unless_phony_guest windows.img
df3bb2
-
df3bb2
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
df3bb2
-
df3bb2
-export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
df3bb2
-export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
df3bb2
-
df3bb2
-d=$PWD/test-v2v-in-place.d
df3bb2
-rm -rf $d
df3bb2
-mkdir $d
df3bb2
-
df3bb2
-img="$d/test.qcow2"
df3bb2
-rm -f $img
df3bb2
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
df3bb2
-md5="$(do_md5 $img_base)"
df3bb2
-
df3bb2
-libvirt_xml="$d/test.xml"
df3bb2
-rm -f $libvirt_xml
df3bb2
-n=windows-overlay
df3bb2
-cat > $libvirt_xml <
df3bb2
-<node>
df3bb2
-  <domain type='test'>
df3bb2
-    <name>$n</name>
df3bb2
-    <memory>1048576</memory>
df3bb2
-    <os>
df3bb2
-      <type>hvm</type>
df3bb2
-      <boot dev='hd'/>
df3bb2
-    </os>
df3bb2
-    <devices>
df3bb2
-      <disk type='file' device='disk'>
df3bb2
-        <driver name='qemu' type='qcow2'/>
df3bb2
-        <source file='$img'/>
df3bb2
-        <target dev='vda' bus='virtio'/>
df3bb2
-      </disk>
df3bb2
-    </devices>
df3bb2
-  </domain>
df3bb2
-</node>
df3bb2
-EOF
df3bb2
-
df3bb2
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
df3bb2
-
df3bb2
-# Test that the drivers have been copied over into the guest
df3bb2
-script="$d/test.fish"
df3bb2
-expected="$d/expected"
df3bb2
-response="$d/response"
df3bb2
-
df3bb2
-mktest ()
df3bb2
-{
df3bb2
-    local cmd="$1" exp="$2"
df3bb2
-
df3bb2
-    echo "echo '$cmd'" >> "$script"
df3bb2
-    echo "$cmd" >> "$expected"
df3bb2
-
df3bb2
-    echo "$cmd" >> "$script"
df3bb2
-    echo "$exp" >> "$expected"
df3bb2
-}
df3bb2
-
df3bb2
-:> "$script"
df3bb2
-:> "$expected"
df3bb2
-
df3bb2
-firstboot_dir="/Program Files/Guestfs/Firstboot"
df3bb2
-mktest "is-dir \"$firstboot_dir\"" true
df3bb2
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
df3bb2
-mktest "is-dir \"$firstboot_dir/scripts\"" true
df3bb2
-virtio_dir="/Windows/Drivers/VirtIO"
df3bb2
-mktest "is-dir \"$virtio_dir\"" true
df3bb2
-for drv in netkvm qxl vioscsi viostor; do
df3bb2
-    for sfx in cat inf sys; do
df3bb2
-        mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
df3bb2
-    done
df3bb2
-done
df3bb2
-
df3bb2
-guestfish --ro -a "$img" -i < "$script" > "$response"
df3bb2
-diff -u "$expected" "$response"
df3bb2
-
df3bb2
-# Test the base image remained untouched
df3bb2
-test "$md5" = "$(do_md5 $img_base)"
df3bb2
-
df3bb2
-# Clean up.
df3bb2
-rm -r $d
df3bb2
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
df3bb2
index 276fcea85..e60011fac 100644
df3bb2
--- a/v2v/virt-v2v.pod
df3bb2
+++ b/v2v/virt-v2v.pod
df3bb2
@@ -18,8 +18,6 @@ virt-v2v - Convert a guest to use KVM
df3bb2
    -oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \
df3bb2
    --bridge ovirtmgmt
df3bb2
 
df3bb2
- virt-v2v -ic qemu:///system qemu_guest --in-place
df3bb2
-
df3bb2
 =head1 DESCRIPTION
df3bb2
 
df3bb2
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
df3bb2
@@ -164,9 +162,6 @@ I<-o rhv-upload> is used to write to a RHV / oVirt target.  I<-o rhv>
df3bb2
 is a legacy method to write to RHV / oVirt E<lt> 4.2.  I<-o vdsm> is
df3bb2
 only used when virt-v2v runs under VDSM control.
df3bb2
 
df3bb2
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
df3bb2
-virtual machine, instead of creating a new VM in the target hypervisor.
df3bb2
-
df3bb2
 =head1 OPTIONS
df3bb2
 
df3bb2
 =over 4
df3bb2
@@ -280,20 +275,6 @@ For I<-i disk> only, this specifies the format of the input disk
df3bb2
 image.  For other input methods you should specify the input
df3bb2
 format in the metadata.
df3bb2
 
df3bb2
-=item B<--in-place>
df3bb2
-
df3bb2
-Do not create an output virtual machine in the target hypervisor.
df3bb2
-Instead, adjust the guest OS in the source VM to run in the input
df3bb2
-hypervisor.
df3bb2
-
df3bb2
-This mode is meant for integration with other toolsets, which take the
df3bb2
-responsibility of converting the VM configuration, providing for
df3bb2
-rollback in case of errors, transforming the storage, etc.
df3bb2
-
df3bb2
-See L</IN PLACE CONVERSION> below.
df3bb2
-
df3bb2
-Conflicts with all I<-o *> options.
df3bb2
-
df3bb2
 =item B<-io> OPTION=VALUE
df3bb2
 
df3bb2
 Set input option(s) related to the current input mode or transport.
df3bb2
@@ -2136,7 +2117,7 @@ Minimum free space: 10 MB
df3bb2
 =head2 Minimum free space check in the host
df3bb2
 
df3bb2
 You must have sufficient free space in the host directory used to
df3bb2
-store temporary overlays (except in I<--in-place> mode).  To find out
df3bb2
+store temporary overlays.  To find out
df3bb2
 which directory this is, use:
df3bb2
 
df3bb2
  $ df -h "`guestfish get-cachedir`"
df3bb2
@@ -2268,31 +2249,6 @@ that instead.
df3bb2
    </devices>
df3bb2
  </domain>
df3bb2
 
df3bb2
-=head1 IN PLACE CONVERSION
df3bb2
-
df3bb2
-It is also possible to use virt-v2v in scenarios where a foreign VM
df3bb2
-has already been imported into a KVM-based hypervisor, but still needs
df3bb2
-adjustments in the guest to make it run in the new virtual hardware.
df3bb2
-
df3bb2
-In that case it is assumed that a third-party tool has created the
df3bb2
-target VM in the supported KVM-based hypervisor based on the source VM
df3bb2
-configuration and contents, but using virtual devices more appropriate
df3bb2
-for KVM (e.g. virtio storage and network, etc.).
df3bb2
-
df3bb2
-Then, to make the guest OS boot and run in the changed environment,
df3bb2
-one can use:
df3bb2
-
df3bb2
- virt-v2v -ic qemu:///system converted_vm --in-place
df3bb2
-
df3bb2
-Virt-v2v will analyze the configuration of C<converted_vm> in the
df3bb2
-C<qemu:///system> libvirt instance, and apply various fixups to the
df3bb2
-guest OS configuration to make it match the VM configuration.  This
df3bb2
-may include installing virtio drivers, configuring the bootloader, the
df3bb2
-mountpoints, the network interfaces, and so on.
df3bb2
-
df3bb2
-Should an error occur during the operation, virt-v2v exits with an
df3bb2
-error code leaving the VM in an undefined state.
df3bb2
-
df3bb2
 =head1 MACHINE READABLE OUTPUT
df3bb2
 
df3bb2
 The I<--machine-readable> option can be used to make the output more
df3bb2
-- 
df3bb2
2.21.0
df3bb2