Skip to content

Commit a9832bd

Browse files
persist NIC device names on RHEL9
1 parent 747fddc commit a9832bd

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

pkg/daemon/daemon.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,10 +1990,12 @@ func removeIgnitionArtifacts() error {
19901990
return nil
19911991
}
19921992

1993-
// PersistNetworkInterfaces runs if the host is RHEL8, which can happen
1994-
// when scaling up older bootimages and targeting 4.13+ (rhel9). In this case,
1993+
// PersistNetworkInterfaces runs if the host is RHEL8 or RHEL9, which can happen
1994+
// when scaling up older bootimages and targeting newer RHEL versions. In this case,
19951995
// we may want to pin NIC interface names that reference static IP addresses.
1996-
// More information in https://issues.redhat.com/browse/OCPBUGS-10787
1996+
// More information:
1997+
// - RHEL 8→9 transition: https://issues.redhat.com/browse/OCPBUGS-10787
1998+
// - RHEL 9→10 transition: https://issues.redhat.com/browse/OCPBUGS-63593
19971999
func PersistNetworkInterfaces(osRoot string) error {
19982000
hostos, err := osrelease.GetHostRunningOSFromRoot(osRoot)
19992001
if err != nil {
@@ -2012,8 +2014,8 @@ func PersistNetworkInterfaces(osRoot string) error {
20122014
// likely this NIC pinning should actually be driven automatically by
20132015
// host updates. If you change this, you'll need to change the conditions
20142016
// below too.
2015-
persisting := hostos.IsEL8()
2016-
cleanup := hostos.IsEL9()
2017+
persisting := hostos.IsEL8() || hostos.IsEL9()
2018+
cleanup := hostos.IsEL10()
20172019
if !(persisting || cleanup) {
20182020
return nil
20192021
}
@@ -2028,11 +2030,16 @@ func PersistNetworkInterfaces(osRoot string) error {
20282030

20292031
switch {
20302032
case persisting:
2031-
klog.Info("Persisting NIC names for RHEL8 host system")
2033+
if hostos.IsEL8() {
2034+
klog.Info("Persisting NIC names for RHEL8 host system (RHEL8→9 transition)")
2035+
} else if hostos.IsEL9() {
2036+
klog.Info("Persisting NIC names for RHEL9 host system (RHEL9→10 transition)")
2037+
}
20322038
case cleanup:
2039+
klog.Info("Cleaning up NIC name persistence for RHEL10 host system")
20332040
cmd.Args = append(cmd.Args, "--cleanup")
20342041
default:
2035-
return fmt.Errorf("Unexpected host OS %s", hostos.ToPrometheusLabel())
2042+
return fmt.Errorf("unexpected host OS %s", hostos.ToPrometheusLabel())
20362043
}
20372044

20382045
// nmstate always logs to stderr, so we need to capture/forward that too

0 commit comments

Comments
 (0)