|
|
ffd6ed |
From c3f824a71eb165d45231bfb3561b3ac1b4e35c1e Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
ffd6ed |
Date: Tue, 16 Jun 2015 12:15:29 +0100
|
|
|
ffd6ed |
Subject: [PATCH] v2v: Don't fail if one of the input disks is blank
|
|
|
ffd6ed |
(RHBZ#1232192).
|
|
|
ffd6ed |
|
|
|
ffd6ed |
This also adds a regression test since it is probably easy to break
|
|
|
ffd6ed |
this in future.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Thanks: Junqin Zhou
|
|
|
ffd6ed |
(cherry picked from commit 4c73d1d4f142c6f6211c963beea68773e11fd3ef)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
tests/regressions/Makefile.am | 3 +++
|
|
|
ffd6ed |
tests/regressions/rhbz1232192.sh | 56 +++++++++++++++++++++++++++++++++++++++
|
|
|
ffd6ed |
tests/regressions/rhbz1232192.xml | 26 ++++++++++++++++++
|
|
|
ffd6ed |
v2v/v2v.ml | 7 ++++-
|
|
|
ffd6ed |
4 files changed, 91 insertions(+), 1 deletion(-)
|
|
|
ffd6ed |
create mode 100755 tests/regressions/rhbz1232192.sh
|
|
|
ffd6ed |
create mode 100644 tests/regressions/rhbz1232192.xml
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
|
|
|
ffd6ed |
index 72d26da..1cd50b4 100644
|
|
|
ffd6ed |
--- a/tests/regressions/Makefile.am
|
|
|
ffd6ed |
+++ b/tests/regressions/Makefile.am
|
|
|
ffd6ed |
@@ -43,6 +43,8 @@ EXTRA_DIST = \
|
|
|
ffd6ed |
rhbz1054761.sh \
|
|
|
ffd6ed |
rhbz1091803.sh \
|
|
|
ffd6ed |
rhbz1175196.sh \
|
|
|
ffd6ed |
+ rhbz1232192.sh \
|
|
|
ffd6ed |
+ rhbz1232192.xml \
|
|
|
ffd6ed |
test-noexec-stack.pl
|
|
|
ffd6ed |
|
|
|
ffd6ed |
TESTS = \
|
|
|
ffd6ed |
@@ -68,6 +70,7 @@ TESTS = \
|
|
|
ffd6ed |
rhbz1055452 \
|
|
|
ffd6ed |
rhbz1091803.sh \
|
|
|
ffd6ed |
rhbz1175196.sh \
|
|
|
ffd6ed |
+ rhbz1232192.sh \
|
|
|
ffd6ed |
test-noexec-stack.pl
|
|
|
ffd6ed |
|
|
|
ffd6ed |
if HAVE_LIBVIRT
|
|
|
ffd6ed |
diff --git a/tests/regressions/rhbz1232192.sh b/tests/regressions/rhbz1232192.sh
|
|
|
ffd6ed |
new file mode 100755
|
|
|
ffd6ed |
index 0000000..5b4b31e
|
|
|
ffd6ed |
--- /dev/null
|
|
|
ffd6ed |
+++ b/tests/regressions/rhbz1232192.sh
|
|
|
ffd6ed |
@@ -0,0 +1,56 @@
|
|
|
ffd6ed |
+#!/bin/bash -
|
|
|
ffd6ed |
+# libguestfs
|
|
|
ffd6ed |
+# Copyright (C) 2015 Red Hat Inc.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
+# it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
+# (at your option) any later version.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
+# GNU General Public License for more details.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# You should have received a copy of the GNU General Public License
|
|
|
ffd6ed |
+# along with this program; if not, write to the Free Software
|
|
|
ffd6ed |
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+# Regression test for virt-v2v handling of blank disks:
|
|
|
ffd6ed |
+# https://bugzilla.redhat.com/show_bug.cgi?id=1232192
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+set -e
|
|
|
ffd6ed |
+export LANG=C
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ -n "$SKIP_TEST_RHBZ1232192_SH" ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because environment variable is set"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if ! ../../v2v/virt-v2v --help >/dev/null 2>&1; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because virt-v2v was not built"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ "$(guestfish get-backend)" = "uml" ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because UML backend does not support network"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ ! -f ../guests/windows.img ] || [ ! -s ../guests/windows.img ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because tests/guests/windows.img was not built"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ ! -f ../guests/blank-disk.img ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because tests/guests/blank-disk.img was not built"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
|
|
|
ffd6ed |
+if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because rhsrvany.exe is not installed"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+../../v2v/virt-v2v -i libvirtxml rhbz1232192.xml -o null --no-copy
|
|
|
ffd6ed |
diff --git a/tests/regressions/rhbz1232192.xml b/tests/regressions/rhbz1232192.xml
|
|
|
ffd6ed |
new file mode 100644
|
|
|
ffd6ed |
index 0000000..c31ea24
|
|
|
ffd6ed |
--- /dev/null
|
|
|
ffd6ed |
+++ b/tests/regressions/rhbz1232192.xml
|
|
|
ffd6ed |
@@ -0,0 +1,26 @@
|
|
|
ffd6ed |
+<domain type='kvm'>
|
|
|
ffd6ed |
+ <name>rhbz1232192</name>
|
|
|
ffd6ed |
+ <memory>1048576</memory>
|
|
|
ffd6ed |
+ <vcpu>2</vcpu>
|
|
|
ffd6ed |
+ <os>
|
|
|
ffd6ed |
+ <type>hvm</type>
|
|
|
ffd6ed |
+ <boot dev='hd'/>
|
|
|
ffd6ed |
+ </os>
|
|
|
ffd6ed |
+ <features>
|
|
|
ffd6ed |
+ <acpi/>
|
|
|
ffd6ed |
+ <apic/>
|
|
|
ffd6ed |
+ <pae/>
|
|
|
ffd6ed |
+ </features>
|
|
|
ffd6ed |
+ <devices>
|
|
|
ffd6ed |
+ <disk type='file' device='disk'>
|
|
|
ffd6ed |
+ <driver name='qemu' type='raw'/>
|
|
|
ffd6ed |
+ <source file='../guests/windows.img'/>
|
|
|
ffd6ed |
+ <target dev='hda' bus='ide'/>
|
|
|
ffd6ed |
+ </disk>
|
|
|
ffd6ed |
+ <disk type='file' device='disk'>
|
|
|
ffd6ed |
+ <driver name='qemu' type='raw'/>
|
|
|
ffd6ed |
+ <source file='../guests/blank-disk.img'/>
|
|
|
ffd6ed |
+ <target dev='hdb' bus='ide'/>
|
|
|
ffd6ed |
+ </disk>
|
|
|
ffd6ed |
+ </devices>
|
|
|
ffd6ed |
+</domain>
|
|
|
ffd6ed |
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
|
|
|
ffd6ed |
index 859b92a..033d75b 100644
|
|
|
ffd6ed |
--- a/v2v/v2v.ml
|
|
|
ffd6ed |
+++ b/v2v/v2v.ml
|
|
|
ffd6ed |
@@ -549,8 +549,13 @@ and inspect_source ~verbose g root_choice =
|
|
|
ffd6ed |
let rec uefi_ESP_guid = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
|
|
|
ffd6ed |
and is_uefi_ESP dev { G.part_num = partnum } =
|
|
|
ffd6ed |
g#part_get_gpt_type dev (Int32.to_int partnum) = uefi_ESP_guid
|
|
|
ffd6ed |
+ and parttype_is_gpt dev =
|
|
|
ffd6ed |
+ try g#part_get_parttype dev = "gpt"
|
|
|
ffd6ed |
+ with G.Error msg ->
|
|
|
ffd6ed |
+ if verbose then printf "%s (ignored)\n" msg;
|
|
|
ffd6ed |
+ false
|
|
|
ffd6ed |
and is_uefi_bootable_device dev =
|
|
|
ffd6ed |
- g#part_get_parttype dev = "gpt" && (
|
|
|
ffd6ed |
+ parttype_is_gpt dev && (
|
|
|
ffd6ed |
let partitions = Array.to_list (g#part_list dev) in
|
|
|
ffd6ed |
List.exists (is_uefi_ESP dev) partitions
|
|
|
ffd6ed |
)
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|