mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

a30de4
From 56aa0b649b144e78e791e134ee33422c273a8f22 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 -
e76f14
 v2v/cmdline.ml           |   6 ++-
90a56e
 v2v/test-v2v-docs.sh     |   2 +-
90a56e
 v2v/test-v2v-in-place.sh | 108 -----------------------------------------------
90a56e
 v2v/virt-v2v.pod         |  46 +-------------------
90a56e
 5 files changed, 7 insertions(+), 157 deletions(-)
e76f14
 delete mode 100755 v2v/test-v2v-in-place.sh
e76f14
e76f14
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
46ce2f
index 133a411bc..297406496 100644
e76f14
--- a/v2v/Makefile.am
e76f14
+++ b/v2v/Makefile.am
90a56e
@@ -291,7 +291,6 @@ if HAVE_LIBVIRT
90a56e
 TESTS += \
e76f14
 	test-v2v-cdrom.sh \
90a56e
 	test-v2v-floppy.sh \
90a56e
-	test-v2v-in-place.sh \
90a56e
 	test-v2v-networks-and-bridges.sh \
90a56e
 	test-v2v-no-copy.sh \
90a56e
 	test-v2v-o-glance.sh \
90a56e
@@ -412,7 +411,6 @@ EXTRA_DIST += \
90a56e
 	test-v2v-i-ova.ovf \
e76f14
 	test-v2v-i-ova.sh \
90a56e
 	test-v2v-i-ova.xml \
e76f14
-	test-v2v-in-place.sh \
e76f14
 	test-v2v-machine-readable.sh \
90a56e
 	test-v2v-networks-and-bridges-expected.xml \
e76f14
 	test-v2v-networks-and-bridges.sh \
e76f14
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
a30de4
index 5a1ea04f3..3e3d5c312 100644
e76f14
--- a/v2v/cmdline.ml
e76f14
+++ b/v2v/cmdline.ml
90a56e
@@ -179,7 +179,7 @@ let parse_cmdline () =
90a56e
                                             s_"Libvirt URI";
90a56e
     [ M"if" ],       Getopt.String ("format", set_string_option_once "-if" input_format),
90a56e
                                             s_"Input format (for -i disk)";
90a56e
-    [ L"in-place" ], Getopt.Set in_place,         s_"Only tune the guest in the input VM";
90a56e
+    [ L"in-place" ], Getopt.Set in_place,         "";
90a56e
     [ L"machine-readable" ], Getopt.Set machine_readable, s_"Make output machine readable";
90a56e
     [ S 'n'; L"network" ],        Getopt.String ("in:out", add_network),    s_"Map network 'in' to 'out'";
90a56e
     [ L"no-copy" ], Getopt.Clear do_copy,         s_"Just write the metadata";
a30de4
@@ -335,6 +335,10 @@ read the man page virt-v2v(1).
e76f14
           error (f_"expecting an OVA file name on the command line") in
e76f14
       Input_ova.input_ova filename 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
46ce2f
index d341852b7..c5d98de7f 100755
90a56e
--- a/v2v/test-v2v-docs.sh
90a56e
+++ b/v2v/test-v2v-docs.sh
90a56e
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
90a56e
 skip_if_skipped
90a56e
 
90a56e
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
90a56e
-  --ignore=--dcPath,--debug-overlay,--ic,--if,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
90a56e
+  --ignore=--dcPath,--debug-overlay,--ic,--if,--in-place,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
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
a30de4
index 5bef6ae8a..1c866e773 100644
e76f14
--- a/v2v/virt-v2v.pod
e76f14
+++ b/v2v/virt-v2v.pod
e76f14
@@ -15,8 +15,6 @@ virt-v2v - Convert a guest to use KVM
e76f14
 
e76f14
  virt-v2v -i disk disk.img -o glance
e76f14
 
e76f14
- virt-v2v -ic qemu:///system qemu_guest --in-place
e76f14
-
e76f14
 =head1 DESCRIPTION
e76f14
 
e76f14
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
e76f14
@@ -77,9 +75,6 @@ booting the guest directly in qemu (mainly for testing).
90a56e
 I<-o rhv> is used to write to a RHV / oVirt target.  I<-o vdsm>
e76f14
 is only used when virt-v2v runs under VDSM control.
e76f14
 
e76f14
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
e76f14
-virtual machine, instead of creating a new VM in the target hypervisor.
e76f14
-
e76f14
 =head1 EXAMPLES
e76f14
 
e76f14
 =head2 Convert from VMware vCenter server to local libvirt
90a56e
@@ -251,20 +246,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
-
90a56e
-See L</IN PLACE CONVERSION> below.
90a56e
-
e76f14
-Conflicts with all I<-o *> options.
e76f14
-
e76f14
 =item B<--machine-readable>
e76f14
 
e76f14
 This option is used to make the output more machine friendly
a30de4
@@ -1657,7 +1638,7 @@ Minimum free space: 10 MB
90a56e
 =head2 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`"
a30de4
@@ -1789,31 +1770,6 @@ that instead.
90a56e
    </devices>
90a56e
  </domain>
90a56e
 
90a56e
-=head1 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
-
90a56e
 =head1 MACHINE READABLE OUTPUT
90a56e
 
90a56e
 The I<--machine-readable> option can be used to make the output more
e76f14
-- 
a30de4
2.14.3
e76f14