[Ovirt-devel] [PATCH node] Adds vlan support to auto-installations for the node. bz#511056

Hugh O. Brock hbrock at redhat.com
Tue Jul 14 19:54:08 UTC 2009


On Tue, Jul 14, 2009 at 03:09:00PM -0400, Joey Boggs wrote:
> On 07/13/2009 03:11 PM, Darryl L. Pierce wrote:
> >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
> >   
> 
> Tried this on 2 different boxes getting whitespace errors, but the patch 
> file doesn't show any extra spaces?
> 
> # cat -v $patchfile
> +# Configures vlan for the node.^M
> +# $1 - the nic^M
> +# $2 - the network bridge name^M
> +# $3 - the vlan id^M
> +# $4 - the VL_ROOT variable^M
> +# $5 - the VL_CONFIG variable^M
> +# $6 - the IF_ROOT value^M
> +# $7 - the vlan config filename variable^M
> +# $8 - the NIC config filename^M
> +function setup_vlan^M
> 
> 
> -bash-3.2$ git am ../\[Ovirt-devel\]\ \[PATCH\ node\]\ Adds\ vlan\ 
> support\ to\ auto-installations\     for\ the\ node.\ bz#511056.eml
> Applying: Adds vlan support to auto-installations for the node. bz#511056
> /home/jboggs/ovirt-node/.git/rebase-apply/patch:14: trailing whitespace.
> # Configures vlan for the node.
> /home/jboggs/ovirt-node/.git/rebase-apply/patch:15: trailing whitespace.
> # $1 - the nic
> /home/jboggs/ovirt-node/.git/rebase-apply/patch:16: trailing whitespace.
> # $2 - the network bridge name
> /home/jboggs/ovirt-node/.git/rebase-apply/patch:17: trailing whitespace.
> # $3 - the vlan id
> /home/jboggs/ovirt-node/.git/rebase-apply/patch:18: trailing whitespace.
> # $4 - the VL_ROOT variable
> error: patch failed: scripts/ovirt-config-networking:45
> error: scripts/ovirt-config-networking: patch does not apply
> error: patch failed: scripts/ovirt-early:208
> error: scripts/ovirt-early: patch does not apply
> Patch failed at 0001.
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> 

My emacs buffer shows the ^Ms that are trailing each one of the lines in
that patch file...

--Hugh




More information about the ovirt-devel mailing list