|
|
c232e6 |
From 3b69cfa365c7b014ca81b09e857ab294cff04914 Mon Sep 17 00:00:00 2001
|
|
|
c232e6 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
c232e6 |
Date: Thu, 14 Jan 2016 11:53:42 -0500
|
|
|
c232e6 |
Subject: [PATCH 07/12] RHEL: v2v: Disable the virt-v2v --in-place option.
|
|
|
c232e6 |
|
|
|
c232e6 |
This disables the virt-v2v --in-place option which we do not
|
|
|
c232e6 |
wish to support in RHEL.
|
|
|
c232e6 |
(See commit d0069559a939e47e5f29973ed9a69a13f0b58301).
|
|
|
c232e6 |
---
|
|
|
c232e6 |
docs/test-v2v-docs.sh | 1 +
|
|
|
c232e6 |
docs/virt-v2v.pod | 50 +----------------
|
|
|
c232e6 |
tests/Makefile.am | 2 -
|
|
|
c232e6 |
tests/test-v2v-in-place.sh | 108 -------------------------------------
|
|
|
c232e6 |
v2v/cmdline.ml | 8 +--
|
|
|
c232e6 |
5 files changed, 8 insertions(+), 161 deletions(-)
|
|
|
c232e6 |
delete mode 100755 tests/test-v2v-in-place.sh
|
|
|
c232e6 |
|
|
|
c232e6 |
diff --git a/docs/test-v2v-docs.sh b/docs/test-v2v-docs.sh
|
|
|
c232e6 |
index 465df26f..ae1a6c68 100755
|
|
|
c232e6 |
--- a/docs/test-v2v-docs.sh
|
|
|
c232e6 |
+++ b/docs/test-v2v-docs.sh
|
|
|
c232e6 |
@@ -30,6 +30,7 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \
|
|
|
c232e6 |
--debug-overlay,\
|
|
|
c232e6 |
--ic,\
|
|
|
c232e6 |
--if,\
|
|
|
c232e6 |
+--in-place,\
|
|
|
c232e6 |
--io,\
|
|
|
c232e6 |
--ip,\
|
|
|
c232e6 |
--it,\
|
|
|
c232e6 |
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
|
|
|
c232e6 |
index 83f6fd4d..719a95b5 100644
|
|
|
c232e6 |
--- a/docs/virt-v2v.pod
|
|
|
c232e6 |
+++ b/docs/virt-v2v.pod
|
|
|
c232e6 |
@@ -8,10 +8,6 @@ virt-v2v - Convert a guest to use KVM
|
|
|
c232e6 |
[-o mode] [other -o* options]
|
|
|
c232e6 |
[guest|filename]
|
|
|
c232e6 |
|
|
|
c232e6 |
- virt-v2v --in-place
|
|
|
c232e6 |
- [-i mode] [other -i* options]
|
|
|
c232e6 |
- [guest|filename]
|
|
|
c232e6 |
-
|
|
|
c232e6 |
=head1 DESCRIPTION
|
|
|
c232e6 |
|
|
|
c232e6 |
Virt-v2v converts a single guest from a foreign hypervisor to run on
|
|
|
c232e6 |
@@ -39,9 +35,6 @@ these sides of virt-v2v are documented separately in this manual.
|
|
|
c232e6 |
|
|
|
c232e6 |
Virt-v2v normally copies from the input to the output, called "copying
|
|
|
c232e6 |
mode". In this case the source guest is always left unchanged.
|
|
|
c232e6 |
-In-place conversion (I<--in-place>) only uses the I<-i*> options and
|
|
|
c232e6 |
-modifies the source guest in-place. (See L</In-place conversion>
|
|
|
c232e6 |
-below.)
|
|
|
c232e6 |
|
|
|
c232e6 |
=head2 Other virt-v2v topics
|
|
|
c232e6 |
|
|
|
c232e6 |
@@ -292,20 +285,6 @@ For I<-i disk> only, this specifies the format of the input disk
|
|
|
c232e6 |
image. For other input methods you should specify the input
|
|
|
c232e6 |
format in the metadata.
|
|
|
c232e6 |
|
|
|
c232e6 |
-=item B<--in-place>
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-Do not create an output virtual machine in the target hypervisor.
|
|
|
c232e6 |
-Instead, adjust the guest OS in the source VM to run in the input
|
|
|
c232e6 |
-hypervisor.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-This mode is meant for integration with other toolsets, which take the
|
|
|
c232e6 |
-responsibility of converting the VM configuration, providing for
|
|
|
c232e6 |
-rollback in case of errors, transforming the storage, etc.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-See L</In-place conversion> below.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-Conflicts with all I<-o *> options.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
=item B<-io> OPTION=VALUE
|
|
|
c232e6 |
|
|
|
c232e6 |
Set input option(s) related to the current input mode or transport.
|
|
|
c232e6 |
@@ -1298,8 +1277,8 @@ have at least 100 available inodes.
|
|
|
c232e6 |
=head3 Minimum free space check in the host
|
|
|
c232e6 |
|
|
|
c232e6 |
You must have sufficient free space in the host directory used to
|
|
|
c232e6 |
-store large temporary overlays (except in I<--in-place> mode). To
|
|
|
c232e6 |
-find out which directory this is, use:
|
|
|
c232e6 |
+store large temporary overlays. To find out
|
|
|
c232e6 |
+which directory this is, use:
|
|
|
c232e6 |
|
|
|
c232e6 |
$ df -h "`guestfish get-cachedir`"
|
|
|
c232e6 |
Filesystem Size Used Avail Use% Mounted on
|
|
|
c232e6 |
@@ -1437,31 +1416,6 @@ that instead.
|
|
|
c232e6 |
</devices>
|
|
|
c232e6 |
</domain>
|
|
|
c232e6 |
|
|
|
c232e6 |
-=head2 In-place conversion
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-It is also possible to use virt-v2v in scenarios where a foreign VM
|
|
|
c232e6 |
-has already been imported into a KVM-based hypervisor, but still needs
|
|
|
c232e6 |
-adjustments in the guest to make it run in the new virtual hardware.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-In that case it is assumed that a third-party tool has created the
|
|
|
c232e6 |
-target VM in the supported KVM-based hypervisor based on the source VM
|
|
|
c232e6 |
-configuration and contents, but using virtual devices more appropriate
|
|
|
c232e6 |
-for KVM (e.g. virtio storage and network, etc.).
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-Then, to make the guest OS boot and run in the changed environment,
|
|
|
c232e6 |
-one can use:
|
|
|
c232e6 |
-
|
|
|
c232e6 |
- virt-v2v -ic qemu:///system converted_vm --in-place
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-Virt-v2v will analyze the configuration of C<converted_vm> in the
|
|
|
c232e6 |
-C<qemu:///system> libvirt instance, and apply various fixups to the
|
|
|
c232e6 |
-guest OS configuration to make it match the VM configuration. This
|
|
|
c232e6 |
-may include installing virtio drivers, configuring the bootloader, the
|
|
|
c232e6 |
-mountpoints, the network interfaces, and so on.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-Should an error occur during the operation, virt-v2v exits with an
|
|
|
c232e6 |
-error code leaving the VM in an undefined state.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
=head2 Machine readable output
|
|
|
c232e6 |
|
|
|
c232e6 |
The I<--machine-readable> option can be used to make the output more
|
|
|
c232e6 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
c232e6 |
index 41d38d30..9bbd86d6 100644
|
|
|
c232e6 |
--- a/tests/Makefile.am
|
|
|
c232e6 |
+++ b/tests/Makefile.am
|
|
|
c232e6 |
@@ -77,7 +77,6 @@ TESTS = \
|
|
|
c232e6 |
test-v2v-floppy.sh \
|
|
|
c232e6 |
test-v2v-i-disk.sh \
|
|
|
c232e6 |
test-v2v-i-ova.sh \
|
|
|
c232e6 |
- test-v2v-in-place.sh \
|
|
|
c232e6 |
test-v2v-mac.sh \
|
|
|
c232e6 |
test-v2v-machine-readable.sh \
|
|
|
c232e6 |
test-v2v-networks-and-bridges.sh \
|
|
|
c232e6 |
@@ -226,7 +225,6 @@ EXTRA_DIST += \
|
|
|
c232e6 |
test-v2v-i-vmx-3.vmx \
|
|
|
c232e6 |
test-v2v-i-vmx-4.vmx \
|
|
|
c232e6 |
test-v2v-i-vmx-5.vmx \
|
|
|
c232e6 |
- test-v2v-in-place.sh \
|
|
|
c232e6 |
test-v2v-it-vddk-io-query.sh \
|
|
|
c232e6 |
test-v2v-machine-readable.sh \
|
|
|
c232e6 |
test-v2v-mac-expected.xml \
|
|
|
c232e6 |
diff --git a/tests/test-v2v-in-place.sh b/tests/test-v2v-in-place.sh
|
|
|
c232e6 |
deleted file mode 100755
|
|
|
c232e6 |
index 9da8fa63..00000000
|
|
|
c232e6 |
--- a/tests/test-v2v-in-place.sh
|
|
|
c232e6 |
+++ /dev/null
|
|
|
c232e6 |
@@ -1,108 +0,0 @@
|
|
|
c232e6 |
-#!/bin/bash -
|
|
|
c232e6 |
-# libguestfs virt-v2v test script
|
|
|
c232e6 |
-# Copyright (C) 2014 Red Hat Inc.
|
|
|
c232e6 |
-# Copyright (C) 2015 Parallels IP Holdings GmbH.
|
|
|
c232e6 |
-#
|
|
|
c232e6 |
-# This program is free software; you can redistribute it and/or modify
|
|
|
c232e6 |
-# it under the terms of the GNU General Public License as published by
|
|
|
c232e6 |
-# the Free Software Foundation; either version 2 of the License, or
|
|
|
c232e6 |
-# (at your option) any later version.
|
|
|
c232e6 |
-#
|
|
|
c232e6 |
-# This program is distributed in the hope that it will be useful,
|
|
|
c232e6 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c232e6 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
c232e6 |
-# GNU General Public License for more details.
|
|
|
c232e6 |
-#
|
|
|
c232e6 |
-# You should have received a copy of the GNU General Public License
|
|
|
c232e6 |
-# along with this program; if not, write to the Free Software
|
|
|
c232e6 |
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-# Test --in-place.
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-unset CDPATH
|
|
|
c232e6 |
-export LANG=C
|
|
|
c232e6 |
-set -e
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-source ./functions.sh
|
|
|
c232e6 |
-set -e
|
|
|
c232e6 |
-set -x
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-skip_if_skipped
|
|
|
c232e6 |
-requires test -f ../test-data/phony-guests/windows.img
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-img_base="$abs_top_builddir/test-data/phony-guests/windows.img"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
|
|
|
c232e6 |
-export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-d=$PWD/test-v2v-in-place.d
|
|
|
c232e6 |
-rm -rf $d
|
|
|
c232e6 |
-cleanup_fn rm -r $d
|
|
|
c232e6 |
-mkdir $d
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-img="$d/test.qcow2"
|
|
|
c232e6 |
-rm -f $img
|
|
|
c232e6 |
-qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img
|
|
|
c232e6 |
-md5="$(do_md5 $img_base)"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-libvirt_xml="$d/test.xml"
|
|
|
c232e6 |
-rm -f $libvirt_xml
|
|
|
c232e6 |
-n=windows-overlay
|
|
|
c232e6 |
-cat > $libvirt_xml <
|
|
|
c232e6 |
-<node>
|
|
|
c232e6 |
- <domain type='test'>
|
|
|
c232e6 |
- <name>$n</name>
|
|
|
c232e6 |
- <memory>1048576</memory>
|
|
|
c232e6 |
- <os>
|
|
|
c232e6 |
- <type>hvm</type>
|
|
|
c232e6 |
- <boot dev='hd'/>
|
|
|
c232e6 |
- </os>
|
|
|
c232e6 |
- <devices>
|
|
|
c232e6 |
- <disk type='file' device='disk'>
|
|
|
c232e6 |
- <driver name='qemu' type='qcow2'/>
|
|
|
c232e6 |
- <source file='$img'/>
|
|
|
c232e6 |
- <target dev='vda' bus='virtio'/>
|
|
|
c232e6 |
- </disk>
|
|
|
c232e6 |
- </devices>
|
|
|
c232e6 |
- </domain>
|
|
|
c232e6 |
-</node>
|
|
|
c232e6 |
-EOF
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-# Test that the drivers have been copied over into the guest
|
|
|
c232e6 |
-script="$d/test.fish"
|
|
|
c232e6 |
-expected="$d/expected"
|
|
|
c232e6 |
-response="$d/response"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-mktest ()
|
|
|
c232e6 |
-{
|
|
|
c232e6 |
- local cmd="$1" exp="$2"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
- echo "echo '$cmd'" >> "$script"
|
|
|
c232e6 |
- echo "$cmd" >> "$expected"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
- echo "$cmd" >> "$script"
|
|
|
c232e6 |
- echo "$exp" >> "$expected"
|
|
|
c232e6 |
-}
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-:> "$script"
|
|
|
c232e6 |
-:> "$expected"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-firstboot_dir="/Program Files/Guestfs/Firstboot"
|
|
|
c232e6 |
-mktest "is-dir \"$firstboot_dir\"" true
|
|
|
c232e6 |
-mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
|
|
|
c232e6 |
-mktest "is-dir \"$firstboot_dir/scripts\"" true
|
|
|
c232e6 |
-virtio_dir="/Windows/Drivers/VirtIO"
|
|
|
c232e6 |
-mktest "is-dir \"$virtio_dir\"" true
|
|
|
c232e6 |
-for drv in netkvm qxl vioscsi viostor; do
|
|
|
c232e6 |
- for sfx in cat inf sys; do
|
|
|
c232e6 |
- mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
|
|
|
c232e6 |
- done
|
|
|
c232e6 |
-done
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-guestfish --ro -a "$img" -i < "$script" > "$response"
|
|
|
c232e6 |
-diff -u "$expected" "$response"
|
|
|
c232e6 |
-
|
|
|
c232e6 |
-# Test the base image remained untouched
|
|
|
c232e6 |
-test "$md5" = "$(do_md5 $img_base)"
|
|
|
c232e6 |
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
|
|
|
c232e6 |
index ac10ec31..01314580 100644
|
|
|
c232e6 |
--- a/v2v/cmdline.ml
|
|
|
c232e6 |
+++ b/v2v/cmdline.ml
|
|
|
c232e6 |
@@ -246,8 +246,7 @@ let parse_cmdline () =
|
|
|
c232e6 |
s_"Use password from file to connect to input hypervisor";
|
|
|
c232e6 |
[ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport),
|
|
|
c232e6 |
s_"Input transport";
|
|
|
c232e6 |
- [ L"in-place" ], Getopt.Set in_place,
|
|
|
c232e6 |
- s_"Only tune the guest in the input VM";
|
|
|
c232e6 |
+ [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description;
|
|
|
c232e6 |
[ L"mac" ], Getopt.String ("mac:network|bridge|ip:out", add_mac),
|
|
|
c232e6 |
s_"Map NIC to network or bridge or assign static IP";
|
|
|
c232e6 |
[ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
|
|
|
c232e6 |
@@ -386,7 +385,6 @@ read the man page virt-v2v(1).
|
|
|
c232e6 |
pr "vddk\n";
|
|
|
c232e6 |
pr "colours-option\n";
|
|
|
c232e6 |
pr "vdsm-compat-option\n";
|
|
|
c232e6 |
- pr "in-place\n";
|
|
|
c232e6 |
pr "io/oo\n";
|
|
|
c232e6 |
pr "mac-option\n";
|
|
|
c232e6 |
pr "bandwidth-option\n";
|
|
|
c232e6 |
@@ -556,6 +554,10 @@ read the man page virt-v2v(1).
|
|
|
c232e6 |
error (f_"only ‘-it ssh’ can be used here") in
|
|
|
c232e6 |
Input_vmx.input_vmx input_password input_transport arg in
|
|
|
c232e6 |
|
|
|
c232e6 |
+ (* Prevent use of --in-place option in RHEL. *)
|
|
|
c232e6 |
+ if in_place then
|
|
|
c232e6 |
+ error (f_"--in-place cannot be used in RHEL");
|
|
|
c232e6 |
+
|
|
|
c232e6 |
(* Common error message. *)
|
|
|
c232e6 |
let error_option_cannot_be_used_in_output_mode mode opt =
|
|
|
c232e6 |
error (f_"-o %s: %s option cannot be used in this output mode") mode opt
|
|
|
c232e6 |
--
|
|
|
c232e6 |
2.31.1
|
|
|
c232e6 |
|