[Ovirt-devel] [PATCH node] Adds vlan support to auto-installations for the node. bz#511056
Darryl L. Pierce
dpierce at redhat.com
Mon Jul 13 19:11:55 UTC 2009
If the vlan kernel argument is provided, then it is used during
networking auto-configuration.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
scripts/ovirt-config-networking | 56 ++++++++++++++++++++++++++++++++------
scripts/ovirt-early | 7 ++++-
2 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 2674dfe..2bd082e 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -45,6 +45,33 @@ function has_configured_interface
fi
}
+# Configures vlan for the node.
+# $1 - the nic
+# $2 - the network bridge name
+# $3 - the vlan id
+# $4 - the VL_ROOT variable
+# $5 - the VL_CONFIG variable
+# $6 - the IF_ROOT value
+# $7 - the vlan config filename variable
+# $8 - the NIC config filename
+function setup_vlan
+{
+ local nic=$1
+ local bridge=$2
+ local vlan_id=$3
+ local vlroot=$4
+ local vlconfig=$5
+ local ifroot=$6
+ local vlfilename=$7
+ local iffilename=$8
+
+ eval $vlroot="${ifroot}.${vlan_id}"
+ eval $vlconfig=\"rm \$${vlroot}\\nset \$${vlroot}/DEVICE ${nic}.${vlan_id}\"
+ eval $vlconfig=\"\$${vlconfig}\\nset \$${vlroot}/BRIDGE ${bridge}\"
+ eval $vlconfig=\"\$${vlconfig}\\nset \$${vlroot}/VLAN yes\"
+ eval $vlfilename="${iffilename}.${vlan_id}"
+}
+
function configure_interface
{
local NIC=$1
@@ -118,12 +145,8 @@ function configure_interface
A|a) CONFIGURED_NIC=""; return;;
*)
if [[ -n "$REPLY" ]] && [[ "$REPLY" =~ "^[0-9]{1,}$" ]]; then
- VLAN_ID=$REPLY
- VL_ROOT="${IF_ROOT}.${VLAN_ID}"
- VL_CONFIG="rm ${VL_ROOT}\nset ${VL_ROOT}/DEVICE ${NIC}.${VLAN_ID}"
- VL_CONFIG="${VL_CONFIG}\nset ${VL_ROOT}/BRIDGE ${BRIDGE}"
- VL_CONFIG="${VL_CONFIG}\nset ${VL_ROOT}/VLAN yes"
- VL_FILENAME="${IF_FILENAME}.${VLAN_ID}"
+ VLAN_ID=$REPLY
+ setup_vlan $NIC $BRIDGE $VLAN_ID VL_ROOT VL_CONFIG $IF_ROOT VL_FILENAME $IF_FILENAME
break
fi
;;
@@ -236,12 +259,21 @@ function configure_interface
esac
fi
+ if [ -n "$OVIRT_VLAN" ]; then
+ VLAN_ID=$OVIRT_VLAN
+ setup_vlan $NIC $BRIDGE $VLAN_ID VL_ROOT VL_CONFIG $IF_ROOT VL_FILENAME $IF_FILENAME
+ fi
+
if [ -z "$OVIRT_IP_ADDRESS" ]; then
- IF_CONFIG="${IF_CONFIG}\nset ${IF_ROOT}/BRIDGE ${BRIDGE}"
- BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
+ if [ -z "$VL_CONFIG" ]; then
+ IF_CONFIG="${IF_CONFIG}\nset ${IF_ROOT}/BRIDGE ${BRIDGE}"
+ fi
+ BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
else
if [ "$OVIRT_IP_ADDRESS" != "off" ]; then
- IF_CONFIG="${IF_CONFIG}\nset ${IF_ROOT}/BRIDGE ${BRIDGE}"
+ if [ -z "$VL_CONFIG" ]; then
+ IF_CONFIG="${IF_CONFIG}\nset ${IF_ROOT}/BRIDGE ${BRIDGE}"
+ fi
BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $OVIRT_IP_ADDRESS"
if [ -n "$OVIRT_IP_NETMASK" ]; then
BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $OVIRT_IP_NETMASK"
@@ -254,9 +286,15 @@ function configure_interface
IF_CONFIG="$IF_CONFIG\nset $IF_ROOT/ONBOOT yes"
BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/ONBOOT yes"
+ if [ -n "${VL_CONFIG}" ]; then
+ VL_CONFIG="$VL_CONFIG\nset $VL_ROOT/ONBOOT yes"
+ fi
printf "$IF_CONFIG\n" > $IF_FILENAME
printf "$BR_CONFIG\n" > $BR_FILENAME
+ if [ -n "$VL_CONFIG" ]; then
+ printf "$VL_CONFIG\n" > $VL_FILENAME
+ fi
fi
}
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index b4de30e..560fa14 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -208,10 +208,12 @@ start() {
# ipv6=dhcp|auto
# dns=server[,server]
# ntp=server[,server]
+ # vlan=id
# static network configuration
ip_address=
ip_gateway=
ip_netmask=
+ vlan=
netmask=
gateway=
ipv6=
@@ -344,6 +346,9 @@ start() {
hostname=*)
hostname=${i#hostname=}
;;
+ vlan=*)
+ vlan=${i#vlan=}
+ ;;
syslog=*)
i=${i#syslog=}
eval $(printf $i|awk -F: '{print "syslog_server="$1; print "syslog_port="$2;}')
@@ -365,7 +370,7 @@ start() {
ip_gateway=$gateway
fi
# save boot parameters as defaults for ovirt-config-*
- params="bootif init vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size local_boot standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot"
+ params="bootif init vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size local_boot standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot"
# mount /config unless firstboot is forced
if [ "$firstboot" != "1" ]; then
mount_config
--
1.6.2.5
More information about the ovirt-devel
mailing list