Update for: -o kubevirt: Error if invalid guest name on target

resolves: rhbz#2162332
This commit is contained in:
Richard W.M. Jones 2023-01-30 09:52:55 +00:00
parent f3ab056a8e
commit 0d5af3e0fc
23 changed files with 134 additions and 36 deletions

View File

@ -1,4 +1,4 @@
From a9a724e645bef0ec46e14b13348f8401681fc1c6 Mon Sep 17 00:00:00 2001
From e8c61da73b62b6acf13543e9421db0b0e2a43a1a 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)

View File

@ -1,4 +1,4 @@
From e7a243bb4e4f7fd261ebbdf4e2c5f613d8fc4f78 Mon Sep 17 00:00:00 2001
From fd9694a3a2ea2911335cd3a85558a92b14d946fc 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

View File

@ -1,4 +1,4 @@
From 588ee8646f96b648f36c3ef23ef52751aa6bb4f2 Mon Sep 17 00:00:00 2001
From 9a5c900fdb532d553a78339a6887417dd6de70e5 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

View File

@ -1,4 +1,4 @@
From 719abef20ee5d4848c8b1380f295c69c49e849d7 Mon Sep 17 00:00:00 2001
From 48f15935cff53836eae4c1c9afb0be8ab4f13bea 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'

View File

@ -1,4 +1,4 @@
From 9043e334056434d0078da92cd639be0c73a3dbc2 Mon Sep 17 00:00:00 2001
From 4623b2aab891fdbeda0486ad00f1fa2a7f5533fe 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

View File

@ -1,4 +1,4 @@
From b862d1f2864b3c3f2e7161d0c494ef352214d77c Mon Sep 17 00:00:00 2001
From 6b7ef3efe748a72edad0faa508e91b340038a586 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"

View File

@ -1,4 +1,4 @@
From dc8b2da235aee9e3fda81fb237c416430e207aea Mon Sep 17 00:00:00 2001
From 8009825c396358137576af522acc0b6b20243bac 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

View File

@ -1,4 +1,4 @@
From 3d5777e5c7e44f2d1b5a2e3d6c41d249921c48e2 Mon Sep 17 00:00:00 2001
From bcd60820de1256ef4c36ced54efa1243902411f7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 20 Jan 2023 09:58:10 +0000
Subject: [PATCH] Split long lines in messages

View File

@ -1,4 +1,4 @@
From 1a33a6409d2f12c13314c5b268d314d3e8d0af58 Mon Sep 17 00:00:00 2001
From 64a86bb9ef0298496a992a3a76d190b3895ffeee 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

View File

@ -0,0 +1,62 @@
From 8802e8b4135c913f206508c8f7650a9f99ee6667 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 30 Jan 2023 09:17:33 +0000
Subject: [PATCH] v2v: Remove use of ~anchored
In various places we used PCRE.compile ~anchored:true (PCRE2_ANCHORED)
thinking it means that the regular expression is anchored at both
ends. However this is not what it means (it only anchors the start).
Replace with ^...$
(cherry picked from commit 8c316ed125e26583edc72eb9e953499b0078dcbd)
---
in-place/in_place.ml | 4 ++--
inspector/inspector.ml | 4 ++--
v2v/v2v.ml | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
index 55541814..f76651e6 100644
--- a/in-place/in_place.ml
+++ b/in-place/in_place.ml
@@ -29,8 +29,8 @@ open Types
open Utils
(* Matches --mac command line parameters. *)
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
let rec main () =
let set_string_option_once optname optref arg =
diff --git a/inspector/inspector.ml b/inspector/inspector.ml
index 13d58df3..d12d85c2 100644
--- a/inspector/inspector.ml
+++ b/inspector/inspector.ml
@@ -30,8 +30,8 @@ open Utils
open DOM
(* Matches --mac command line parameters. *)
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
let rec main () =
let set_string_option_once optname optref arg =
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1e8d03ef..7a01eab5 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -34,8 +34,8 @@ open Types
open Utils
(* Matches --mac command line parameters. *)
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
let rec main () =
let set_string_option_once optname optref arg =

View File

@ -0,0 +1,34 @@
From 628ee708464ee3d266609167c48e92f883849e4d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 30 Jan 2023 09:01:38 +0000
Subject: [PATCH] -o kubevirt: Replace PCRE ~anchored with ^...$
Because this regexp was not anchored at both ends it would still
report a match for incorrect names.
Fixes: commit 8a9c914544a49bed13eb5baf42290f835bdee7b5
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2162332
Reported-by: Ming Xie
Cherry picked from commit 050a0ba714ddf2a5d81515c886032016aa75342c.
I did not include the update to the common module since picking that
would pull in the large changes made to the virtio driver code.
---
output/output_kubevirt.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/output/output_kubevirt.ml b/output/output_kubevirt.ml
index ee89fdbf..fdf0f279 100644
--- a/output/output_kubevirt.ml
+++ b/output/output_kubevirt.ml
@@ -31,8 +31,8 @@ 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])?)*"
+ PCRE.compile
+ "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
module Kubevirt = struct
type poptions = bool * output_allocation * string * string * string

View File

@ -1,4 +1,4 @@
From 456c33311fff18a7def63e0df59255355ab90ce2 Mon Sep 17 00:00:00 2001
From c26749ef9c143412240cae87f34966adb2210aea 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

View File

@ -1,4 +1,4 @@
From 5264e777d8cec0a5537c0a05eb855a1421fb7d0b Mon Sep 17 00:00:00 2001
From 3efe400625777a68d25c49ed53e4494076ffa9b8 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
@ -95,7 +95,7 @@ index 3a57a009..4be9b650 100644
let output_storage =
match options.output_storage with
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1e8d03ef..754f2833 100644
index 7a01eab5..dc747804 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -272,8 +272,6 @@ let rec main () =

View File

@ -1,4 +1,4 @@
From d1838ebb6b188ee43d5bc3dc9edf214afcd62a3e Mon Sep 17 00:00:00 2001
From 8d0779e4d215a09dedd25d19fb7b93da8110337e 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

View File

@ -1,4 +1,4 @@
From 99411031df0cc6fba47ca85da65372a5acd1b019 Mon Sep 17 00:00:00 2001
From bcf3dd9c7e706609154f49c25e2b78dece00aabd 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.

View File

@ -1,4 +1,4 @@
From 45832935e743f9a4bad1982cd8df97e12fa2e7cd Mon Sep 17 00:00:00 2001
From e555a807bd17d08dba5cb204cd894e15e135bc32 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)

View File

@ -1,4 +1,4 @@
From dc4a660a52c9b0fbb1b49b3c523a2f3efa99e042 Mon Sep 17 00:00:00 2001
From d389a25c7711b174a76c324efa1e5a2146bc4f59 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 923520c3e416411ea091cbfa49350aad29966208 Mon Sep 17 00:00:00 2001
From bb4f536cfc6a368827d7e5936575d939643fb3c3 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 d5f963ddc494ef105b587e1f5b936c25f93272e6 Mon Sep 17 00:00:00 2001
From b589e79c9fc420855e56508992ed5f0cffd48758 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,7 +169,7 @@ index c0db9115..074b5e16 100755
set -e
set -x
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 754f2833..710e36fd 100644
index dc747804..392c3dad 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -194,7 +194,6 @@ let rec main () =

View File

@ -1,4 +1,4 @@
From 2bd0519c7d3dd24d966dcfc85f27e1822b20c579 Mon Sep 17 00:00:00 2001
From 921197415a9e1831f0c18bde15ead39f029d1db2 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,7 +57,7 @@ index a4c87398..998b871d 100644
test-v2v-mac.sh \
test-v2v-machine-readable.sh \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 710e36fd..72ab21d3 100644
index 392c3dad..18a694ee 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -216,12 +216,6 @@ let rec main () =

View File

@ -1,4 +1,4 @@
From 5ace3b9ec5fab62322356a293585b4e5804e1736 Mon Sep 17 00:00:00 2001
From bfe11996c25e6dd69bd34601a651f4eff04b0722 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

View File

@ -1,4 +1,4 @@
From 6e015aaba7b8b05976c8aae2d3d1bb419990246d Mon Sep 17 00:00:00 2001
From d5b8d7cbada2bd71764b980e47c232da3c642ad4 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: 2%{?dist}
Release: 3%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -50,17 +50,19 @@ 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
Patch0015: 0015-v2v-Remove-use-of-anchored.patch
Patch0016: 0016-o-kubevirt-Replace-PCRE-anchored-with.patch
Patch0017: 0017-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0018: 0018-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0019: 0019-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0020: 0020-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0021: 0021-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0022: 0022-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0023: 0023-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0024: 0024-RHEL-Disable-o-glance.patch
Patch0025: 0025-RHEL-Remove-the-in-place-option.patch
Patch0026: 0026-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0027: 0027-RHEL-9-tests-Remove-btrfs-test.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -349,7 +351,7 @@ done
%changelog
* Fri Jan 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.2.0-2
* Mon Jan 30 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.2.0-3
- Rebase to virt-v2v 2.2.0
resolves: rhbz#2135762
- Copy drivers for Windows 11, Windows 2019 & Windows 2022