Blob Blame History Raw
From 7a19cd75929d88d5b3512895138e5bde6b92b157 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Jan 2016 11:53:42 -0500
Subject: [PATCH] RHEL 7: v2v: Disable the virt-v2v --in-place option.

This disables the virt-v2v --in-place option which we do not
wish to support in RHEL.
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
---
 v2v/Makefile.am          |   1 -
 v2v/cmdline.ml           |   6 ++-
 v2v/test-v2v-in-place.sh | 121 -----------------------------------------------
 v2v/virt-v2v.pod         |  17 -------
 4 files changed, 5 insertions(+), 140 deletions(-)
 delete mode 100755 v2v/test-v2v-in-place.sh

diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 8a79a6f..d9cf986 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -296,7 +296,6 @@ TESTS += \
 	test-v2v-cdrom.sh \
 	test-v2v-i-ova.sh \
 	test-v2v-i-disk.sh \
-	test-v2v-in-place.sh \
 	test-v2v-machine-readable.sh \
 	test-v2v-networks-and-bridges.sh \
 	test-v2v-no-copy.sh \
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 32eb873..4623af9 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -194,7 +194,7 @@ let parse_cmdline () =
                                             "uri " ^ s_"Libvirt URI";
     "-if",       Arg.String (set_string_option_once "-if" input_format),
                                             "format " ^ s_"Input format (for -i disk)";
-    "--in-place", Arg.Set in_place,         " " ^ s_"Only tune the guest in the input VM";
+    "--in-place", Arg.Set in_place,         " " ^ s_"Unsupported option in RHEL 7";
     "--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
     "-n",        Arg.String add_network,    "in:out " ^ s_"Map network 'in' to 'out'";
     "--network", Arg.String add_network,    "in:out " ^ ditto;
@@ -352,6 +352,10 @@ read the man page virt-v2v(1).
           error (f_"expecting an OVA file name on the command line") in
       Input_ova.input_ova filename in
 
+  (* Prevent use of --in-place option in RHEL. *)
+  if in_place then
+    error (f_"--in-place cannot be used in RHEL 7");
+
   (* Parse the output mode. *)
   if output_mode <> `Not_set && in_place then
     error (f_"-o and --in-place cannot be used at the same time");
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
deleted file mode 100755
index e55daa0..0000000
--- a/v2v/test-v2v-in-place.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash -
-# libguestfs virt-v2v test script
-# Copyright (C) 2014 Red Hat Inc.
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Test --in-place.
-
-unset CDPATH
-export LANG=C
-set -e
-
-if [ -n "$SKIP_TEST_V2V_IN_PLACE_SH" ]; then
-    echo "$0: test skipped because environment variable is set"
-    exit 77
-fi
-
-if [ "$(guestfish get-backend)" = "uml" ]; then
-    echo "$0: test skipped because UML backend does not support network"
-    exit 77
-fi
-
-abs_top_builddir="$(cd ..; pwd)"
-
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
-if ! test -f $img_base || ! test -s $img_base; then
-    echo "$0: test skipped because phony Windows image was not created"
-    exit 77
-fi
-
-export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
-export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
-
-. $srcdir/../test-data/guestfs-hashsums.sh
-
-d=$PWD/test-v2v-in-place.d
-rm -rf $d
-mkdir $d
-
-img="$d/test.qcow2"
-rm -f $img
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
-md5="$(do_md5 $img_base)"
-
-libvirt_xml="$d/test.xml"
-rm -f $libvirt_xml
-n=windows-overlay
-cat > $libvirt_xml <<EOF
-<node>
-  <domain type='test'>
-    <name>$n</name>
-    <memory>1048576</memory>
-    <os>
-      <type>hvm</type>
-      <boot dev='hd'/>
-    </os>
-    <devices>
-      <disk type='file' device='disk'>
-        <driver name='qemu' type='qcow2'/>
-        <source file='$img'/>
-        <target dev='vda' bus='virtio'/>
-      </disk>
-    </devices>
-  </domain>
-</node>
-EOF
-
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
-
-# Test that the drivers have been copied over into the guest
-script="$d/test.fish"
-expected="$d/expected"
-response="$d/response"
-
-mktest ()
-{
-    local cmd="$1" exp="$2"
-
-    echo "echo '$cmd'" >> "$script"
-    echo "$cmd" >> "$expected"
-
-    echo "$cmd" >> "$script"
-    echo "$exp" >> "$expected"
-}
-
-:> "$script"
-:> "$expected"
-
-firstboot_dir="/Program Files/Red Hat/Firstboot"
-mktest "is-dir \"$firstboot_dir\"" true
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
-mktest "is-dir \"$firstboot_dir/scripts\"" true
-virtio_dir="/Windows/Drivers/VirtIO"
-mktest "is-dir \"$virtio_dir\"" true
-for drv in netkvm qxl vioscsi viostor; do
-    for sfx in cat inf sys; do
-        mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
-    done
-done
-
-guestfish --ro -a "$img" -i < "$script" > "$response"
-diff -u "$expected" "$response"
-
-# Test the base image remained untouched
-test "$md5" = "$(do_md5 $img_base)"
-
-# Clean up.
-rm -r $d
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 8e5cf1d..5800b34 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -15,8 +15,6 @@ virt-v2v - Convert a guest to use KVM
 
  virt-v2v -i disk disk.img -o glance
 
- virt-v2v -ic qemu:///system qemu_guest --in-place
-
 =head1 DESCRIPTION
 
 Virt-v2v converts guests from a foreign hypervisor to run on KVM.  It
@@ -77,9 +75,6 @@ booting the guest directly in qemu (mainly for testing).
 I<-o rhev> is used to write to a RHEV-M / oVirt target.  I<-o vdsm>
 is only used when virt-v2v runs under VDSM control.
 
-I<--in-place> instructs virt-v2v to customize the guest OS in the input
-virtual machine, instead of creating a new VM in the target hypervisor.
-
 =head1 EXAMPLES
 
 =head2 Convert from VMware vCenter server to local libvirt
@@ -248,18 +243,6 @@ For I<-i disk> only, this specifies the format of the input disk
 image.  For other input methods you should specify the input
 format in the metadata.
 
-=item B<--in-place>
-
-Do not create an output virtual machine in the target hypervisor.
-Instead, adjust the guest OS in the source VM to run in the input
-hypervisor.
-
-This mode is meant for integration with other toolsets, which take the
-responsibility of converting the VM configuration, providing for
-rollback in case of errors, transforming the storage, etc.
-
-Conflicts with all I<-o *> options.
-
 =item B<--machine-readable>
 
 This option is used to make the output more machine friendly
-- 
1.8.3.1