-o kubevirt: Fix position of cpu field

resolves: rhbz#2162331

-o kubevirt: Fix incorrect error message
resolves: rhbz#2162441

-o kubevirt: Error if invalid guest name on target
resolves: rhbz#2162332

-o kubevirt: Enable -oo compressed option
resolves: rhbz#2162444
This commit is contained in:
Richard W.M. Jones 2023-01-20 10:46:04 +00:00
parent ef9a918d7e
commit f3ab056a8e
26 changed files with 11461 additions and 46 deletions

View File

@ -0,0 +1,27 @@
From 019809794742e1990af3c14b953f8c307f629b7c Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 12 Jan 2023 12:27:26 +0100
Subject: [PATCH] test-v2v-fedora-btrfs-conversion: spell out btrfs feature
group dependency
In case the libguestfs appliance lacks the btrfs feature group, we create
a zero-sized phony Fedora/BTRFS image variant, causing this test case to
fail. In that situation, the test should just be skipped.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
---
tests/test-v2v-fedora-btrfs-conversion.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/test-v2v-fedora-btrfs-conversion.sh b/tests/test-v2v-fedora-btrfs-conversion.sh
index c78f8ae2..14099893 100755
--- a/tests/test-v2v-fedora-btrfs-conversion.sh
+++ b/tests/test-v2v-fedora-btrfs-conversion.sh
@@ -27,5 +27,6 @@ set -x
skip_if_skipped
f=../test-data/phony-guests/fedora-btrfs.img
requires test -f $f
+requires test -s $f
$VG virt-v2v --debug-gc -i disk $f -o null

View File

@ -0,0 +1,78 @@
From 224243b8e26aa299bd99dd24662c4df10a3f612c Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 12 Jan 2023 12:31:10 +0100
Subject: [PATCH] test-v2v-i-ova: spell out ntfs feature group dependency
"windows.img" is created as an empty phony image if the libguestfs
appliance lacks the ntfs feature group.
"tests/Makefile.am" deals well with this, because for the "central"
"windows.vmdk" target, we restrict the VMDK conversion to a non-empty
"windows.img". Subsequently, dependent test cases check for "windows.vmdk"
specifically, and if that file is missing, the tests are skipped (they
exit with code 77).
"test-v2v-i-ova.sh" and "test-v2v-i-ova-directory.sh" are exceptions
however. They perform the same conversion manually (in their own separate
workspace directories). They assume that, if "windows.img" exists, it can
be converted to VMDK. When the image size is zero, the conversion breaks,
and both test cases fail. Skip both tests if "windows.img" is empty.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
[lersek@redhat.com: replace further occurrences of windows.img with $f]
---
tests/test-v2v-i-ova-directory.sh | 7 ++++---
tests/test-v2v-i-ova.sh | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/test-v2v-i-ova-directory.sh b/tests/test-v2v-i-ova-directory.sh
index fff236f5..ec858464 100755
--- a/tests/test-v2v-i-ova-directory.sh
+++ b/tests/test-v2v-i-ova-directory.sh
@@ -25,7 +25,9 @@ set -e
set -x
skip_if_skipped
-requires test -f ../test-data/phony-guests/windows.img
+f=../test-data/phony-guests/windows.img
+requires test -f $f
+requires test -s $f
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
@@ -39,8 +41,7 @@ vmdk=test-ova.vmdk
ovf=test-v2v-i-ova.ovf
mf=test-ova.mf
-qemu-img convert ../test-data/phony-guests/windows.img \
- -O vmdk $d/$vmdk
+qemu-img convert $f -O vmdk $d/$vmdk
cp "$srcdir/$ovf" $d/$ovf
sha1=`do_sha1 $d/$ovf`
echo "SHA1($ovf)= $sha1" > $d/$mf
diff --git a/tests/test-v2v-i-ova.sh b/tests/test-v2v-i-ova.sh
index a55966a7..7d988330 100755
--- a/tests/test-v2v-i-ova.sh
+++ b/tests/test-v2v-i-ova.sh
@@ -25,7 +25,9 @@ set -e
set -x
skip_if_skipped
-requires test -f ../test-data/phony-guests/windows.img
+f=../test-data/phony-guests/windows.img
+requires test -f $f
+requires test -s $f
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
@@ -41,8 +43,7 @@ mf=test-ova.mf
ova=test-ova.ova
raw=TestOva-sda
-qemu-img convert ../test-data/phony-guests/windows.img \
- -O vmdk $d/$vmdk
+qemu-img convert $f -O vmdk $d/$vmdk
cp "$srcdir/$ovf" $d/$ovf
sha1=`do_sha1 $d/$ovf`
echo "SHA1($ovf)= $sha1" > $d/$mf

View File

@ -0,0 +1,44 @@
From d78c3bdcda04885ee7b826a5ce43d07e778641cd Mon Sep 17 00:00:00 2001
From: Jan Kuparinen <copper_fin@hotmail.com>
Date: Fri, 13 Jan 2023 21:20:28 +0100
Subject: [PATCH] Translated using Weblate (Finnish)
Currently translated at 1.9% (25 of 1305 strings)
Translation: libguestfs/virt-v2v-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/virt-v2v-docs-master/fi/
---
po-docs/fi.po | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/po-docs/fi.po b/po-docs/fi.po
index 29d8ee26..5da30f77 100644
--- a/po-docs/fi.po
+++ b/po-docs/fi.po
@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: virt-v2v 1.43.1\n"
"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
"POT-Creation-Date: 2020-08-13 13:17+0200\n"
-"PO-Revision-Date: 2022-01-25 17:16+0000\n"
+"PO-Revision-Date: 2023-01-13 20:20+0000\n"
"Last-Translator: Jan Kuparinen <copper_fin@hotmail.com>\n"
"Language-Team: Finnish <https://translate.fedoraproject.org/projects/"
"libguestfs/virt-v2v-docs-master/fi/>\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.10.1\n"
+"X-Generator: Weblate 4.15\n"
#. type: =end
#: common/mlcustomize/customize-options.pod:1
@@ -4694,7 +4694,7 @@ msgstr ""
#. type: =item
#: docs/virt-v2v-support.pod:86
msgid "Oracle Linux"
-msgstr ""
+msgstr "Oracle Linux"
#. type: =item
#: docs/virt-v2v-support.pod:88

View File

@ -0,0 +1,49 @@
From f395335881974767e4dbdbf73c1abf3bed961f5d Mon Sep 17 00:00:00 2001
From: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Date: Fri, 13 Jan 2023 21:20:28 +0100
Subject: [PATCH] Translated using Weblate (Georgian)
Currently translated at 8.6% (38 of 439 strings)
Translation: libguestfs/virt-v2v-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/virt-v2v-master/ka/
---
po/ka.po | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/po/ka.po b/po/ka.po
index 4dc891df..26d41f6b 100644
--- a/po/ka.po
+++ b/po/ka.po
@@ -6,10 +6,10 @@
msgid ""
msgstr ""
"Project-Id-Version: virt-v2v 2.1.1\n"
-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
-"component=libguestfs&product=Virtualization+Tools\n"
+"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug."
+"cgi?component=libguestfs&product=Virtualization+Tools\n"
"POT-Creation-Date: 2022-12-10 12:01+0000\n"
-"PO-Revision-Date: 2022-12-06 18:19+0000\n"
+"PO-Revision-Date: 2023-01-13 20:20+0000\n"
"Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>\n"
"Language-Team: Georgian <https://translate.fedoraproject.org/projects/"
"libguestfs/virt-v2v-master/ka/>\n"
@@ -18,7 +18,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.14.2\n"
+"X-Generator: Weblate 4.15\n"
#: input/input_ova.ml:134 common/mltools/tools_utils.ml:235
msgid "%s"
@@ -2062,7 +2062,7 @@ msgstr ""
#: common/mltools/getopt-c.c:198
#, c-format
msgid "%s: %s: integer out of range\n"
-msgstr ""
+msgstr "%s: %s: მთელი მნიშვნელობა დიაპაზონს გარეთაა\n"
#: common/mltools/getopt-c.c:388
#, c-format

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
From a9a724e645bef0ec46e14b13348f8401681fc1c6 Mon Sep 17 00:00:00 2001
From: Yuri Chornoivan <yurchor@ukr.net>
Date: Sat, 14 Jan 2023 22:20:05 +0100
Subject: [PATCH] Translated using Weblate (Ukrainian)
Currently translated at 100.0% (441 of 441 strings)
Translation: libguestfs/virt-v2v-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/virt-v2v-master/uk/
---
po/uk.po | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/po/uk.po b/po/uk.po
index bf21a0ed..f524482a 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -12,10 +12,10 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
-"component=libguestfs&product=Virtualization+Tools\n"
+"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug."
+"cgi?component=libguestfs&product=Virtualization+Tools\n"
"POT-Creation-Date: 2023-01-10 14:53+0000\n"
-"PO-Revision-Date: 2022-12-24 19:20+0000\n"
+"PO-Revision-Date: 2023-01-14 21:20+0000\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <https://translate.fedoraproject.org/projects/"
"libguestfs/virt-v2v-master/uk/>\n"
@@ -23,8 +23,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
-"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
+"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.15\n"
#: input/input_ova.ml:134 common/mltools/tools_utils.ml:235
@@ -316,12 +316,10 @@ msgid "-o disk: unknown output option -oo %s"
msgstr "-o disk: невідомий параметр виведення — «-oo %s»"
#: output/output_kubevirt.ml:56
-#, fuzzy
-#| msgid "-o disk: output directory was not specified, use '-os /dir'"
msgid "-o kubevirt: output directory was not specified, use '-os /dir'"
msgstr ""
-"-o disk: не вказано каталогу для виведення даних, скористайтеся «-os /"
-"каталог»"
+"-o kubevirt: не вказано каталогу для виведення даних, скористайтеся «-os "
+"/каталог»"
#: output/output_libvirt.ml:115
msgid ""
@@ -1204,6 +1202,8 @@ msgid ""
"YAML block contains newline character. This should not happen, please "
"report a bug against virt-v2v."
msgstr ""
+"Блок YAML містить символ розриву рядка. Такого не мало трапитися. Будь "
+"ласка, повідомте про цю ваду у virt-v2v."
#: input/input_vddk.ml:98
msgid ""

View File

@ -0,0 +1,34 @@
From e7a243bb4e4f7fd261ebbdf4e2c5f613d8fc4f78 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 16 Jan 2023 12:19:29 +0000
Subject: [PATCH] convert: windows: Remove extraneous blank lines in source
---
convert/convert_windows.ml | 1 -
convert/windows_virtio.ml | 1 -
2 files changed, 2 deletions(-)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 57a7ff03..b0436fe4 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -476,7 +476,6 @@ let convert (g : G.guestfs) _ inspect _ static_ips =
(sprintf "install-%s.ps1" msi_path) !psh_script;
) files
-
and unconfigure_xenpv () =
match xenpv_uninst with
| None -> () (* nothing to be uninstalled *)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index d9fda13f..2ce92ece 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -215,7 +215,6 @@ and copy_qemu_ga g inspect =
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
-
(* Copy all files from virtio_win directory/ISO located in [srcdir]
* subdirectory and all its subdirectories to the [destdir]. The directory
* hierarchy is not preserved, meaning all files will be directly in [destdir].

View File

@ -0,0 +1,30 @@
From 588ee8646f96b648f36c3ef23ef52751aa6bb4f2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 16 Jan 2023 12:22:17 +0000
Subject: [PATCH] convert: windows: Document what copy_qemu_ga function returns
Just updates the comment.
(cherry picked from commit 7499ab10ea387b1dfd6fdd6feb2632b66545a257)
---
convert/windows_virtio.mli | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/convert/windows_virtio.mli b/convert/windows_virtio.mli
index 73ec95c7..82aad69b 100644
--- a/convert/windows_virtio.mli
+++ b/convert/windows_virtio.mli
@@ -39,8 +39,11 @@ val install_drivers
devices if we managed to install those, or legacy devices if we didn't. *)
val copy_qemu_ga : Guestfs.guestfs -> Types.inspect -> string list
-(** copy MSIs (idealy just one) with QEMU Guest Agent to Windows guest. The
- MSIs are not installed by this function. *)
+(** copy MSIs (ideally just one) with QEMU Guest Agent to Windows guest. The
+ MSIs are not installed by this function.
+
+ Returns a list of the copied [*.msi] files (empty list indicates no
+ qemu-ga installer(s) could be located). *)
(**/**)

View File

@ -0,0 +1,25 @@
From 719abef20ee5d4848c8b1380f295c69c49e849d7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 16 Jan 2023 15:12:16 +0000
Subject: [PATCH] convert: windows: Remove unused 'open Utils'
No function from Utils was being used by Windows_virtio, so remove the
unnecessary line.
(cherry picked from commit 26b9cd1f87f06c31cdf3020e003078737a417889)
---
convert/windows_virtio.ml | 1 -
1 file changed, 1 deletion(-)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index 2ce92ece..6b642d21 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -25,7 +25,6 @@ open Common_gettext.Gettext
open Regedit
open Types
-open Utils
module G = Guestfs

View File

@ -0,0 +1,28 @@
From 9043e334056434d0078da92cd639be0c73a3dbc2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 19 Jan 2023 08:51:30 +0000
Subject: [PATCH] -o kubevirt: Fix mistake in error message
The error message was copied from output_local.ml:
virt-v2v: error: -o local: -op option cannot be used in this output mode
Reported-by: Xiaodai Wang
(cherry picked from commit be322ed49b1131e30a0b70f16d31fd29fca32b81)
---
output/output_kubevirt.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/output/output_kubevirt.ml b/output/output_kubevirt.ml
index 63ee8197..0a74dbbe 100644
--- a/output/output_kubevirt.ml
+++ b/output/output_kubevirt.ml
@@ -47,7 +47,7 @@ module Kubevirt = struct
if options.output_options <> [] then
error (f_"no -oo (output options) are allowed here");
if options.output_password <> None then
- error_option_cannot_be_used_in_output_mode "local" "-op";
+ error_option_cannot_be_used_in_output_mode "kubevirt" "-op";
(* -os must be set to a directory. *)
let output_storage =

View File

@ -0,0 +1,46 @@
From b862d1f2864b3c3f2e7161d0c494ef352214d77c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 20 Jan 2023 09:11:52 +0000
Subject: [PATCH] -o kubevirt: Move "cpu" element under "domain"
Apparently this element doesn't go in the obvious place (under
"resources", next to memory), but in a whole new section under "cpu",
which makes no logical sense but here we are. Also verified this
against Kubevirt examples/vm-template-fedora.yaml
Reported-by: Ming Xie
Fixes: commit bfa62b4683d312fc2fa9bb3c08963fc4846831b9
(cherry picked from commit 8db50a85f0363d90918edd1af4fc20ddc245b421)
---
output/create_kubevirt_yaml.ml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/output/create_kubevirt_yaml.ml b/output/create_kubevirt_yaml.ml
index 205e9be3..689555e4 100644
--- a/output/create_kubevirt_yaml.ml
+++ b/output/create_kubevirt_yaml.ml
@@ -65,13 +65,13 @@ let create_kubevirt_yaml source inspect
let memory_str = sprintf "%LdMi" (source.s_memory /^ 1024_L /^ 1024_L) in
List.push_back resources ("requests", Assoc ["memory", String memory_str]);
- (* # vCPUs. XXX vendor, model, topology *)
- List.push_back resources ("cpu", Assoc ["cores", Int source.s_vcpu]);
-
(* Machine features. *)
let features = List.map (fun name -> name, List []) source.s_features in
List.push_back resources ("features", Assoc features);
+ (* # vCPUs. XXX vendor, model, topology *)
+ let cpu = "cpu", Assoc ["cores", Int source.s_vcpu] in
+
(* XXX firmware, display, sound *)
(* XXX guestcaps: rng, balloon, vsock, virtio 1.0 *)
@@ -109,6 +109,7 @@ let create_kubevirt_yaml source inspect
if !devices <> [] then
List.push_back domain ("devices", Assoc !devices);
List.push_back domain ("resources", Assoc !resources);
+ List.push_back domain cpu;
let spec = ref [] in
List.push_back spec ("domain", Assoc !domain);

View File

@ -0,0 +1,51 @@
From dc8b2da235aee9e3fda81fb237c416430e207aea Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 20 Jan 2023 09:49:04 +0000
Subject: [PATCH] -o kubevirt: Error on invalid output guest names
Kubevirt supports something like RFC 1123 names (without the length
restriction). Helpfully it prints the regexp that it uses the
validate the names, so just use the same regexp.
Note that virt-v2v never renames guests (since that would add
unpredictability for automation). You must use the -on option to
rename the guest if the name is wrong. Hence this is an error, not a
warning or an attempt to rename the guest.
Reported-by: Ming Xie
Fixes: commit bfa62b4683d312fc2fa9bb3c08963fc4846831b9
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2162332
(cherry picked from commit 8a9c914544a49bed13eb5baf42290f835bdee7b5)
---
output/output_kubevirt.ml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/output/output_kubevirt.ml b/output/output_kubevirt.ml
index 0a74dbbe..00e6a8a5 100644
--- a/output/output_kubevirt.ml
+++ b/output/output_kubevirt.ml
@@ -29,6 +29,11 @@ open Utils
open Output
open Create_kubevirt_yaml
+(* Valid output names for Kubevirt (RHBZ#2162332). *)
+let rfc1123_re =
+ PCRE.compile ~anchored:true
+ "[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*"
+
module Kubevirt = struct
type poptions = output_allocation * string * string * string
@@ -60,6 +65,12 @@ module Kubevirt = struct
let output_name = Option.default source.s_name options.output_name in
+ if not (PCRE.matches rfc1123_re output_name) then
+ error (f_"-o kubevirt: the guest name must contain only lowercase \
+ alphanumeric characters, '-' or '.', and must start and \
+ end with an alphanumeric character. Rerun virt-v2v with \
+ the '-on name' option to rename it.");
+
options.output_alloc, options.output_format, output_name, output_storage
let setup dir options source =

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
From 1a33a6409d2f12c13314c5b268d314d3e8d0af58 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 20 Jan 2023 10:35:55 +0000
Subject: [PATCH] -o kubevirt: Implement -oo compressed for qcow2 files
Reported-by: Xiaodai Wang
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2162444
Updates: commit 53690a0c602a4286fdb9408fdf6a01cc352697ec
(cherry picked from commit ada18150543466955ff73a24a9b9a66ddfac270e)
---
output/output_kubevirt.ml | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/output/output_kubevirt.ml b/output/output_kubevirt.ml
index d41b5d8e..ee89fdbf 100644
--- a/output/output_kubevirt.ml
+++ b/output/output_kubevirt.ml
@@ -35,7 +35,7 @@ let rfc1123_re =
"[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*"
module Kubevirt = struct
- type poptions = output_allocation * string * string * string
+ type poptions = bool * output_allocation * string * string * string
type t = unit
@@ -46,11 +46,22 @@ module Kubevirt = struct
| None -> ""
let query_output_options () =
- printf (f_"No output options can be used in this mode.\n")
+ printf (f_"Output options that can be used with -o kubevirt:
+
+ -oo compressed Compress the output file (used only with -of qcow2)
+")
+
let parse_options options source =
- if options.output_options <> [] then
- error (f_"no -oo (output options) are allowed here");
+ let compressed = ref false in
+ List.iter (
+ function
+ | "compressed", "" -> compressed := true
+ | "compressed", v -> compressed := bool_of_string v
+ | k, _ ->
+ error (f_"-o kubevirt: unknown output option -oo %s") k
+ ) options.output_options;
+
if options.output_password <> None then
error_option_cannot_be_used_in_output_mode "kubevirt" "-op";
@@ -73,11 +84,13 @@ module Kubevirt = struct
end with an alphanumeric character. Rerun virt-v2v with \
the '-on name' option to rename it.");
- options.output_alloc, options.output_format, output_name, output_storage
+ !compressed, options.output_alloc, options.output_format,
+ output_name, output_storage
let setup dir options source =
let disks = get_disks dir in
- let output_alloc, output_format, output_name, output_storage = options in
+ let compressed, output_alloc, output_format, output_name, output_storage =
+ options in
List.iter (
fun (i, size) ->
@@ -86,11 +99,12 @@ module Kubevirt = struct
(* Create the actual output disk. *)
let outdisk = disk_path output_storage output_name i in
- output_to_local_file output_alloc output_format outdisk size socket
+ output_to_local_file ~compressed output_alloc output_format
+ outdisk size socket
) disks
let finalize dir options () source inspect target_meta =
- let output_alloc, output_format, output_name, output_storage = options in
+ let _, output_alloc, output_format, output_name, output_storage = options in
let doc = create_kubevirt_yaml source inspect target_meta
(disk_path output_storage output_name)

View File

@ -1,4 +1,4 @@
From d68e2f083683c631666cda5c4d13c8d569f7a46b Mon Sep 17 00:00:00 2001
From 456c33311fff18a7def63e0df59255355ab90ce2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Sep 2014 19:14:43 +0100
Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode
@ -16,10 +16,10 @@ support cases.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/output/output_qemu.ml b/output/output_qemu.ml
index 5788fc42..46fd598c 100644
index b667e782..3a57a009 100644
--- a/output/output_qemu.ml
+++ b/output/output_qemu.ml
@@ -141,7 +141,7 @@ module QEMU = struct
@@ -142,7 +142,7 @@ module QEMU = struct
* module deals with shell and qemu comma quoting.
*)
let cmd = Qemuopts.create () in

View File

@ -1,4 +1,4 @@
From 0d8ed33d6cdd6011bed171331cf0b548ce45c18d Mon Sep 17 00:00:00 2001
From 5264e777d8cec0a5537c0a05eb855a1421fb7d0b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Sep 2014 10:50:27 +0100
Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option
@ -81,7 +81,7 @@ index b458607d..246408e7 100644
=item B<--quiet>
diff --git a/output/output_qemu.ml b/output/output_qemu.ml
index 46fd598c..e7efbb73 100644
index 3a57a009..4be9b650 100644
--- a/output/output_qemu.ml
+++ b/output/output_qemu.ml
@@ -65,6 +65,9 @@ module QEMU = struct
@ -95,10 +95,10 @@ index 46fd598c..e7efbb73 100644
let output_storage =
match options.output_storage with
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index fcf5e2d4..27df44e8 100644
index 1e8d03ef..754f2833 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -270,8 +270,6 @@ let rec main () =
@@ -272,8 +272,6 @@ let rec main () =
s_"Same as -ip filename";
[ L"print-source" ], Getopt.Set print_source,
s_"Print source and stop";

View File

@ -1,4 +1,4 @@
From b2ca2747a705cba4d97a9c35d15453e5e78e1c81 Mon Sep 17 00:00:00 2001
From d1838ebb6b188ee43d5bc3dc9edf214afcd62a3e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu
@ -9,7 +9,7 @@ Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/utils.ml b/lib/utils.ml
index 26e7e259..e355eb3e 100644
index 281868b5..e63ec7ce 100644
--- a/lib/utils.ml
+++ b/lib/utils.ml
@@ -60,13 +60,14 @@ let kvm_arch = function

View File

@ -1,4 +1,4 @@
From 46c605335dfb6db59b696e38b7f86b7b5811ac04 Mon Sep 17 00:00:00 2001
From 99411031df0cc6fba47ca85da65372a5acd1b019 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.
@ -14,7 +14,7 @@ In virt-v2v helpers we must set the program name to virt-v2v.
5 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 8d62f6d4..a1bfdcee 100644
index d0d5b773..c3dd4151 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -51,6 +51,7 @@ let rec convert dir options source =
@ -26,10 +26,10 @@ index 8d62f6d4..a1bfdcee 100644
(* Setting the number of vCPUs allows parallel mkinitrd, but make
* sure this is not too large because each vCPU consumes guest RAM.
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index d9fda13f..c97e3fce 100644
index 6b642d21..2cef4234 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -258,6 +258,7 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
@@ -256,6 +256,7 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
let g2 =
try
let g2 = open_guestfs ~identifier:"virtio_win" () in

View File

@ -1,4 +1,4 @@
From cf946574bfea15242fa0367bf4ccf9ed4b7790d0 Mon Sep 17 00:00:00 2001
From 45832935e743f9a4bad1982cd8df97e12fa2e7cd Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2017 14:21:37 +0100
Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)
@ -9,10 +9,10 @@ The SDL output mode is not supported in RHEL's qemu-kvm.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/input_disk.ml b/input/input_disk.ml
index 508adf9d..20f2e898 100644
index 279250fe..c6b819c0 100644
--- a/input/input_disk.ml
+++ b/input/input_disk.ml
@@ -76,7 +76,7 @@ module Disk = struct
@@ -77,7 +77,7 @@ module Disk = struct
s_features = [ "acpi"; "apic"; "pae" ];
s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *)
s_display =

View File

@ -1,4 +1,4 @@
From 588cb7ba9e87d35e91bacbc95a1044969d3964e3 Mon Sep 17 00:00:00 2001
From dc4a660a52c9b0fbb1b49b3c523a2f3efa99e042 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 8 Mar 2017 11:03:40 +0100
Subject: [PATCH] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)

View File

@ -1,4 +1,4 @@
From 52311a826b2a1f1e6d3a2bb0f20ed39e4dd57c5c Mon Sep 17 00:00:00 2001
From 923520c3e416411ea091cbfa49350aad29966208 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 09:42:25 +0100
Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests

View File

@ -1,4 +1,4 @@
From 3102ba0d304f3d0ad216f9f67cb554fb385cac26 Mon Sep 17 00:00:00 2001
From d5f963ddc494ef105b587e1f5b936c25f93272e6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH] RHEL: Disable -o glance
@ -169,10 +169,10 @@ index c0db9115..074b5e16 100755
set -e
set -x
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 27df44e8..fc5b8af0 100644
index 754f2833..710e36fd 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -192,7 +192,6 @@ let rec main () =
@@ -194,7 +194,6 @@ let rec main () =
if !output_mode <> `Not_set then
error (f_"%s option used more than once on the command line") "-o";
match mode with
@ -180,7 +180,7 @@ index 27df44e8..fc5b8af0 100644
| "kubevirt" -> output_mode := `Kubevirt
| "libvirt" -> output_mode := `Libvirt
| "disk" | "local" -> output_mode := `Disk
@@ -250,7 +249,7 @@ let rec main () =
@@ -252,7 +251,7 @@ let rec main () =
s_"Map network in to out";
[ L"no-trim" ], Getopt.String ("-", no_trim_warning),
s_"Ignored for backwards compatibility";
@ -189,7 +189,7 @@ index 27df44e8..fc5b8af0 100644
s_"Set output mode (default: libvirt)";
[ M"oa" ], Getopt.String ("sparse|preallocated", set_output_alloc),
s_"Set output allocation mode";
@@ -318,8 +317,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
@@ -320,8 +319,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
virt-v2v -i disk disk.img -o local -os /var/tmp
@ -198,7 +198,7 @@ index 27df44e8..fc5b8af0 100644
There is a companion front-end called \"virt-p2v\" which comes as an
ISO or CD image that can be booted on physical machines.
@@ -387,7 +384,6 @@ read the man page virt-v2v(1).
@@ -390,7 +387,6 @@ read the man page virt-v2v(1).
pr "input:libvirtxml\n";
pr "input:ova\n";
pr "input:vmx\n";
@ -206,7 +206,7 @@ index 27df44e8..fc5b8af0 100644
pr "output:kubevirt\n";
pr "output:libvirt\n";
pr "output:local\n";
@@ -481,7 +477,6 @@ read the man page virt-v2v(1).
@@ -487,7 +483,6 @@ read the man page virt-v2v(1).
| `Disk -> (module Output_disk.Disk)
| `Null -> (module Output_null.Null)
| `QEmu -> (module Output_qemu.QEMU)

View File

@ -1,4 +1,4 @@
From 24cabe5685464c9065adb11ed186ddaad7e465dc Mon Sep 17 00:00:00 2001
From 2bd0519c7d3dd24d966dcfc85f27e1822b20c579 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Dec 2021 11:56:05 +0000
Subject: [PATCH] RHEL: Remove the --in-place option
@ -57,10 +57,10 @@ index a4c87398..998b871d 100644
test-v2v-mac.sh \
test-v2v-machine-readable.sh \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index fc5b8af0..f60c82f3 100644
index 710e36fd..72ab21d3 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -214,12 +214,6 @@ let rec main () =
@@ -216,12 +216,6 @@ let rec main () =
warning (f_"the --vmtype option has been removed and now does nothing")
in
@ -73,7 +73,7 @@ index fc5b8af0..f60c82f3 100644
let argspec = [
[ L"bandwidth" ], Getopt.String ("bps", set_string_option_once "--bandwidth" bandwidth),
s_"Set bandwidth to bits per sec";
@@ -241,8 +235,6 @@ let rec main () =
@@ -243,8 +237,6 @@ let rec main () =
s_"Use password from file to connect to input hypervisor";
[ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport),
s_"Input transport";

View File

@ -1,4 +1,4 @@
From 7ee1a1d7a52772dac78cbf060b4303d6987b675b Mon Sep 17 00:00:00 2001
From 5ace3b9ec5fab62322356a293585b4e5804e1736 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:56:54 +0100
Subject: [PATCH] RHEL 9: -oo compressed: Remove nbdcopy version check and test
@ -12,10 +12,10 @@ separately. Thus remove the version check and test.
2 files changed, 12 deletions(-)
diff --git a/output/output.ml b/output/output.ml
index 6065e592..8f83a324 100644
index e419c13d..c8f743c2 100644
--- a/output/output.ml
+++ b/output/output.ml
@@ -86,17 +86,6 @@ let output_to_local_file ?(changeuid = fun f -> f ()) ?(compressed = false)
@@ -87,17 +87,6 @@ let output_to_local_file ?(changeuid = fun f -> f ()) ?(compressed = false)
if output_format <> "qcow2" then
error (f_"-oo compressed is only allowed when the output format \
is a local qcow2-format file, i.e. -of qcow2");

View File

@ -1,4 +1,4 @@
From b564aa5af395dcc6eddfd0a659cb8d7fc3e16920 Mon Sep 17 00:00:00 2001
From 6e015aaba7b8b05976c8aae2d3d1bb419990246d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:58:09 +0100
Subject: [PATCH] RHEL 9: tests: Remove btrfs test

View File

@ -16,7 +16,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.2.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -36,17 +36,31 @@ Source3: copy-patches.sh
# https://github.com/libguestfs/virt-v2v/commits/rhel-9.2
# Patches.
Patch0001: 0001-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0002: 0002-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0003: 0003-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0004: 0004-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0005: 0005-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0006: 0006-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0007: 0007-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0008: 0008-RHEL-Disable-o-glance.patch
Patch0009: 0009-RHEL-Remove-the-in-place-option.patch
Patch0010: 0010-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0011: 0011-RHEL-9-tests-Remove-btrfs-test.patch
Patch0001: 0001-test-v2v-fedora-btrfs-conversion-spell-out-btrfs-fea.patch
Patch0002: 0002-test-v2v-i-ova-spell-out-ntfs-feature-group-dependen.patch
Patch0003: 0003-Translated-using-Weblate-Finnish.patch
Patch0004: 0004-Translated-using-Weblate-Georgian.patch
Patch0005: 0005-Update-translation-files.patch
Patch0006: 0006-Translated-using-Weblate-Ukrainian.patch
Patch0007: 0007-convert-windows-Remove-extraneous-blank-lines-in-sou.patch
Patch0008: 0008-convert-windows-Document-what-copy_qemu_ga-function-.patch
Patch0009: 0009-convert-windows-Remove-unused-open-Utils.patch
Patch0010: 0010-o-kubevirt-Fix-mistake-in-error-message.patch
Patch0011: 0011-o-kubevirt-Move-cpu-element-under-domain.patch
Patch0012: 0012-o-kubevirt-Error-on-invalid-output-guest-names.patch
Patch0013: 0013-Split-long-lines-in-messages.patch
Patch0014: 0014-o-kubevirt-Implement-oo-compressed-for-qcow2-files.patch
Patch0015: 0015-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0016: 0016-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0017: 0017-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0018: 0018-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0019: 0019-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0020: 0020-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0021: 0021-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0022: 0022-RHEL-Disable-o-glance.patch
Patch0023: 0023-RHEL-Remove-the-in-place-option.patch
Patch0024: 0024-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0025: 0025-RHEL-9-tests-Remove-btrfs-test.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -335,7 +349,7 @@ done
%changelog
* Tue Jan 10 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.2.0-1
* Fri Jan 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.2.0-2
- Rebase to virt-v2v 2.2.0
resolves: rhbz#2135762
- Copy drivers for Windows 11, Windows 2019 & Windows 2022
@ -352,6 +366,14 @@ done
- -o rhv-upload: set ovirt:id correctly
resolves: rhbz#2152465
- Enable the %%check tests
- -o kubevirt: Fix position of cpu field
resolves: rhbz#2162331
- -o kubevirt: Fix incorrect error message
resolves: rhbz#2162441
- -o kubevirt: Error if invalid guest name on target
resolves: rhbz#2162332
- -o kubevirt: Enable -oo compressed option
resolves: rhbz#2162444
* Thu Aug 18 2022 Laszlo Ersek <lersek@redhat.com> - 1:2.0.7-6
- Install qemu-ga package during conversion