Remove ties to MAC address because it is likely to change.
The code is based on operations net-hwaddr and udev-persistent-net of
virt-sysprep.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/convert_linux.ml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index b273785e6..8bba74786 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -88,6 +88,8 @@ let convert (g : G.guestfs) inspect source output rcaps =
unconfigure_kudzu ();
unconfigure_prltools ();
+ sysprep_networking();
+
let kernel = configure_kernel () in
if output#keep_serial_console then (
@@ -452,6 +454,21 @@ let convert (g : G.guestfs) inspect source output rcaps =
msg
)
+ and sysprep_networking () =
+ if family = `RHEL_family then
+ (* Remove HWADDR=... entries from ifcfg-* files. *)
+ let paths = g#aug_match
+ "/files/etc/sysconfig/network-scripts/*[label() =~
glob('ifcfg-*')]/HWADDR" in
+ let paths = Array.to_list paths in
+ if paths <> [] then (
+ List.iter (fun path -> ignore (g#aug_rm path)) paths;
+ g#aug_save ()
+ );
+ (* Remove persistent udev rules. *)
+ try g#rm "/etc/udev/rules.d/70-persistent-net.rules"
+ with G.Error _ -> ()
+
+
and configure_kernel () =
(* Previously this function would try to install kernels, but we
* don't do that any longer.
--
2.16.1