|
Harald Hoyer |
ab65ae |
From e173f0b384f699c2519db879f3f562b1f6676d8d Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
ab65ae |
From: Will Woods <wwoods@redhat.com>
|
|
Harald Hoyer |
ab65ae |
Date: Thu, 5 Apr 2012 13:01:37 -0400
|
|
Harald Hoyer |
ab65ae |
Subject: [PATCH] network: add save_netinfo, fix problems with nfs->NM
|
|
Harald Hoyer |
ab65ae |
takeover
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
For NetworkManager to properly take over a NFS-root system, we need to
|
|
Harald Hoyer |
ab65ae |
have the interface name(s) in /tmp/net.ifaces and save the dhclient
|
|
Harald Hoyer |
ab65ae |
lease. This lets the ifcfg module do its magic.
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
save_netinfo should properly write out /tmp/net.ifaces when needed, and
|
|
Harald Hoyer |
ab65ae |
copies the dhclient files into place.
|
|
Harald Hoyer |
ab65ae |
---
|
|
Harald Hoyer |
ab65ae |
modules.d/40network/net-lib.sh | 16 ++++++++++++++++
|
|
Harald Hoyer |
ab65ae |
modules.d/40network/netroot.sh | 10 ++--------
|
|
Harald Hoyer |
0c26bf |
2 Dateien geändert, 18 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
ab65ae |
index a7abe81..c0f73da 100644
|
|
Harald Hoyer |
ab65ae |
--- a/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
ab65ae |
+++ b/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
ab65ae |
@@ -105,6 +105,22 @@ setup_net() {
|
|
Harald Hoyer |
ab65ae |
> /tmp/net.$netif.did-setup
|
|
Harald Hoyer |
ab65ae |
}
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
+save_netinfo() {
|
|
Harald Hoyer |
ab65ae |
+ local netif="$1" IFACES="" f="" i=""
|
|
Harald Hoyer |
ab65ae |
+ [ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
|
Harald Hoyer |
ab65ae |
+ # Add $netif to the front of IFACES (if it's not there already).
|
|
Harald Hoyer |
ab65ae |
+ set -- "$netif"
|
|
Harald Hoyer |
ab65ae |
+ for i in $IFACES; do [ "$i" != "$netif" ] && set -- "$@" "$i"; done
|
|
Harald Hoyer |
ab65ae |
+ IFACES="$*"
|
|
Harald Hoyer |
ab65ae |
+ for i in $IFACES; do
|
|
Harald Hoyer |
ab65ae |
+ for f in /tmp/dhclient.$i.*; do
|
|
Harald Hoyer |
ab65ae |
+ [ -f $f ] && cp -f $f /tmp/net.${f#/tmp/dhclient.}
|
|
Harald Hoyer |
ab65ae |
+ done
|
|
Harald Hoyer |
ab65ae |
+ done
|
|
Harald Hoyer |
ab65ae |
+ echo $IFACES > /tmp/.net.ifaces.new
|
|
Harald Hoyer |
ab65ae |
+ mv /tmp/.net.ifaces.new /tmp/net.ifaces
|
|
Harald Hoyer |
ab65ae |
+}
|
|
Harald Hoyer |
ab65ae |
+
|
|
Harald Hoyer |
ab65ae |
set_ifname() {
|
|
Harald Hoyer |
ab65ae |
local name="$1" mac="$2" num=0 n=""
|
|
Harald Hoyer |
ab65ae |
# if it's already set, return the existing name
|
|
Harald Hoyer |
ab65ae |
diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh
|
|
Harald Hoyer |
ab65ae |
index ac1c215..1bb62bb 100755
|
|
Harald Hoyer |
ab65ae |
--- a/modules.d/40network/netroot.sh
|
|
Harald Hoyer |
ab65ae |
+++ b/modules.d/40network/netroot.sh
|
|
Harald Hoyer |
ab65ae |
@@ -84,14 +84,8 @@ source_hook netroot
|
|
Harald Hoyer |
ab65ae |
# Run the handler; don't store the root, it may change from device to device
|
|
Harald Hoyer |
ab65ae |
# XXX other variables to export?
|
|
Harald Hoyer |
ab65ae |
if $handler $netif $netroot $NEWROOT; then
|
|
Harald Hoyer |
ab65ae |
- # Network rootfs mount successful
|
|
Harald Hoyer |
ab65ae |
- for iface in $IFACES ; do
|
|
Harald Hoyer |
ab65ae |
- [ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
|
|
Harald Hoyer |
ab65ae |
- [ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
|
|
Harald Hoyer |
ab65ae |
- done
|
|
Harald Hoyer |
ab65ae |
-
|
|
Harald Hoyer |
ab65ae |
- # Save used netif for later use
|
|
Harald Hoyer |
ab65ae |
- [ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
|
|
Harald Hoyer |
ab65ae |
+ # Network rootfs mount successful - save interface info for ifcfg etc.
|
|
Harald Hoyer |
ab65ae |
+ save_netinfo $netif
|
|
Harald Hoyer |
ab65ae |
else
|
|
Harald Hoyer |
ab65ae |
warn "Mounting root via '$netif' failed"
|
|
Harald Hoyer |
ab65ae |
# If we're trying with multiple interfaces, put that one down.
|