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

151578
From 56aa0b649b144e78e791e134ee33422c273a8f22 Mon Sep 17 00:00:00 2001
151578
From: "Richard W.M. Jones" <rjones@redhat.com>
151578
Date: Thu, 14 Jan 2016 11:53:42 -0500
151578
Subject: [PATCH] RHEL 7: v2v: Disable the virt-v2v --in-place option.
151578
151578
This disables the virt-v2v --in-place option which we do not
151578
wish to support in RHEL.
151578
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
151578
---
151578
 v2v/Makefile.am          |   2 -
151578
 v2v/cmdline.ml           |   6 ++-
151578
 v2v/test-v2v-docs.sh     |   2 +-
151578
 v2v/test-v2v-in-place.sh | 108 -----------------------------------------------
151578
 v2v/virt-v2v.pod         |  46 +-------------------
151578
 5 files changed, 7 insertions(+), 157 deletions(-)
151578
 delete mode 100755 v2v/test-v2v-in-place.sh
151578
151578
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
151578
index 133a411bc..297406496 100644
151578
--- a/v2v/Makefile.am
151578
+++ b/v2v/Makefile.am
151578
@@ -291,7 +291,6 @@ if HAVE_LIBVIRT
151578
 TESTS += \
151578
 	test-v2v-cdrom.sh \
151578
 	test-v2v-floppy.sh \
151578
-	test-v2v-in-place.sh \
151578
 	test-v2v-networks-and-bridges.sh \
151578
 	test-v2v-no-copy.sh \
151578
 	test-v2v-o-glance.sh \
151578
@@ -412,7 +411,6 @@ EXTRA_DIST += \
151578
 	test-v2v-i-ova.ovf \
151578
 	test-v2v-i-ova.sh \
151578
 	test-v2v-i-ova.xml \
151578
-	test-v2v-in-place.sh \
151578
 	test-v2v-machine-readable.sh \
151578
 	test-v2v-networks-and-bridges-expected.xml \
151578
 	test-v2v-networks-and-bridges.sh \
151578
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
151578
index 5a1ea04f3..3e3d5c312 100644
151578
--- a/v2v/cmdline.ml
151578
+++ b/v2v/cmdline.ml
151578
@@ -179,7 +179,7 @@ let parse_cmdline () =
151578
                                             s_"Libvirt URI";
151578
     [ M"if" ],       Getopt.String ("format", set_string_option_once "-if" input_format),
151578
                                             s_"Input format (for -i disk)";
151578
-    [ L"in-place" ], Getopt.Set in_place,         s_"Only tune the guest in the input VM";
151578
+    [ L"in-place" ], Getopt.Set in_place,         "";
151578
     [ L"machine-readable" ], Getopt.Set machine_readable, s_"Make output machine readable";
151578
     [ S 'n'; L"network" ],        Getopt.String ("in:out", add_network),    s_"Map network 'in' to 'out'";
151578
     [ L"no-copy" ], Getopt.Clear do_copy,         s_"Just write the metadata";
151578
@@ -335,6 +335,10 @@ read the man page virt-v2v(1).
151578
           error (f_"expecting an OVA file name on the command line") in
151578
       Input_ova.input_ova filename in
151578
 
151578
+  (* Prevent use of --in-place option in RHEL. *)
151578
+  if in_place then
151578
+    error (f_"--in-place cannot be used in RHEL 7");
151578
+
151578
   (* Common error message. *)
151578
   let error_option_cannot_be_used_in_output_mode mode opt =
151578
     error (f_"-o %s: %s option cannot be used in this output mode") mode opt
151578
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
151578
index d341852b7..c5d98de7f 100755
151578
--- a/v2v/test-v2v-docs.sh
151578
+++ b/v2v/test-v2v-docs.sh
151578
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
151578
 skip_if_skipped
151578
 
151578
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
151578
-  --ignore=--dcPath,--debug-overlay,--ic,--if,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
151578
+  --ignore=--dcPath,--debug-overlay,--ic,--if,--in-place,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
151578
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
151578
deleted file mode 100755
151578
index 6f7d78f39..000000000
151578
--- a/v2v/test-v2v-in-place.sh
151578
+++ /dev/null
151578
@@ -1,108 +0,0 @@
151578
-#!/bin/bash -
151578
-# libguestfs virt-v2v test script
151578
-# Copyright (C) 2014 Red Hat Inc.
151578
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
151578
-#
151578
-# This program is free software; you can redistribute it and/or modify
151578
-# it under the terms of the GNU General Public License as published by
151578
-# the Free Software Foundation; either version 2 of the License, or
151578
-# (at your option) any later version.
151578
-#
151578
-# This program is distributed in the hope that it will be useful,
151578
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
151578
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151578
-# GNU General Public License for more details.
151578
-#
151578
-# You should have received a copy of the GNU General Public License
151578
-# along with this program; if not, write to the Free Software
151578
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
151578
-
151578
-# Test --in-place.
151578
-
151578
-unset CDPATH
151578
-export LANG=C
151578
-set -e
151578
-
151578
-$TEST_FUNCTIONS
151578
-skip_if_skipped
151578
-skip_if_backend uml
151578
-skip_unless_phony_guest windows.img
151578
-
151578
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
151578
-
151578
-export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
151578
-export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
151578
-
151578
-d=$PWD/test-v2v-in-place.d
151578
-rm -rf $d
151578
-mkdir $d
151578
-
151578
-img="$d/test.qcow2"
151578
-rm -f $img
151578
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
151578
-md5="$(do_md5 $img_base)"
151578
-
151578
-libvirt_xml="$d/test.xml"
151578
-rm -f $libvirt_xml
151578
-n=windows-overlay
151578
-cat > $libvirt_xml <
151578
-<node>
151578
-  <domain type='test'>
151578
-    <name>$n</name>
151578
-    <memory>1048576</memory>
151578
-    <os>
151578
-      <type>hvm</type>
151578
-      <boot dev='hd'/>
151578
-    </os>
151578
-    <devices>
151578
-      <disk type='file' device='disk'>
151578
-        <driver name='qemu' type='qcow2'/>
151578
-        <source file='$img'/>
151578
-        <target dev='vda' bus='virtio'/>
151578
-      </disk>
151578
-    </devices>
151578
-  </domain>
151578
-</node>
151578
-EOF
151578
-
151578
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
151578
-
151578
-# Test that the drivers have been copied over into the guest
151578
-script="$d/test.fish"
151578
-expected="$d/expected"
151578
-response="$d/response"
151578
-
151578
-mktest ()
151578
-{
151578
-    local cmd="$1" exp="$2"
151578
-
151578
-    echo "echo '$cmd'" >> "$script"
151578
-    echo "$cmd" >> "$expected"
151578
-
151578
-    echo "$cmd" >> "$script"
151578
-    echo "$exp" >> "$expected"
151578
-}
151578
-
151578
-:> "$script"
151578
-:> "$expected"
151578
-
151578
-firstboot_dir="/Program Files/Guestfs/Firstboot"
151578
-mktest "is-dir \"$firstboot_dir\"" true
151578
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
151578
-mktest "is-dir \"$firstboot_dir/scripts\"" true
151578
-virtio_dir="/Windows/Drivers/VirtIO"
151578
-mktest "is-dir \"$virtio_dir\"" true
151578
-for drv in netkvm qxl vioscsi viostor; do
151578
-    for sfx in cat inf sys; do
151578
-        mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
151578
-    done
151578
-done
151578
-
151578
-guestfish --ro -a "$img" -i < "$script" > "$response"
151578
-diff -u "$expected" "$response"
151578
-
151578
-# Test the base image remained untouched
151578
-test "$md5" = "$(do_md5 $img_base)"
151578
-
151578
-# Clean up.
151578
-rm -r $d
151578
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
151578
index 5bef6ae8a..1c866e773 100644
151578
--- a/v2v/virt-v2v.pod
151578
+++ b/v2v/virt-v2v.pod
151578
@@ -15,8 +15,6 @@ virt-v2v - Convert a guest to use KVM
151578
 
151578
  virt-v2v -i disk disk.img -o glance
151578
 
151578
- virt-v2v -ic qemu:///system qemu_guest --in-place
151578
-
151578
 =head1 DESCRIPTION
151578
 
151578
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
151578
@@ -77,9 +75,6 @@ booting the guest directly in qemu (mainly for testing).
151578
 I<-o rhv> is used to write to a RHV / oVirt target.  I<-o vdsm>
151578
 is only used when virt-v2v runs under VDSM control.
151578
 
151578
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
151578
-virtual machine, instead of creating a new VM in the target hypervisor.
151578
-
151578
 =head1 EXAMPLES
151578
 
151578
 =head2 Convert from VMware vCenter server to local libvirt
151578
@@ -251,20 +246,6 @@ For I<-i disk> only, this specifies the format of the input disk
151578
 image.  For other input methods you should specify the input
151578
 format in the metadata.
151578
 
151578
-=item B<--in-place>
151578
-
151578
-Do not create an output virtual machine in the target hypervisor.
151578
-Instead, adjust the guest OS in the source VM to run in the input
151578
-hypervisor.
151578
-
151578
-This mode is meant for integration with other toolsets, which take the
151578
-responsibility of converting the VM configuration, providing for
151578
-rollback in case of errors, transforming the storage, etc.
151578
-
151578
-See L</IN PLACE CONVERSION> below.
151578
-
151578
-Conflicts with all I<-o *> options.
151578
-
151578
 =item B<--machine-readable>
151578
 
151578
 This option is used to make the output more machine friendly
151578
@@ -1657,7 +1638,7 @@ Minimum free space: 10 MB
151578
 =head2 Minimum free space check in the host
151578
 
151578
 You must have sufficient free space in the host directory used to
151578
-store temporary overlays (except in I<--in-place> mode).  To find out
151578
+store temporary overlays.  To find out
151578
 which directory this is, use:
151578
 
151578
  $ df -h "`guestfish get-cachedir`"
151578
@@ -1789,31 +1770,6 @@ that instead.
151578
    </devices>
151578
  </domain>
151578
 
151578
-=head1 IN PLACE CONVERSION
151578
-
151578
-It is also possible to use virt-v2v in scenarios where a foreign VM
151578
-has already been imported into a KVM-based hypervisor, but still needs
151578
-adjustments in the guest to make it run in the new virtual hardware.
151578
-
151578
-In that case it is assumed that a third-party tool has created the
151578
-target VM in the supported KVM-based hypervisor based on the source VM
151578
-configuration and contents, but using virtual devices more appropriate
151578
-for KVM (e.g. virtio storage and network, etc.).
151578
-
151578
-Then, to make the guest OS boot and run in the changed environment,
151578
-one can use:
151578
-
151578
- virt-v2v -ic qemu:///system converted_vm --in-place
151578
-
151578
-Virt-v2v will analyze the configuration of C<converted_vm> in the
151578
-C<qemu:///system> libvirt instance, and apply various fixups to the
151578
-guest OS configuration to make it match the VM configuration.  This
151578
-may include installing virtio drivers, configuring the bootloader, the
151578
-mountpoints, the network interfaces, and so on.
151578
-
151578
-Should an error occur during the operation, virt-v2v exits with an
151578
-error code leaving the VM in an undefined state.
151578
-
151578
 =head1 MACHINE READABLE OUTPUT
151578
 
151578
 The I<--machine-readable> option can be used to make the output more
151578
-- 
151578
2.14.3
151578