mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

e76f14
From 7a19cd75929d88d5b3512895138e5bde6b92b157 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
---
e76f14
 v2v/Makefile.am          |   1 -
e76f14
 v2v/cmdline.ml           |   6 ++-
e76f14
 v2v/test-v2v-in-place.sh | 121 -----------------------------------------------
e76f14
 v2v/virt-v2v.pod         |  17 -------
e76f14
 4 files changed, 5 insertions(+), 140 deletions(-)
e76f14
 delete mode 100755 v2v/test-v2v-in-place.sh
e76f14
e76f14
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
e76f14
index 8a79a6f..d9cf986 100644
e76f14
--- a/v2v/Makefile.am
e76f14
+++ b/v2v/Makefile.am
e76f14
@@ -296,7 +296,6 @@ TESTS += \
e76f14
 	test-v2v-cdrom.sh \
e76f14
 	test-v2v-i-ova.sh \
e76f14
 	test-v2v-i-disk.sh \
e76f14
-	test-v2v-in-place.sh \
e76f14
 	test-v2v-machine-readable.sh \
e76f14
 	test-v2v-networks-and-bridges.sh \
e76f14
 	test-v2v-no-copy.sh \
e76f14
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
e76f14
index 32eb873..4623af9 100644
e76f14
--- a/v2v/cmdline.ml
e76f14
+++ b/v2v/cmdline.ml
e76f14
@@ -194,7 +194,7 @@ let parse_cmdline () =
e76f14
                                             "uri " ^ s_"Libvirt URI";
e76f14
     "-if",       Arg.String (set_string_option_once "-if" input_format),
e76f14
                                             "format " ^ s_"Input format (for -i disk)";
e76f14
-    "--in-place", Arg.Set in_place,         " " ^ s_"Only tune the guest in the input VM";
e76f14
+    "--in-place", Arg.Set in_place,         " " ^ s_"Unsupported option in RHEL 7";
e76f14
     "--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
e76f14
     "-n",        Arg.String add_network,    "in:out " ^ s_"Map network 'in' to 'out'";
e76f14
     "--network", Arg.String add_network,    "in:out " ^ ditto;
e76f14
@@ -352,6 +352,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
+
e76f14
   (* Parse the output mode. *)
e76f14
   if output_mode <> `Not_set && in_place then
e76f14
     error (f_"-o and --in-place cannot be used at the same time");
e76f14
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
e76f14
deleted file mode 100755
e76f14
index e55daa0..0000000
e76f14
--- a/v2v/test-v2v-in-place.sh
e76f14
+++ /dev/null
e76f14
@@ -1,121 +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
-
e76f14
-if [ -n "$SKIP_TEST_V2V_IN_PLACE_SH" ]; then
e76f14
-    echo "$0: test skipped because environment variable is set"
e76f14
-    exit 77
e76f14
-fi
e76f14
-
e76f14
-if [ "$(guestfish get-backend)" = "uml" ]; then
e76f14
-    echo "$0: test skipped because UML backend does not support network"
e76f14
-    exit 77
e76f14
-fi
e76f14
-
e76f14
-abs_top_builddir="$(cd ..; pwd)"
e76f14
-
e76f14
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
e76f14
-if ! test -f $img_base || ! test -s $img_base; then
e76f14
-    echo "$0: test skipped because phony Windows image was not created"
e76f14
-    exit 77
e76f14
-fi
e76f14
-
e76f14
-export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
e76f14
-export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
e76f14
-
e76f14
-. $srcdir/../test-data/guestfs-hashsums.sh
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
-
e76f14
-firstboot_dir="/Program Files/Red Hat/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
e76f14
index 8e5cf1d..5800b34 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).
e76f14
 I<-o rhev> is used to write to a RHEV-M / 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
e76f14
@@ -248,18 +243,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
-
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
e76f14
-- 
7af31e
1.8.3.1
e76f14