mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

6b9fda
From e62ba81a68c66cbe15f182c9baa3667c5646e348 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 ---------------------------------------
d0ea73
 v2v/virt-v2v.pod         |  46 +----------------
d0ea73
 5 files changed, 7 insertions(+), 158 deletions(-)
d0ea73
 delete mode 100755 v2v/test-v2v-in-place.sh
d0ea73
d0ea73
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
d0ea73
index 7a1ac329e..156f8ad5b 100644
d0ea73
--- a/v2v/Makefile.am
d0ea73
+++ b/v2v/Makefile.am
d0ea73
@@ -358,7 +358,6 @@ if HAVE_LIBVIRT
d0ea73
 TESTS += \
d0ea73
 	test-v2v-cdrom.sh \
d0ea73
 	test-v2v-floppy.sh \
d0ea73
-	test-v2v-in-place.sh \
d0ea73
 	test-v2v-networks-and-bridges.sh \
d0ea73
 	test-v2v-no-copy.sh \
d0ea73
 	test-v2v-o-glance.sh \
d0ea73
@@ -497,7 +496,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 \
d0ea73
 	test-v2v-networks-and-bridges-expected.xml \
d0ea73
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
d0ea73
index 6bca12ce3..0efff4c1d 100644
d0ea73
--- a/v2v/cmdline.ml
d0ea73
+++ b/v2v/cmdline.ml
d0ea73
@@ -198,8 +198,7 @@ let parse_cmdline () =
d0ea73
                                     s_"Set option for input mode";
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;
d0ea73
     [ L"machine-readable" ], Getopt.Set machine_readable,
d0ea73
                                     s_"Make output machine readable";
d0ea73
     [ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
d0ea73
@@ -336,7 +335,6 @@ read the man page virt-v2v(1).
d0ea73
     printf "vddk\n";
d0ea73
     printf "colours-option\n";
d0ea73
     printf "vdsm-compat-option\n";
d0ea73
-    printf "in-place\n";
d0ea73
     printf "io/oo\n";
d0ea73
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
d0ea73
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
d0ea73
@@ -485,6 +483,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
d0ea73
index e1e22b599..da98050ee 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,\
d0ea73
 --it,\
d0ea73
 --no-trim,\
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
d0ea73
index 86046f891..e095a6f82 100644
d0ea73
--- a/v2v/virt-v2v.pod
d0ea73
+++ b/v2v/virt-v2v.pod
d0ea73
@@ -18,8 +18,6 @@ virt-v2v - Convert a guest to use KVM
d0ea73
    -oo rhv-cafile=/tmp/ca.pem -oo rhv-direct \
d0ea73
    --bridge ovirtmgmt
d0ea73
 
d0ea73
- virt-v2v -ic qemu:///system qemu_guest --in-place
d0ea73
-
d0ea73
 =head1 DESCRIPTION
d0ea73
 
d0ea73
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
d0ea73
@@ -164,9 +162,6 @@ I<-o rhv-upload> is used to write to a RHV / oVirt target.  I<-o rhv>
d0ea73
 is a legacy method to write to RHV / oVirt E<lt> 4.2.  I<-o vdsm> is
d0ea73
 only used when virt-v2v runs under VDSM control.
d0ea73
 
d0ea73
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
d0ea73
-virtual machine, instead of creating a new VM in the target hypervisor.
d0ea73
-
d0ea73
 =head1 OPTIONS
d0ea73
 
d0ea73
 =over 4
d0ea73
@@ -280,20 +275,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
-
d0ea73
-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.
d0ea73
@@ -2160,7 +2141,7 @@ Minimum free space: 10 MB
d0ea73
 =head2 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`"
d0ea73
@@ -2292,31 +2273,6 @@ that instead.
d0ea73
    </devices>
d0ea73
  </domain>
d0ea73
 
d0ea73
-=head1 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
-
d0ea73
 =head1 MACHINE READABLE OUTPUT
d0ea73
 
d0ea73
 The I<--machine-readable> option can be used to make the output more
d0ea73
-- 
6b9fda
2.21.0
d0ea73