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

97ae69
From fb3e89b0fb2d0de3c12a668c00d07c5cfcac9ec0 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 -
97ae69
 v2v/cmdline.ml           |   8 +--
90a56e
 v2v/test-v2v-docs.sh     |   2 +-
97ae69
 v2v/test-v2v-in-place.sh | 108 ---------------------------------------
97ae69
 v2v/virt-v2v.pod         |  46 +----------------
97ae69
 5 files changed, 7 insertions(+), 159 deletions(-)
e76f14
 delete mode 100755 v2v/test-v2v-in-place.sh
e76f14
e76f14
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
97ae69
index 0c3224b24..424530b1d 100644
e76f14
--- a/v2v/Makefile.am
e76f14
+++ b/v2v/Makefile.am
97ae69
@@ -330,7 +330,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 \
97ae69
@@ -469,7 +468,6 @@ EXTRA_DIST += \
97ae69
 	test-v2v-i-vmx-3.vmx \
97ae69
 	test-v2v-i-vmx-4.vmx \
97ae69
 	test-v2v-i-vmx-5.vmx \
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
97ae69
index d6f99fa00..0bc5e9055 100644
e76f14
--- a/v2v/cmdline.ml
e76f14
+++ b/v2v/cmdline.ml
97ae69
@@ -194,8 +194,7 @@ let parse_cmdline () =
97ae69
                                     s_"Input format (for -i disk)";
97ae69
     [ M"it" ],       Getopt.String ("transport", set_string_option_once "-it" input_transport),
97ae69
                                     s_"Input transport";
97ae69
-    [ L"in-place" ], Getopt.Set in_place,
97ae69
-                                    s_"Only tune the guest in the input VM";
97ae69
+    [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description;
97ae69
     [ L"machine-readable" ], Getopt.Set machine_readable,
97ae69
                                     s_"Make output machine readable";
97ae69
     [ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
97ae69
@@ -338,7 +337,6 @@ read the man page virt-v2v(1).
97ae69
     printf "vddk\n";
97ae69
     printf "colours-option\n";
97ae69
     printf "vdsm-compat-option\n";
97ae69
-    printf "in-place\n";
97ae69
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
97ae69
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
97ae69
     List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
97ae69
@@ -438,6 +436,10 @@ read the man page virt-v2v(1).
97ae69
            error (f_"only ‘-it ssh’ can be used here") in
97ae69
       Input_vmx.input_vmx input_transport arg 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
97ae69
index 5d034c465..c8ca193eb 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 \
97ae69
-  --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
97ae69
+  --ignore=--debug-overlay,--ic,--if,--in-place,--it,--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
97ae69
index f33f9bf62..0e0fa0f64 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
97ae69
@@ -162,9 +160,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
-
97ae69
 =head1 OPTIONS
e76f14
 
97ae69
 =over 4
97ae69
@@ -278,20 +273,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
-
97ae69
 =item B<-it> B<ssh>
e76f14
 
97ae69
 When using I<-i vmx>, this enables the ssh transport.
97ae69
@@ -1979,7 +1960,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`"
97ae69
@@ -2111,31 +2092,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
-- 
c71420
2.20.1
e76f14