Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit a8bed00

Browse files
ospalaxvholer
authored andcommitted
B #83: Fix route metrics for CentOS
+ small refactor + fix whitespace Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
1 parent 3de259b commit a8bed00

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/postinstall

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ if [ -d /etc/sysconfig/network-scripts ]; then
9999
# Prepare network files
100100
find /etc/sysconfig/network-scripts -type f \
101101
-name 'ifcfg-*' ! -name 'ifcfg-lo' \
102+
-o -name 'route-*' ! -name 'route-lo' \
102103
-exec rm -f {} \;
103104

104105
if [ "${NETWORK_EC2}" = 'yes' ]; then

src/etc/one-context.d/loc-10-network##network-scripts.one

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ EOT
108108

109109
if [ -n "$GATEWAY" ]; then
110110
if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
111-
echo "default $GATEWAY - $DEV" ${METRIC:+metric ${METRIC}} >> /etc/sysconfig/network/ifroute-$DEV
111+
echo "default $GATEWAY - $DEV ${METRIC:+metric ${METRIC}}" \
112+
>> "${CONFIG_PATH}/ifroute-${DEV}"
112113
else
113-
echo "GATEWAY=$GATEWAY"
114-
115-
if [ -n "$METRIC" ]; then
116-
echo "METRIC=$METRIC"
117-
fi
114+
echo "default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}" \
115+
>> "${CONFIG_PATH}/route-${DEV}"
118116
fi
119117
fi
120118

@@ -244,6 +242,7 @@ gen_network_configuration()
244242
[ -z "${DEV}" ] && continue
245243

246244
(
245+
rm -f /etc/sysconfig/network-scripts/route-$DEV
247246
rm -f /etc/sysconfig/network/ifroute-$DEV
248247
rm -f /etc/sysconfig/network/ifsysctl-$DEV
249248

src/etc/one-context.d/loc-10-network-pci##one

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ for pci in $PCI_INTERFACES; do
9393
if [ -n "$IP" ]; then
9494
ip address add $IP/$MASK dev $DEV
9595

96-
if [ -n "$GATEWAY" ]; then
97-
ip route add default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}
98-
fi
96+
if [ -n "$GATEWAY" ]; then
97+
ip route add default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}
98+
fi
9999
fi
100100

101101
# IPv6

0 commit comments

Comments
 (0)