Allow virt-v2v --mac gw and len fields to be optional
resolves: RHEL-50731
This commit is contained in:
parent
b8698aba17
commit
300e8d4355
124
0016-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch
Normal file
124
0016-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch
Normal file
@ -0,0 +1,124 @@
|
||||
From bc48a548e753d6c9108bdecb9d6a711617521c23 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 28 Jul 2024 14:49:42 +0100
|
||||
Subject: [PATCH] v2v: --mac: Allow gw and len fields to be empty
|
||||
|
||||
Even if these appear in the middle of the list, allow them to be
|
||||
empty. For example this is now permitted whereas previously it was an
|
||||
error:
|
||||
|
||||
virt-v2v --mac <MAC>:ip:<ADDR>,,,nameserver
|
||||
|
||||
Reported-by: Arik Hadas
|
||||
(cherry picked from commit 159fda411d2f75b087106e7293d273ae142c9fbe)
|
||||
---
|
||||
in-place/in_place.ml | 12 +++++++-----
|
||||
inspector/inspector.ml | 12 +++++++-----
|
||||
v2v/v2v.ml | 12 +++++++-----
|
||||
3 files changed, 21 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
|
||||
index b74dbc8a..d55f49a0 100644
|
||||
--- a/in-place/in_place.ml
|
||||
+++ b/in-place/in_place.ml
|
||||
@@ -90,10 +90,10 @@ let rec main () =
|
||||
| "ip" ->
|
||||
(match String.nsplit "," out with
|
||||
| [] -> error (f_"invalid --mac ip option")
|
||||
- | [ip] -> add_static_ip mac ip None None []
|
||||
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
|
||||
+ | [ip] -> add_static_ip mac ip "" "" []
|
||||
+ | [ip; gw] -> add_static_ip mac ip gw "" []
|
||||
| ip :: gw :: len :: nameservers ->
|
||||
- add_static_ip mac ip (Some gw) (Some len) nameservers
|
||||
+ add_static_ip mac ip gw len nameservers
|
||||
)
|
||||
| _ -> assert false
|
||||
and add_static_ip if_mac_addr if_ip_address if_default_gateway
|
||||
@@ -108,12 +108,14 @@ let rec main () =
|
||||
an IP address") what addr
|
||||
in
|
||||
error_unless_ip_addr "ipaddr" if_ip_address;
|
||||
+ let if_default_gateway =
|
||||
+ match if_default_gateway with "" -> None | gw -> Some gw in
|
||||
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
|
||||
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
|
||||
let if_prefix_length =
|
||||
match if_prefix_length_str with
|
||||
- | None -> None
|
||||
- | Some len ->
|
||||
+ | "" -> None
|
||||
+ | len ->
|
||||
let len =
|
||||
try int_of_string len with
|
||||
| Failure _ -> error (f_"cannot parse --mac ip prefix length \
|
||||
diff --git a/inspector/inspector.ml b/inspector/inspector.ml
|
||||
index c79dd687..7c9d2919 100644
|
||||
--- a/inspector/inspector.ml
|
||||
+++ b/inspector/inspector.ml
|
||||
@@ -97,10 +97,10 @@ let rec main () =
|
||||
| "ip" ->
|
||||
(match String.nsplit "," out with
|
||||
| [] -> error (f_"invalid --mac ip option")
|
||||
- | [ip] -> add_static_ip mac ip None None []
|
||||
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
|
||||
+ | [ip] -> add_static_ip mac ip "" "" []
|
||||
+ | [ip; gw] -> add_static_ip mac ip gw "" []
|
||||
| ip :: gw :: len :: nameservers ->
|
||||
- add_static_ip mac ip (Some gw) (Some len) nameservers
|
||||
+ add_static_ip mac ip gw len nameservers
|
||||
)
|
||||
| _ -> assert false
|
||||
and add_static_ip if_mac_addr if_ip_address if_default_gateway
|
||||
@@ -115,12 +115,14 @@ let rec main () =
|
||||
is an IP address") what addr
|
||||
in
|
||||
error_unless_ip_addr "ipaddr" if_ip_address;
|
||||
+ let if_default_gateway =
|
||||
+ match if_default_gateway with "" -> None | gw -> Some gw in
|
||||
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
|
||||
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
|
||||
let if_prefix_length =
|
||||
match if_prefix_length_str with
|
||||
- | None -> None
|
||||
- | Some len ->
|
||||
+ | "" -> None
|
||||
+ | len ->
|
||||
let len =
|
||||
try int_of_string len with
|
||||
| Failure _ -> error (f_"cannot parse --mac ip prefix \
|
||||
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
|
||||
index 89c08fc5..6d9e3792 100644
|
||||
--- a/v2v/v2v.ml
|
||||
+++ b/v2v/v2v.ml
|
||||
@@ -109,10 +109,10 @@ let rec main () =
|
||||
| "ip" ->
|
||||
(match String.nsplit "," out with
|
||||
| [] -> error (f_"invalid --mac ip option")
|
||||
- | [ip] -> add_static_ip mac ip None None []
|
||||
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
|
||||
+ | [ip] -> add_static_ip mac ip "" "" []
|
||||
+ | [ip; gw] -> add_static_ip mac ip gw "" []
|
||||
| ip :: gw :: len :: nameservers ->
|
||||
- add_static_ip mac ip (Some gw) (Some len) nameservers
|
||||
+ add_static_ip mac ip gw len nameservers
|
||||
)
|
||||
| _ -> assert false
|
||||
and add_static_ip if_mac_addr if_ip_address if_default_gateway
|
||||
@@ -127,12 +127,14 @@ let rec main () =
|
||||
is an IP address") what addr
|
||||
in
|
||||
error_unless_ip_addr "ipaddr" if_ip_address;
|
||||
+ let if_default_gateway =
|
||||
+ match if_default_gateway with "" -> None | gw -> Some gw in
|
||||
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
|
||||
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
|
||||
let if_prefix_length =
|
||||
match if_prefix_length_str with
|
||||
- | None -> None
|
||||
- | Some len ->
|
||||
+ | "" -> None
|
||||
+ | len ->
|
||||
let len =
|
||||
try int_of_string len with
|
||||
| Failure _ -> error (f_"cannot parse --mac ip prefix length field \
|
@ -8,7 +8,7 @@
|
||||
Name: virt-v2v
|
||||
Epoch: 1
|
||||
Version: 2.5.5
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Convert a virtual machine to run on KVM
|
||||
|
||||
License: GPL-2.0-or-later AND LGPL-2.0-or-later
|
||||
@ -43,6 +43,7 @@ Patch0012: 0012-RHEL-9-Remove-block-driver-option.patch
|
||||
Patch0013: 0013-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
|
||||
Patch0014: 0014-i-ova-Ignore-dot-underscore-files-in-OVA-files.patch
|
||||
Patch0015: 0015-Update-common-submodule.patch
|
||||
Patch0016: 0016-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch
|
||||
|
||||
%if !0%{?rhel}
|
||||
# libguestfs hasn't been built on i686 for a while since there is no
|
||||
@ -346,6 +347,10 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Jul 28 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-3
|
||||
- Allow virt-v2v --mac gw and len fields to be optional
|
||||
resolves: RHEL-50731
|
||||
|
||||
* Thu Jul 25 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-2
|
||||
- Fix installation of QEMU Guest Agent
|
||||
resolves: RHEL-49761
|
||||
|
Loading…
Reference in New Issue
Block a user