FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-21-2010, 10:21 PM
David Cantrell
 
Default Replace linuxrc.s390 network configuration code with NetworkManager.

Remove linuxrc.s390's usage of /sbin/ip, /sbin/ifconfig, and /sbin/route
and instead just write the settings to the ifcfg-DEVICE file, set the
device online in sysfs, and start NetworkManager. This prevents a bug
where linuxrc.s390 was bringing up the interface, then loader would
start, it would launch NM, and immediately the network connection would
come down. Starting NM earlier prevents this and simplifies
linuxrc.s390 a lot.
---
loader/linuxrc.s390 | 313 ++++-----------------------------------------------
1 files changed, 22 insertions(+), 291 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 7a6be69..dfdd8d9 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -660,30 +660,6 @@ function set_device_online() {
fi
}

-# sets device up and blocks until device appears to be up
-function set_device_up() {
- if [ -z "$DEVICE" ]; then
- echo $"Could not determine interface name to bring up device $SUBCHANNELS"
- return 1
- fi
- # Device does not come up fast enough to use "ip" to configure, so block.
- # While OSA come up themselves after setting online,
- # e.g. HiperSockets won't => set them up explicitly for the following check
- debug ip link set up $DEVICE
- local i=1
- while : ; do
- local tst=$(ip -o link show up dev $DEVICE)
- [ -n "$tst" ] && break
- sleep 1
- i=$((i+1))
- if [ "$i" -gt 10 ]; then
- echo $"Could not bring up device $DEVICE within timeout"
- return 1
- fi
- done
- return 0
-}
-
function syntax_check_domainname() {
# - match against regex adopted from RFC1035,sec.2.3.1 or RFC1034,sec.3.5
# (Internationalized Domain Names in Applications (IDNA) [RFC4690]
@@ -730,65 +706,10 @@ function disable_ipv6_autoconf() {
sysctl -w net.ipv6.conf.default.autoconf=0 > /dev/null
}

-function configure_ipv6_address() {
- # device needs to be online
- # arp flag needs to be on for ipv6 over osa because of ndisc.
- # happens automatically by the driver. do NOT mess with default setting.
- #NO#debug ip link set dev $DEVICE arp on
- if ! debug ip -6 address add $IPADDR/$NETMASK dev $DEVICE; then
- echo $"Could net set IPv6 address $IPADDR/$NETMASK for device $DEVICE"
- return 1
- fi
- # network route has been set by above "ip address add" already
- # take care of MTU, which is bundled with ifconfig in the other IPv4 cases
- if [ -n "$MMTU" ]; then
- if ! debug ip link set $DEVICE $MMTU; then
- echo $"Could net set maximum transfer unit ($MMTU) for device $DEVICE"
- return 1
- fi
- fi
- return 0
-}
-
-function configure_ipv4_address() {
- # it's IPv4 and we can make use of ipcalc for better usability
- if ipcalc -bmnp $ipcalc_arg > /tmp/ipcalc.$$.out 2> /dev/null; then
- . /tmp/ipcalc.$$.out
- else
- echo $"Could not calculate network address and broadcast address from"
- echo $" IPv4 address $IPADDR and netmask $NETMASK"
- return 1
- fi
- rm /tmp/ipcalc.$$.out
- # device needs to be online
- if ! debug ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST; then
- echo $"Could not set IPv4 address $IPADDR for device $DEVICE"
- echo $" with network mask $NETMASK and broadcast address $BROADCAST"
- [ -n "$MMTU" ] && echo $" and maximum transfer unit: $MMTU"
- return 1
- fi
- # This network route is already there after ifconfig!
- #if ! debug route add -net $NETWORK netmask $NETMASK dev $DEVICE; then
- # echo $"Could not add network route to $NETWORK/$NETMASK on device $DEVICE"
- # return 1
- #fi
- return 0
-}
-
-function handle_mtu() {
- # don't ask for MTU, but use it if it has been set in the .parm file
- # don't overwrite MMTU if it has been set for CTC
- [ -n "$MTU" -a -z "$MMTU" ] && MMTU="mtu $MTU"
-}
-
function rollback_config() {
# each transaction to roll back may fail, if previous setup has not
# made progress that far to reach a certain transation
# => error output is misleading and should be avoided
- [ -n "$DEVICE" ] && tv ip -4 route flush default dev $DEVICE
- [ -n "$DEVICE" ] && tv ip -6 route flush default dev $DEVICE
- # address flush seems to be effective for all address families
- [ -n "$DEVICE" ] && ip address flush dev $DEVICE
if [ -n "$NETTYPE" ]; then
if [ -n "$SCH_R_DEVBUSID" ]; then
local sysnettype
@@ -805,7 +726,6 @@ function rollback_config() {
fi
fi
[ -z "$mtu_was_set" ] && unset MTU
- [ -z "$mmtu_was_set" ] && unset MMTU
[ -z "$vswitch_was_set" ] && unset VSWITCH
# prevent possible reuse of an old DEVICE on restarting dialog
unset DEVICE
@@ -1632,17 +1552,6 @@ function syntax_check_macaddr() {
return 1
}

-function handle_macaddr() {
- # - try to set macaddr right here w/ error handlg.
- # device needs to be online
- if debug ifconfig $DEVICE hw ether $MACADDR; then
- return 0
- fi
- echo $"MAC address $MACADDR could not be configured for"
- echo $" $SUBCHANNELS (network device $DEVICE)"
- return 1
-}
-
function question_prefix_macaddr() {
echo -n $"Unique MAC address"
}
@@ -1685,7 +1594,7 @@ function do_macaddr() {
ask MACADDR
question_prefix_macaddr question_choices_macaddr
-h helptext_macaddr -e exception_macaddr
- -s syntax_check_macaddr -c handle_macaddr
+ -s syntax_check_macaddr
}

### CTCPROT
@@ -1968,24 +1877,6 @@ function do_netmask() {
# no handling/configuring of NETMASK yet, since more parameters needed
}

-### NETWORK
-
-function do_network() {
- echo
- echo $"The NETWORK parameter isn't used anymore and will be ignored."
- echo $" It is sufficient to specify IPADDR and NETMASK."
- echo
-}
-
-### BROADCAST
-
-function do_broadcast() {
- echo
- echo $"The BROADCAST parameter isn't used anymore and will be ignored."
- echo $" It is sufficient to specify IPADDR and NETMASK."
- echo
-}
-
### NETMASK (IPv6)

function syntax_check_prefix_v6() {
@@ -2015,43 +1906,6 @@ function do_netmask_v6() {

### GATEWAY (IPv4)

-function configure_ipv4_gateway() {
- # FIXME:
- # - Strictly speaking we should first check reachability of gateway
- # and then configure the gateway route.
- # This would require a new intermediate workflow_item step
- # so that the user might continue despite unreachable gateway.
- # done: Only adding default route might add multiple undesired default
- # routes on redoing the parameter item, so delete default route
- # before adding a new one.
- ip -4 route del default dev $DEVICE >& /dev/null
- [ -z "$GATEWAY" ] && return 0
- if ! tv route add default gw $GATEWAY dev $DEVICE; then
- echo $"Could net set default route on device $DEVICE via gateway $GATEWAY"
- return 1
- fi
- # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
- echo $"Trying to reach gateway $GATEWAY..."
- if [ "$NETTYPE" = "ctc" ]; then
- # (virtual) CTC(/A) seems to need some time to get functional
- local i=1
- while : ; do
- ping -c 1 $GATEWAY >& /dev/null && break
- i=$((i+1))
- if [ "$i" -gt 3 ]; then
- echo $"Could not reach gateway $GATEWAY within timeout"
- return 1
- fi
- done
- else
- if ! ping -c 1 $GATEWAY >& /dev/null; then
- echo $"Could not reach your default gateway $GATEWAY"
- return 1
- fi
- fi
- return 0
-}
-
function hint_ipv4_gateway() {
# - provide default suggestion based on network,
# for a class C network this would be either .1 or .254 at the end
@@ -2090,17 +1944,12 @@ function helptext_gateway() {
hint_ipv4_gateway
}

-function finish_gateway() {
- if ! checkipv4 $GATEWAY; then
- # above checkipv4 is silent, so make up for syntax error
- echo $"Incorrect format for IPv4 address of gateway (GATEWAY): $GATEWAY"
- workflow_item_menu
- fi
- if configure_ipv4_gateway; then
- break
- else
- workflow_item_menu && break
+function syntax_check_gateway() {
+ if checkipv4 $GATEWAY; then
+ return 0
fi
+ echo $"Incorrect format for IPv4 address of gateway (GATEWAY): $GATEWAY"
+ return 1
}

# FIXME: allow empty/no gateway?
@@ -2108,43 +1957,11 @@ function finish_gateway() {
function do_gateway() {
ask GATEWAY
question_prefix_gateway question_choices_gateway
- -h helptext_gateway -f finish_gateway
+ -h helptext_gateway -s syntax_check_gateway
}

### GATEWAY (IPv6)

-function configure_ipv6_gateway() {
- # FIXME:
- # - Strictly speaking we should first check reachability of gateway
- # and then configure the gateway route.
- # This would require a new intermediate workflow_item step
- # so that the user might continue despite unreachable gateway.
- # done: Only adding default route might add multiple undesired default
- # routes on redoing the parameter item, so delete default route
- # before adding a new one.
- ip -6 route del default dev $DEVICE >& /dev/null
- [ -z "$GATEWAY" ] && return 0
- # IPv6 http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Linux+IPv6-HOWTO.html#AEN1147
- # ip -6 route add ::/0 dev $DEVICE via $GATEWAY
- # (Could also be learned by autoconfiguration on the link:
- # after IP address setup and device up,
- # see if default route has been learned
- # ip -6 route show | grep ^default
- # However, we currently use manual IPv6 configuration only.)
- if ! debug ip -6 route add ::/0 dev $DEVICE via $GATEWAY; then
- echo $"Could net set default route on device $DEVICE"
- echo $" via gateway $GATEWAY"
- return 1
- fi
- # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
- echo $"Trying to reach gateway $GATEWAY..."
- if ! ping6 -c 1 $GATEWAY >& /dev/null; then
- echo $"Could not reach your default gateway $GATEWAY"
- return 1
- fi
- return 0
-}
-
function question_prefix_gateway_v6() {
echo -n $"IPv6 address of your default gateway"
}
@@ -2159,17 +1976,12 @@ function helptext_gateway_v6() {
echo $" and choose continue afterwards to go on without gateway."
}

-function finish_gateway_v6() {
- if ! checkipv6 $GATEWAY; then
- # above checkipv6 is silent, so make up for syntax error
- echo $"Incorrect format for IPv6 address of gateway (GATEWAY): $GATEWAY"
- workflow_item_menu
- fi
- if configure_ipv6_gateway; then
- break
- else
- workflow_item_menu && break
+function syntax_check_gateway_v6() {
+ if checkipv6 $GATEWAY; then
+ return 0
fi
+ echo $"Incorrect format for IPv6 address of gateway (GATEWAY): $GATEWAY"
+ return 1
}

# FIXME: allow empty/no gateway?
@@ -2177,23 +1989,11 @@ function finish_gateway_v6() {
function do_gateway_v6() {
ask GATEWAY
question_prefix_gateway_v6 question_choices_gateway_v6
- -h helptext_gateway_v6 -f finish_gateway_v6
+ -h helptext_gateway_v6 -s syntax_check_gateway_v6
}

### GATEWAY (IPv4, point-to-point)

-function configure_ipv4_ptp() {
- # device needs to be online
- if debug ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY; then
- configure_ipv4_gateway
- return $?
- fi
- echo $"Could not set IPv4 address $IPADDR for device $DEVICE"
- echo $" to peer $GATEWAY"
- [ -n "$MMTU" ] && echo $" and maximum transfer unit: $MMTU"
- return 1
-}
-
function question_prefix_ptp_gateway() {
echo -n $"IPv4 address of your point-to-point partner"
}
@@ -2261,49 +2061,6 @@ function syntax_check_dns() {
fi
}

-function handle_dns() {
- # - foreach DNS try if server is reachable by one ping
- [ -z "$DNS" ] && return 0
- local dnsitem
- local allgood="yes"
- echo $"Trying to reach DNS servers..."
- if [ "$ipv6" ]; then
- while read dnsitem; do
- if ! ping6 -c 1 $dnsitem >& /dev/null; then
- echo $"Could not ping DNS server (might still serve DNS requests): $dnsitem"
- allgood="no"
- # this should not be a hard failure since some network
- # environments may prevent pings to DNS servers
- # => prevent workflow_item_menu in kickstart mode
- fi
- done < <(echo $DNS | sed 's/,/
/g')
- else
- while read dnsitem; do
- # Some network environment may prevent a DNS server from being
- # reachable by ping, so it would make sense to use nslookup.
- # However, nslookup fails with "Resolver Error 0 (no error)"
- # at this stage of the setup progress => not useful
- if ! ping -c 1 $dnsitem >& /dev/null; then
- echo $"Could not ping DNS server: $dnsitem"
-# if nslookup $dnsitem $dnsitem >& /dev/null; then
-# echo $" but could resolve DNS server with itself: $dnsitem"
-# else
-# echo $"Could not resolve DNS server with itself: $dnsitem"
-# allgood="no"
-# fi
-# elif ! nslookup $dnsitem $dnsitem >& /dev/null; then
-# echo $"Could not resolve DNS server with itself: $dnsitem"
- allgood="no"
- fi
- done < <(echo $DNS | sed 's/:/
/g')
- fi
- if [ "$allgood" = "yes" ]; then
- return 0
- else
- return 1
- fi
-}
-
function question_prefix_dns() {
if [ "$ipv6" ]; then
echo -n $"IPv6 addresses of DNS servers"
@@ -2340,7 +2097,7 @@ function helptext_dns() {
function do_dns() {
ask DNS
question_prefix_dns question_choices_dns
- -h helptext_dns -s syntax_check_dns -c handle_dns
+ -h helptext_dns -s syntax_check_dns
}

### SEARCHDNS
@@ -2674,9 +2431,7 @@ EOF
[ "$PORTNO" ] && echo "PORTNO=$PORTNO"
[ "$PEERID" ] && echo "PEERID=$PEERID"
[ "$CTCPROT" ] && echo "CTCPROT=$CTCPROT"
- if [ -n "$mmtu_was_set" ]; then
- echo "MMTU="$MMTU""
- elif [ -n "$mtu_was_set" ]; then
+ if [ -n "$mtu_was_set" ]; then
echo "MTU=$MTU"
fi
[ "$DNS" ] && echo "DNS=$DNS"
@@ -2786,18 +2541,14 @@ fi
# Perform a network installation

[ -n "$MTU" ] && mtu_was_set=$MTU
-[ -n "$MMTU" ] && mmtu_was_set=$MMTU
[ -n "$VSWITCH" ] && vswitch_was_set=$VSWITCH

[ -n "$CHANDEV" ] && do_chandev
-[ -n "$NETWORK" ] && do_network
-[ -n "$BROADCAST" ] && do_broadcast

# [ -z "${cardtype//OSD_*/}" ] can be used to check for real OSA

# Check for missing parameters, prompt for them if necessary
while : ; do
-
# do not show list of possible network device configurations, if:
# - running unattended install with kickstart
# - relevant parameters have already been specified in parm file
@@ -2854,10 +2605,6 @@ while : ; do
set_device_online || workflow_item_menu noredo
fi

- # device needs to be up before configuring with ifconfig/ip in
- # configure_ipv6_address/configure_ipv4_address/configure_ipv4_address
- set_device_up || workflow_item_menu noredo
-
[ "$HOSTNAME" = "(none)" ] && unset HOSTNAME
do_hostname

@@ -2868,8 +2615,6 @@ while : ; do
if [ "$ipv6" ]; then
# this branch is all IPv6 and at the same time also NETTYPE==qeth
do_netmask_v6
- handle_mtu
- configure_ipv6_address || workflow_item_menu noredo
do_gateway_v6
else
# Consider IPv4 as default, even for unknown IP versions
@@ -2879,22 +2624,9 @@ while : ; do
# and jump forward to DNS which is probably not what we want.
if [ "$NETTYPE" = "qeth" ] || [ "$NETTYPE" = "lcs" ]; then
do_netmask
- handle_mtu
- configure_ipv4_address || workflow_item_menu noredo
do_gateway
else # ctc0
- if [ -z "$NETMASK" ]; then
- # If the user did not supply netmask, we add the right one.
- # Netmask MUST be present,
- # or pumpSetupInterface() blows routes.
- NETMASK="255.255.255.255"
- fi
- # don't ask for MTU, but use it if set in the parm file
- # don't overwrite MMTU if it has been set for CTC
- [ "$NETTYPE" = "ctc" -a -z "$MTU" -a -z "$MMTU" ] &&
- MMTU="mtu 1500"
do_ptp_gateway
- configure_ipv4_ptp || workflow_item_menu noredo
fi
fi

@@ -2908,7 +2640,6 @@ while : ; do
final_check && break
rollback_config
reenter="yes"
-
done # outer dialog loop

if [ -z "$testing" ]; then
@@ -2964,9 +2695,7 @@ NETTYPE="$NETTYPE"
IPADDR="$IPADDR"
GATEWAY="$GATEWAY"
MTU="$MTU"
-NETWORK="$NETWORK"
NETMASK="$NETMASK"
-BROADCAST="$BROADCAST"
SEARCHDNS="$SEARCHDNS"
PEERID="$PEERID"
SUBCHANNELS="$SUBCHANNELS"
@@ -2987,7 +2716,7 @@ fi
cat >> /tmp/install.cfg << EOF
export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR
export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU
-export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS
+export NETMASK DNS DNS1 DNS2 SEARCHDNS
export PEERID ONBOOT SUBCHANNELS CTCPROT
EOF
# immediately read it in again to export these into the shell below
@@ -3002,7 +2731,7 @@ if [ ! -d "$NETSCRIPTS" ]; then
mkdir -p $NETSCRIPTS
fi

-# to please NetworkManager on startup in loader before loader reconfigures net
+# nm-system-settings reads the ifcfg-DEVICE files
cat > /etc/sysconfig/network << EOF
HOSTNAME=$HOSTNAME
EOF
@@ -3012,7 +2741,6 @@ DEVICE=$DEVICE
ONBOOT=yes
BOOTPROTO=static
GATEWAY=$GATEWAY
-BROADCAST=$BROADCAST
MTU=$MTU
SUBCHANNELS=$SUBCHANNELS
EOF
@@ -3033,7 +2761,8 @@ EOF
fi
[ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE
[ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE
-# colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
+# colons in SEARCHDNS already replaced with spaces above
+# for /etc/resolv.conf
[ "$SEARCHDNS" != "" ] && echo "DOMAIN="$SEARCHDNS"" >> $IFCFGFILE
[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE
[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> $IFCFGFILE
@@ -3046,7 +2775,8 @@ for option in LAYER2 PORTNO; do
[ -n "$optstr" ] && optstr=${optstr}" "
optstr=${optstr}$(echo ${option} | tr [[:upper:]] [[:lower:]])"="${!option}
done
-# write single quotes since network.py removes double quotes but we need quotes
+# write single quotes since network.py removes double quotes but we need
+# quotes
echo "OPTIONS='$optstr'" >> $IFCFGFILE
unset option
unset optstr
@@ -3084,6 +2814,7 @@ EOF
# reboot on SIGUSR2
trap doreboot SIGUSR2

+ /usr/sbin/NetworkManager --pid-file=/var/run/NetworkManager/NetworkManager.pid
startinetd

if [ -n "$RUNKS" ]; then
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-22-2010, 01:59 PM
Chris Lumens
 
Default Replace linuxrc.s390 network configuration code with NetworkManager.

> Remove linuxrc.s390's usage of /sbin/ip, /sbin/ifconfig, and /sbin/route
> and instead just write the settings to the ifcfg-DEVICE file, set the
> device online in sysfs, and start NetworkManager. This prevents a bug
> where linuxrc.s390 was bringing up the interface, then loader would
> start, it would launch NM, and immediately the network connection would
> come down. Starting NM earlier prevents this and simplifies
> linuxrc.s390 a lot.

I just assigned a bug to you this morning that is likely caused by this
problem. You'll want to reference that in the commit message before you
push.

On a cursory glance, the patch looks fine to me. It's always nice to
see a whole lot of minus signs.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-22-2010, 04:27 PM
Steffen Maier
 
Default Replace linuxrc.s390 network configuration code with NetworkManager.

On 01/22/2010 12:21 AM, David Cantrell wrote:
> Remove linuxrc.s390's usage of /sbin/ip, /sbin/ifconfig, and /sbin/route
> and instead just write the settings to the ifcfg-DEVICE file, set the
> device online in sysfs, and start NetworkManager. This prevents a bug
> where linuxrc.s390 was bringing up the interface, then loader would
> start, it would launch NM, and immediately the network connection would
> come down.

Apparently, this looks like a bug in NM. If it was well-behaved, it
wouldn't touch already correctly configured devices and just kept them
running.

Changing linuxrc.s390 is just a workaround and even more so removes a
whole lot of usability that was just introduced and users liked it.
Therefore, I disagree with below changes.

More specific comments below.

> Starting NM earlier prevents this and simplifies
> linuxrc.s390 a lot.
> ---
> loader/linuxrc.s390 | 313 ++++-----------------------------------------------
> 1 files changed, 22 insertions(+), 291 deletions(-)
>
> diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
> index 7a6be69..dfdd8d9 100644
> --- a/loader/linuxrc.s390
> +++ b/loader/linuxrc.s390
> @@ -660,30 +660,6 @@ function set_device_online() {
> fi
> }
>
> -# sets device up and blocks until device appears to be up
> -function set_device_up() {
> - if [ -z "$DEVICE" ]; then
> - echo $"Could not determine interface name to bring up device $SUBCHANNELS"
> - return 1
> - fi
> - # Device does not come up fast enough to use "ip" to configure, so block.
> - # While OSA come up themselves after setting online,
> - # e.g. HiperSockets won't => set them up explicitly for the following check
> - debug ip link set up $DEVICE
> - local i=1
> - while : ; do
> - local tst=$(ip -o link show up dev $DEVICE)
> - [ -n "$tst" ] && break
> - sleep 1
> - i=$((i+1))
> - if [ "$i" -gt 10 ]; then
> - echo $"Could not bring up device $DEVICE within timeout"
> - return 1
> - fi
> - done
> - return 0
> -}
> -

By removing this, you rely on enough time to have passed until NM gets
started which is fragile. Reminds me of device_cio_free or dasd_settle
et al.

> @@ -805,7 +726,6 @@ function rollback_config() {
> fi
> fi
> [ -z "$mtu_was_set" ] && unset MTU
> - [ -z "$mmtu_was_set" ] && unset MMTU

This is still required for show_parm() to work. I never fully understood
why this magic is there to distinguish between user input and parm/conf
file input. However, I wouldn't want to break any old feature that was
in linuxrc.s390 before I touched it.

> @@ -1632,17 +1552,6 @@ function syntax_check_macaddr() {
> return 1
> }
>
> -function handle_macaddr() {
> - # - try to set macaddr right here w/ error handlg.
> - # device needs to be online
> - if debug ifconfig $DEVICE hw ether $MACADDR; then
> - return 0
> - fi
> - echo $"MAC address $MACADDR could not be configured for"
> - echo $" $SUBCHANNELS (network device $DEVICE)"
> - return 1
> -}
> -

Have you tested this successfully with a real (non-virtual) OSA in
layer2 mode?
I'm just not sure, if NM will apply this MAC address early on the device.

> -### NETWORK
> -
> -function do_network() {
> - echo
> - echo $"The NETWORK parameter isn't used anymore and will be ignored."
> - echo $" It is sufficient to specify IPADDR and NETMASK."
> - echo
> -}
> -
> -### BROADCAST
> -
> -function do_broadcast() {
> - echo
> - echo $"The BROADCAST parameter isn't used anymore and will be ignored."
> - echo $" It is sufficient to specify IPADDR and NETMASK."
> - echo
> -}
> -

Those two functions are there on purpose, to help users with old
parm/conf file and to acquaint them with the changes we introduced.
Otherwise they would most probably never get to know that there are
parameters in their parm/conf files they do not longer need or they
wonder why they don't get applied any more. Please keep those functions.

> ### NETMASK (IPv6)
>
> function syntax_check_prefix_v6() {
> @@ -2015,43 +1906,6 @@ function do_netmask_v6() {
>
> ### GATEWAY (IPv4)
>
> -function configure_ipv4_gateway() {
> - # FIXME:
> - # - Strictly speaking we should first check reachability of gateway
> - # and then configure the gateway route.
> - # This would require a new intermediate workflow_item step
> - # so that the user might continue despite unreachable gateway.
> - # done: Only adding default route might add multiple undesired default
> - # routes on redoing the parameter item, so delete default route
> - # before adding a new one.
> - ip -4 route del default dev $DEVICE >& /dev/null
> - [ -z "$GATEWAY" ] && return 0
> - if ! tv route add default gw $GATEWAY dev $DEVICE; then
> - echo $"Could net set default route on device $DEVICE via gateway $GATEWAY"
> - return 1
> - fi
> - # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
> - echo $"Trying to reach gateway $GATEWAY..."
> - if [ "$NETTYPE" = "ctc" ]; then
> - # (virtual) CTC(/A) seems to need some time to get functional
> - local i=1
> - while : ; do
> - ping -c 1 $GATEWAY >& /dev/null && break
> - i=$((i+1))
> - if [ "$i" -gt 3 ]; then
> - echo $"Could not reach gateway $GATEWAY within timeout"
> - return 1
> - fi
> - done
> - else
> - if ! ping -c 1 $GATEWAY >& /dev/null; then
> - echo $"Could not reach your default gateway $GATEWAY"
> - return 1
> - fi
> - fi
> - return 0
> -}
> -

Now, we are starting to loose significant parts of usability, which was
the sole purpose of rewriting linuxrc.s390 in the first place. It is a
step back towards the old linuxrc which would only ask all parameters
and then try to configure the network ignoring error cases and not
helping the user to confirm his/her entries were syntactically and even
more so semantically correct.

> ### GATEWAY (IPv6)
>
> -function configure_ipv6_gateway() {
> - # FIXME:
> - # - Strictly speaking we should first check reachability of gateway
> - # and then configure the gateway route.
> - # This would require a new intermediate workflow_item step
> - # so that the user might continue despite unreachable gateway.
> - # done: Only adding default route might add multiple undesired default
> - # routes on redoing the parameter item, so delete default route
> - # before adding a new one.
> - ip -6 route del default dev $DEVICE >& /dev/null
> - [ -z "$GATEWAY" ] && return 0
> - # IPv6 http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Linux+IPv6-HOWTO.html#AEN1147
> - # ip -6 route add ::/0 dev $DEVICE via $GATEWAY
> - # (Could also be learned by autoconfiguration on the link:
> - # after IP address setup and device up,
> - # see if default route has been learned
> - # ip -6 route show | grep ^default
> - # However, we currently use manual IPv6 configuration only.)
> - if ! debug ip -6 route add ::/0 dev $DEVICE via $GATEWAY; then
> - echo $"Could net set default route on device $DEVICE"
> - echo $" via gateway $GATEWAY"
> - return 1
> - fi
> - # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
> - echo $"Trying to reach gateway $GATEWAY..."
> - if ! ping6 -c 1 $GATEWAY >& /dev/null; then
> - echo $"Could not reach your default gateway $GATEWAY"
> - return 1
> - fi
> - return 0
> -}
> -

usability--;

> @@ -2261,49 +2061,6 @@ function syntax_check_dns() {
> fi
> }
>
> -function handle_dns() {
> - # - foreach DNS try if server is reachable by one ping
> - [ -z "$DNS" ] && return 0
> - local dnsitem
> - local allgood="yes"
> - echo $"Trying to reach DNS servers..."
> - if [ "$ipv6" ]; then
> - while read dnsitem; do
> - if ! ping6 -c 1 $dnsitem >& /dev/null; then
> - echo $"Could not ping DNS server (might still serve DNS requests): $dnsitem"
> - allgood="no"
> - # this should not be a hard failure since some network
> - # environments may prevent pings to DNS servers
> - # => prevent workflow_item_menu in kickstart mode
> - fi
> - done < <(echo $DNS | sed 's/,/
/g')
> - else
> - while read dnsitem; do
> - # Some network environment may prevent a DNS server from being
> - # reachable by ping, so it would make sense to use nslookup.
> - # However, nslookup fails with "Resolver Error 0 (no error)"
> - # at this stage of the setup progress => not useful
> - if ! ping -c 1 $dnsitem >& /dev/null; then
> - echo $"Could not ping DNS server: $dnsitem"
> -# if nslookup $dnsitem $dnsitem >& /dev/null; then
> -# echo $" but could resolve DNS server with itself: $dnsitem"
> -# else
> -# echo $"Could not resolve DNS server with itself: $dnsitem"
> -# allgood="no"
> -# fi
> -# elif ! nslookup $dnsitem $dnsitem >& /dev/null; then
> -# echo $"Could not resolve DNS server with itself: $dnsitem"
> - allgood="no"
> - fi
> - done < <(echo $DNS | sed 's/:/
/g')
> - fi
> - if [ "$allgood" = "yes" ]; then
> - return 0
> - else
> - return 1
> - fi
> -}
> -

usability--;
I think it's less than zero already.

> @@ -2674,9 +2431,7 @@ EOF
> [ "$PORTNO" ] && echo "PORTNO=$PORTNO"
> [ "$PEERID" ] && echo "PEERID=$PEERID"
> [ "$CTCPROT" ] && echo "CTCPROT=$CTCPROT"
> - if [ -n "$mmtu_was_set" ]; then
> - echo "MMTU="$MMTU""
> - elif [ -n "$mtu_was_set" ]; then
> + if [ -n "$mtu_was_set" ]; then
> echo "MTU=$MTU"
> fi
> [ "$DNS" ] && echo "DNS=$DNS"
>
> @@ -2786,18 +2541,14 @@ fi
> # Perform a network installation
>
> [ -n "$MTU" ] && mtu_was_set=$MTU
> -[ -n "$MMTU" ] && mmtu_was_set=$MMTU

What does this change cause? Did you test that this does not break any
previously available behavior?

> [ -n "$VSWITCH" ] && vswitch_was_set=$VSWITCH
>
> [ -n "$CHANDEV" ] && do_chandev
> -[ -n "$NETWORK" ] && do_network
> -[ -n "$BROADCAST" ] && do_broadcast

Those two should definitely stay.

> else # ctc0
> - if [ -z "$NETMASK" ]; then
> - # If the user did not supply netmask, we add the right one.
> - # Netmask MUST be present,
> - # or pumpSetupInterface() blows routes.
> - NETMASK="255.255.255.255"
> - fi

This does not work well with show_parms() which shows NETMASK=$NETMASK
unconditionally.

> - # don't ask for MTU, but use it if set in the parm file
> - # don't overwrite MMTU if it has been set for CTC
> - [ "$NETTYPE" = "ctc" -a -z "$MTU" -a -z "$MMTU" ] &&
> - MMTU="mtu 1500"

Are you sure this keeps working for CTC?

> @@ -2964,9 +2695,7 @@ NETTYPE="$NETTYPE"
> IPADDR="$IPADDR"
> GATEWAY="$GATEWAY"
> MTU="$MTU"
> -NETWORK="$NETWORK"
> NETMASK="$NETMASK"
> -BROADCAST="$BROADCAST"
> SEARCHDNS="$SEARCHDNS"
> PEERID="$PEERID"
> SUBCHANNELS="$SUBCHANNELS"
> @@ -2987,7 +2716,7 @@ fi
> cat >> /tmp/install.cfg << EOF
> export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR
> export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU
> -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS
> +export NETMASK DNS DNS1 DNS2 SEARCHDNS

You remove parts of install.cfg but the rest remains. I don't understand
what this would mean for loader.

> export PEERID ONBOOT SUBCHANNELS CTCPROT
> EOF
> # immediately read it in again to export these into the shell below
> @@ -3002,7 +2731,7 @@ if [ ! -d "$NETSCRIPTS" ]; then
> mkdir -p $NETSCRIPTS
> fi
>
> -# to please NetworkManager on startup in loader before loader reconfigures net
> +# nm-system-settings reads the ifcfg-DEVICE files
> cat > /etc/sysconfig/network << EOF
> HOSTNAME=$HOSTNAME
> EOF
> @@ -3012,7 +2741,6 @@ DEVICE=$DEVICE
> ONBOOT=yes
> BOOTPROTO=static
> GATEWAY=$GATEWAY
> -BROADCAST=$BROADCAST

I suppose NM doesn't need this.
But does initscripts' network service still work with OSA, Hipersockets,
LCS, and CTC in all its flavors after the BROADCAST option is written no
more?
As long as NM does not support features such as bonding, data center
servers still need network service.

> @@ -3084,6 +2814,7 @@ EOF
> # reboot on SIGUSR2
> trap doreboot SIGUSR2
>
> + /usr/sbin/NetworkManager --pid-file=/var/run/NetworkManager/NetworkManager.pid

Would we have to wait for NM as in iface.c:iface_start_NetworkManager()
for the network to be configured before sshd binds in startinetd?

And will loader stop calling iface_start_NetworkManager() or does
NetworkManager detect itself that it is already running?

> startinetd
>
> if [ -n "$RUNKS" ]; then

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-22-2010, 09:38 PM
David Cantrell
 
Default Replace linuxrc.s390 network configuration code with NetworkManager.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 22 Jan 2010, Steffen Maier wrote:


On 01/22/2010 12:21 AM, David Cantrell wrote:

Remove linuxrc.s390's usage of /sbin/ip, /sbin/ifconfig, and /sbin/route
and instead just write the settings to the ifcfg-DEVICE file, set the
device online in sysfs, and start NetworkManager. This prevents a bug
where linuxrc.s390 was bringing up the interface, then loader would
start, it would launch NM, and immediately the network connection would
come down.


Apparently, this looks like a bug in NM. If it was well-behaved, it
wouldn't touch already correctly configured devices and just kept them
running.

Changing linuxrc.s390 is just a workaround and even more so removes a
whole lot of usability that was just introduced and users liked it.
Therefore, I disagree with below changes.

More specific comments below.


The main goal of this change is to reduce the duplication of effort we
currently have in linuxrc.s390. We use NetworkManager on the other platforms
to bring up interfaces, so we should use it on s390x too. If it doesn't work
on s390x, we should fix NetworkManager rather than work around it in
linuxrc.s390.


Starting NM earlier prevents this and simplifies
linuxrc.s390 a lot.
---
loader/linuxrc.s390 | 313 ++++-----------------------------------------------
1 files changed, 22 insertions(+), 291 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 7a6be69..dfdd8d9 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -660,30 +660,6 @@ function set_device_online() {
fi
}

-# sets device up and blocks until device appears to be up
-function set_device_up() {
- if [ -z "$DEVICE" ]; then
- echo $"Could not determine interface name to bring up device $SUBCHANNELS"
- return 1
- fi
- # Device does not come up fast enough to use "ip" to configure, so block.
- # While OSA come up themselves after setting online,
- # e.g. HiperSockets won't => set them up explicitly for the following check
- debug ip link set up $DEVICE
- local i=1
- while : ; do
- local tst=$(ip -o link show up dev $DEVICE)
- [ -n "$tst" ] && break
- sleep 1
- i=$((i+1))
- if [ "$i" -gt 10 ]; then
- echo $"Could not bring up device $DEVICE within timeout"
- return 1
- fi
- done
- return 0
-}
-


By removing this, you rely on enough time to have passed until NM gets
started which is fragile. Reminds me of device_cio_free or dasd_settle
et al.


NM continually polls the interfaces, so I don't see the point of this
function.


@@ -805,7 +726,6 @@ function rollback_config() {
fi
fi
[ -z "$mtu_was_set" ] && unset MTU
- [ -z "$mmtu_was_set" ] && unset MMTU


This is still required for show_parm() to work. I never fully understood
why this magic is there to distinguish between user input and parm/conf
file input. However, I wouldn't want to break any old feature that was
in linuxrc.s390 before I touched it.


The MMTU variable gets set to "mtu $MTU" and used as an argument to
/sbin/ifconfig and /sbin/ip. NetworkManager handles this fine when it sees an
MTU variable in the device ifcfg file.


@@ -1632,17 +1552,6 @@ function syntax_check_macaddr() {
return 1
}

-function handle_macaddr() {
- # - try to set macaddr right here w/ error handlg.
- # device needs to be online
- if debug ifconfig $DEVICE hw ether $MACADDR; then
- return 0
- fi
- echo $"MAC address $MACADDR could not be configured for"
- echo $" $SUBCHANNELS (network device $DEVICE)"
- return 1
-}
-


Have you tested this successfully with a real (non-virtual) OSA in
layer2 mode?
I'm just not sure, if NM will apply this MAC address early on the device.


It looks like NM does not do anything with the MACADDR variable currently. We
can patch ifcfg-rh to honor that.


-### NETWORK
-
-function do_network() {
- echo
- echo $"The NETWORK parameter isn't used anymore and will be ignored."
- echo $" It is sufficient to specify IPADDR and NETMASK."
- echo
-}
-
-### BROADCAST
-
-function do_broadcast() {
- echo
- echo $"The BROADCAST parameter isn't used anymore and will be ignored."
- echo $" It is sufficient to specify IPADDR and NETMASK."
- echo
-}
-


Those two functions are there on purpose, to help users with old
parm/conf file and to acquaint them with the changes we introduced.
Otherwise they would most probably never get to know that there are
parameters in their parm/conf files they do not longer need or they
wonder why they don't get applied any more. Please keep those functions.


Migration guide. Documentation.


### NETMASK (IPv6)

function syntax_check_prefix_v6() {
@@ -2015,43 +1906,6 @@ function do_netmask_v6() {

### GATEWAY (IPv4)

-function configure_ipv4_gateway() {
- # FIXME:
- # - Strictly speaking we should first check reachability of gateway
- # and then configure the gateway route.
- # This would require a new intermediate workflow_item step
- # so that the user might continue despite unreachable gateway.
- # done: Only adding default route might add multiple undesired default
- # routes on redoing the parameter item, so delete default route
- # before adding a new one.
- ip -4 route del default dev $DEVICE >& /dev/null
- [ -z "$GATEWAY" ] && return 0
- if ! tv route add default gw $GATEWAY dev $DEVICE; then
- echo $"Could net set default route on device $DEVICE via gateway $GATEWAY"
- return 1
- fi
- # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
- echo $"Trying to reach gateway $GATEWAY..."
- if [ "$NETTYPE" = "ctc" ]; then
- # (virtual) CTC(/A) seems to need some time to get functional
- local i=1
- while : ; do
- ping -c 1 $GATEWAY >& /dev/null && break
- i=$((i+1))
- if [ "$i" -gt 3 ]; then
- echo $"Could not reach gateway $GATEWAY within timeout"
- return 1
- fi
- done
- else
- if ! ping -c 1 $GATEWAY >& /dev/null; then
- echo $"Could not reach your default gateway $GATEWAY"
- return 1
- fi
- fi
- return 0
-}
-


Now, we are starting to loose significant parts of usability, which was
the sole purpose of rewriting linuxrc.s390 in the first place. It is a
step back towards the old linuxrc which would only ask all parameters
and then try to configure the network ignoring error cases and not
helping the user to confirm his/her entries were syntactically and even
more so semantically correct.


This is exactly the kind of stuff that NetworkManager will handle for us. One
thing that led me to removing this code was that I kept hitting a problem
where the "ping -c 1" test on $GATEWAY would only work part of the time. If I
added "-w 5" for a timeout for the entire run, it worked. But then that's
just for my VM. NetworkManager can take care of this for us and can report if
the connection is up or not.


### GATEWAY (IPv6)

-function configure_ipv6_gateway() {
- # FIXME:
- # - Strictly speaking we should first check reachability of gateway
- # and then configure the gateway route.
- # This would require a new intermediate workflow_item step
- # so that the user might continue despite unreachable gateway.
- # done: Only adding default route might add multiple undesired default
- # routes on redoing the parameter item, so delete default route
- # before adding a new one.
- ip -6 route del default dev $DEVICE >& /dev/null
- [ -z "$GATEWAY" ] && return 0
- # IPv6 http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Linux+IPv6-HOWTO.html#AEN1147
- # ip -6 route add ::/0 dev $DEVICE via $GATEWAY
- # (Could also be learned by autoconfiguration on the link:
- # after IP address setup and device up,
- # see if default route has been learned
- # ip -6 route show | grep ^default
- # However, we currently use manual IPv6 configuration only.)
- if ! debug ip -6 route add ::/0 dev $DEVICE via $GATEWAY; then
- echo $"Could net set default route on device $DEVICE"
- echo $" via gateway $GATEWAY"
- return 1
- fi
- # BH FIXME: Workaround for manual MACADDR, need ping to update arp table
- echo $"Trying to reach gateway $GATEWAY..."
- if ! ping6 -c 1 $GATEWAY >& /dev/null; then
- echo $"Could not reach your default gateway $GATEWAY"
- return 1
- fi
- return 0
-}
-


usability--;


Same explanation as above. Also, the way linuxrc.s390 is currently written
won't allow for dual stack configuration, which we need to support during
installation. We already have the code to collect the values from users and
NetworkManager can do dual stack configuration of the interface. I still need
to modify things slightly to allow for dual stack rather than the either/or
approach now.


@@ -2261,49 +2061,6 @@ function syntax_check_dns() {
fi
}

-function handle_dns() {
- # - foreach DNS try if server is reachable by one ping
- [ -z "$DNS" ] && return 0
- local dnsitem
- local allgood="yes"
- echo $"Trying to reach DNS servers..."
- if [ "$ipv6" ]; then
- while read dnsitem; do
- if ! ping6 -c 1 $dnsitem >& /dev/null; then
- echo $"Could not ping DNS server (might still serve DNS requests): $dnsitem"
- allgood="no"
- # this should not be a hard failure since some network
- # environments may prevent pings to DNS servers
- # => prevent workflow_item_menu in kickstart mode
- fi
- done < <(echo $DNS | sed 's/,/
/g')
- else
- while read dnsitem; do
- # Some network environment may prevent a DNS server from being
- # reachable by ping, so it would make sense to use nslookup.
- # However, nslookup fails with "Resolver Error 0 (no error)"
- # at this stage of the setup progress => not useful
- if ! ping -c 1 $dnsitem >& /dev/null; then
- echo $"Could not ping DNS server: $dnsitem"
-# if nslookup $dnsitem $dnsitem >& /dev/null; then
-# echo $" but could resolve DNS server with itself: $dnsitem"
-# else
-# echo $"Could not resolve DNS server with itself: $dnsitem"
-# allgood="no"
-# fi
-# elif ! nslookup $dnsitem $dnsitem >& /dev/null; then
-# echo $"Could not resolve DNS server with itself: $dnsitem"
- allgood="no"
- fi
- done < <(echo $DNS | sed 's/:/
/g')
- fi
- if [ "$allgood" = "yes" ]; then
- return 0
- else
- return 1
- fi
-}
-


usability--;
I think it's less than zero already.


So the problem I have with this function is that it's entirely too fragile.
Verifying that DNS servers are where we say they are and that we can look up
things is putting too much trust in DNS during installation. We don't enforce
this on other platforms and I don't see why we should here.


@@ -2674,9 +2431,7 @@ EOF
[ "$PORTNO" ] && echo "PORTNO=$PORTNO"
[ "$PEERID" ] && echo "PEERID=$PEERID"
[ "$CTCPROT" ] && echo "CTCPROT=$CTCPROT"
- if [ -n "$mmtu_was_set" ]; then
- echo "MMTU="$MMTU""
- elif [ -n "$mtu_was_set" ]; then
+ if [ -n "$mtu_was_set" ]; then
echo "MTU=$MTU"
fi
[ "$DNS" ] && echo "DNS=$DNS"

@@ -2786,18 +2541,14 @@ fi
# Perform a network installation

[ -n "$MTU" ] && mtu_was_set=$MTU
-[ -n "$MMTU" ] && mmtu_was_set=$MMTU


What does this change cause? Did you test that this does not break any
previously available behavior?


I set an MTU of 4096 during installation and that still works when I use this
version of linuxrc.s390 that just runs NM.


[ -n "$VSWITCH" ] && vswitch_was_set=$VSWITCH

[ -n "$CHANDEV" ] && do_chandev
-[ -n "$NETWORK" ] && do_network
-[ -n "$BROADCAST" ] && do_broadcast


Those two should definitely stay.


Why? These are the functions that just echo to the console that you don't
need to set NETWORK or BROADCAST anymore.


else # ctc0
- if [ -z "$NETMASK" ]; then
- # If the user did not supply netmask, we add the right one.
- # Netmask MUST be present,
- # or pumpSetupInterface() blows routes.
- NETMASK="255.255.255.255"
- fi


This does not work well with show_parms() which shows NETMASK=$NETMASK
unconditionally.


OK, I'll bring this back in. We've got to have at least an IP address and
netmask or prefix.


- # don't ask for MTU, but use it if set in the parm file
- # don't overwrite MMTU if it has been set for CTC
- [ "$NETTYPE" = "ctc" -a -z "$MTU" -a -z "$MMTU" ] &&
- MMTU="mtu 1500"


Are you sure this keeps working for CTC?


No, I'm not, but I can add this back in. Force an MTU of 1500 if the user did
not specify one in the CMS conf file for ctc devices. That's easy enough.


@@ -2964,9 +2695,7 @@ NETTYPE="$NETTYPE"
IPADDR="$IPADDR"
GATEWAY="$GATEWAY"
MTU="$MTU"
-NETWORK="$NETWORK"
NETMASK="$NETMASK"
-BROADCAST="$BROADCAST"
SEARCHDNS="$SEARCHDNS"
PEERID="$PEERID"
SUBCHANNELS="$SUBCHANNELS"
@@ -2987,7 +2716,7 @@ fi
cat >> /tmp/install.cfg << EOF
export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR
export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU
-export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS
+export NETMASK DNS DNS1 DNS2 SEARCHDNS


You remove parts of install.cfg but the rest remains. I don't understand
what this would mean for loader.


I remove NETWORK and BROADCAST, which are no longer used. /tmp/install.cfg is
read by the booty code.


export PEERID ONBOOT SUBCHANNELS CTCPROT
EOF
# immediately read it in again to export these into the shell below
@@ -3002,7 +2731,7 @@ if [ ! -d "$NETSCRIPTS" ]; then
mkdir -p $NETSCRIPTS
fi

-# to please NetworkManager on startup in loader before loader reconfigures net
+# nm-system-settings reads the ifcfg-DEVICE files
cat > /etc/sysconfig/network << EOF
HOSTNAME=$HOSTNAME
EOF
@@ -3012,7 +2741,6 @@ DEVICE=$DEVICE
ONBOOT=yes
BOOTPROTO=static
GATEWAY=$GATEWAY
-BROADCAST=$BROADCAST


I suppose NM doesn't need this.
But does initscripts' network service still work with OSA, Hipersockets,
LCS, and CTC in all its flavors after the BROADCAST option is written no
more?
As long as NM does not support features such as bonding, data center
servers still need network service.


That's a good point, should probably keep them around in the ifcfg in that
case.


@@ -3084,6 +2814,7 @@ EOF
# reboot on SIGUSR2
trap doreboot SIGUSR2

+ /usr/sbin/NetworkManager --pid-file=/var/run/NetworkManager/NetworkManager.pid


Would we have to wait for NM as in iface.c:iface_start_NetworkManager()
for the network to be configured before sshd binds in startinetd?


Entirely possible. I don't have that now, but need to add it in.


And will loader stop calling iface_start_NetworkManager() or does
NetworkManager detect itself that it is already running?


loader will still call iface_start_NetworkManager(), which in turn calls
is_nm_running() and returns if we already have NM running.

- --
David Cantrell <dcantrell@redhat.com>

Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAktaKN8ACgkQ5hsjjIy1VkmIXQCdFv5DBDB14W 13b+2MRHs6Fm4n
4OkAoKVhC3wTN3NRpC+WD81xHA2FrqVv
=dPPU
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-24-2010, 07:41 PM
Steffen Maier
 
Default Replace linuxrc.s390 network configuration code with NetworkManager.

On 01/22/2010 11:38 PM, David Cantrell wrote:
> On Fri, 22 Jan 2010, Steffen Maier wrote:
>> On 01/22/2010 12:21 AM, David Cantrell wrote:
>>> Remove linuxrc.s390's usage of /sbin/ip, /sbin/ifconfig, and /sbin/route
>>> and instead just write the settings to the ifcfg-DEVICE file, set the
>>> device online in sysfs, and start NetworkManager. This prevents a bug

> The main goal of this change is to reduce the duplication of effort we
> currently have in linuxrc.s390. We use NetworkManager on the other
> platforms
> to bring up interfaces, so we should use it on s390x too. If it doesn't
> work
> on s390x, we should fix NetworkManager rather than work around it in
> linuxrc.s390.

Meanwhile I realized which specific change I really disliked and how to
fix it while at the same time accepting most of the removals. Thanks for
having been patient. Please see close to the bottom for my idea.

Independent of that, if those changes are also planned to go into the
rhel6-branch, then I fear we'll face serious regressions. Therefore, I
still don't think this is a good fix for 557702 unless you successfully
perform a thorough function test. To give you an impression of what that
means, here is a rough sketch of what I did before submitting the
linuxrc rewrite (and yes many of those test cases revealed flaws):

real hsi, layer2, nfs
real hsi, layer3, http
ctc, nfs
lcs, ftp
real osa, layer2, ftp
real osa, layer3, ftp
guestlan osa, layer2, nfs
guestlan osa, layer3, http
guestlan hsi, ftp
real osa, layer2, ipv6, ftp [could fetch stage2 but not further]
real osa, layer3, ipv6, ftp [could fetch stage2 but not further]

Each of those test cases was tested manually with interactive dialogs
(intentionally entering wrong values and correcting parameters or
restarting the whole dialog)
and once more fully unattended with parm&conf file & kickstart.

>>> loader/linuxrc.s390 | 313
>>> ++++-----------------------------------------------
>>> 1 files changed, 22 insertions(+), 291 deletions(-)

>>> -# sets device up and blocks until device appears to be up
>>> -function set_device_up() {

>> By removing this, you rely on enough time to have passed until NM gets
>> started which is fragile. Reminds me of device_cio_free or dasd_settle
>> et al.
>
> NM continually polls the interfaces, so I don't see the point of this
> function.

OK, fair enough.

>>> - [ -z "$mmtu_was_set" ] && unset MMTU
>>
>> This is still required for show_parm() to work. I never fully understood
>> why this magic is there to distinguish between user input and parm/conf
>> file input. However, I wouldn't want to break any old feature that was
>> in linuxrc.s390 before I touched it.
>
> The MMTU variable gets set to "mtu $MTU" and used as an argument to
> /sbin/ifconfig and /sbin/ip. NetworkManager handles this fine when it
> sees an
> MTU variable in the device ifcfg file.

The variable above is not related to configuring anything but to control
the dialog workflow. Please see below for some more details.

> It looks like NM does not do anything with the MACADDR variable
> currently. We can patch ifcfg-rh to honor that.

This is required for real OSA to work in layer2 mode, which has become
the driver default.

>>> -function do_network() {

>>> -function do_broadcast() {

>> Those two functions are there on purpose, to help users with old
>> parm/conf file and to acquaint them with the changes we introduced.
>> Otherwise they would most probably never get to know that there are
>> parameters in their parm/conf files they do not longer need or they
>> wonder why they don't get applied any more. Please keep those functions.
>
> Migration guide. Documentation.

I've never heard of a migration guide. Also, the users already have to
read installation guide, all release notes for all updates since and
including the GA of the major release plus probably the knowledge base.
Based on my experience with holding hands-on install workshops, I doubt
users would detect the useful fact that some parm file options have
changed, if it was documented somewhere. There are already (RHEL 5)
features since a while now that I haven't found officially documented
anywhere, e.g. "clearpart --initlabel --drives=dasda,dasdb,dasdc" for
dasdfmt during kickstart or installation from FCP-attached DVD drive.
Therefore, providing the users with hints on the console, where they
actually look at improves usability significantly at virtually no cost
for development.

>>> -function configure_ipv4_gateway() {

>>> - if ! tv route add default gw $GATEWAY dev $DEVICE; then

>>> - echo $"Trying to reach gateway $GATEWAY..."

>>> - if ! ping -c 1 $GATEWAY >& /dev/null; then
>>> - echo $"Could not reach your default gateway $GATEWAY"
>>> - return 1
>>> - fi
>>> - fi
>>> - return 0
>>> -}

>> Now, we are starting to loose significant parts of usability, which was
>> the sole purpose of rewriting linuxrc.s390 in the first place. It is a
>> step back towards the old linuxrc which would only ask all parameters
>> and then try to configure the network ignoring error cases and not
>> helping the user to confirm his/her entries were syntactically and even
>> more so semantically correct.
>
> This is exactly the kind of stuff that NetworkManager will handle for
> us. One
> thing that led me to removing this code was that I kept hitting a problem
> where the "ping -c 1" test on $GATEWAY would only work part of the
> time. If I
> added "-w 5" for a timeout for the entire run, it worked. But then that's
> just for my VM. NetworkManager can take care of this for us and can
> report if
> the connection is up or not.

I admit that we have faced some false positives with those heuristics in
linuxrc.s390. However, I wonder what's better: have hints with
occasional false positives or have no user support at all regarding
network parameters. Additionally some false positives are fixable with
minimal effort. We cannot expect every user to be fluent in network
stuff. Many probably just enter what they have been told by their NOC
department and that is fine. Network install is probably the most common
install type on s390. Any algorithmic help we can provide for the users
to detect wrong input early reduces the pain of an installation
especially for the less experienced users which we would like to
support with usability improvements.

Please correct me if I'm wrong, but I suspect NM will "only" check for
the network link but not beyond such as reachability of the gateway or
DNS server. So NM would only account for parts of the usability we had
just introduced. That said, I don't consider loosing a few heuristics a
show stopper here.

> Same explanation as above. Also, the way linuxrc.s390 is currently written
> won't allow for dual stack configuration, which we need to support during
> installation. We already have the code to collect the values from users
> and
> NetworkManager can do dual stack configuration of the interface. I
> still need
> to modify things slightly to allow for dual stack rather than the either/or
> approach now.

That's a good point. Considering that we may get additional network
setup features such as dhcp(6) and IPv6 autoconf, I'm starting to like it.

>>> -function handle_dns() {
>>> - # - foreach DNS try if server is reachable by one ping

>>> -# if nslookup $dnsitem $dnsitem >& /dev/null; then

> So the problem I have with this function is that it's entirely too fragile.
> Verifying that DNS servers are where we say they are and that we can
> look up
> things is putting too much trust in DNS during installation. We don't
> enforce
> this on other platforms and I don't see why we should here.

We don't enforce DNS on s390 as well, so no difference here. If and only
if the user decides to use DNS by entering DNS server addresses which is
optional, then we check if the servers are reachable with ping (the
nslookup part is commented). If we wouldn't try to reach the DNS server,
the dialog workflow would end with the last user input and when loader
or whatever component later in the install process actually tried to
resolve names over DNS, it would be too late and the user could no
longer correct his input. The only option is then to restart the install
all over from the beginning. Huge fun on s390 answering all questions
again from scratch.

>>> - if [ -n "$mmtu_was_set" ]; then
>>> - echo "MMTU="$MMTU""
>>> - elif [ -n "$mtu_was_set" ]; then
>>> + if [ -n "$mtu_was_set" ]; then
>>> echo "MTU=$MTU"
>>> fi

>>> -[ -n "$MMTU" ] && mmtu_was_set=$MMTU
>>
>> What does this change cause? Did you test that this does not break any
>> previously available behavior?
>
> I set an MTU of 4096 during installation and that still works when I use
> this
> version of linuxrc.s390 that just runs NM.

I meant to ask what removing those variables means to the dialog
workflow and if this may break the workflow, i.e. "restart dialog" might
no longer behave as expected for some parm file options such as MTU.
Such workflow control variables are there for a reason and I had
thoroughly tested that things work as they did with the old linuxrc.
Removing functions that configure L3 aspects of the network, that will
be taken care of by NM, is one thing, but you should let other code
pieces regarding workflow unmodified unless there are good reasons to
modify the workflow.

>>> + /usr/sbin/NetworkManager
>>> --pid-file=/var/run/NetworkManager/NetworkManager.pid
>>
>> Would we have to wait for NM as in iface.c:iface_start_NetworkManager()
>> for the network to be configured before sshd binds in startinetd?
>
> Entirely possible. I don't have that now, but need to add it in.

Here is my general idea: For all the stuff that NM configures, linuxrc
becomes a pure UI without configuring itself. As such it needs all the
UI workflow that is in loader/net.c. I think we may start NM early in
linuxrc, definitely NOT after the dialog loop was left.

Everything between and including the calls to do_hostname and
do_searchdns needs to be its own atomic configuration item in the
linuxrc UI. After the user has entered everything, we have to give NM
time to configure the network device and see with get_connection() if it
came up correctly and only then we may continue the dialog workflow with
do_dasd. Otherwise, the atomic configuration is started all over at
do_hostname to give the user the possibility to correct his input.

>> And will loader stop calling iface_start_NetworkManager() or does
>> NetworkManager detect itself that it is already running?
>
> loader will still call iface_start_NetworkManager(), which in turn calls
> is_nm_running() and returns if we already have NM running.

OK, that's good. I overlooked that part. Thanks for explaining.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 03:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org