Blame SOURCES/0026-RHEL-7-v2v-Disable-the-virt-v2v-in-place-option.patch

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