WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 4 of 4] [PATCH] xenserver: Clean-up space/tabs issues i

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 4 of 4] [PATCH] xenserver: Clean-up space/tabs issues in vif script
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 8 Jul 2010 14:33:04 +0100
Delivery-date: Thu, 08 Jul 2010 06:52:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1278595980@ely>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1278595980@ely>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# HG changeset patch
# User Justin Pettit <jpettit@xxxxxxxxxx>
# Date 1278595953 -3600
# Node ID 318ea84e251395c3e46c2579301d48904aabb84b
# Parent  97c8b2a98657954d71a521a31080f7d6f2b6c310
[PATCH] xenserver: Clean-up space/tabs issues in vif script

>From 291a0f6b6e05fe5be28b935436abb5a958334885 Mon Sep 17 00:00:00 2001
Date: Wed, 21 Apr 2010 03:53:22 -0700
Our vif script had a mishmash of tab and space indentations.  The
original vif script only uses spaces, so I went with that style.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 scripts/vif |  172 +++++++++++++++++-----------------
 1 files changed, 86 insertions(+), 86 deletions(-)

diff -r 97c8b2a98657 -r 318ea84e2513 scripts/vif
--- a/scripts/vif       Thu Jul 08 14:32:32 2010 +0100
+++ b/scripts/vif       Thu Jul 08 14:32:33 2010 +0100
@@ -39,17 +39,17 @@
 {
     local arg=$(xenstore-read "${PRIVATE}/other-config/promiscuous" 
2>/dev/null)
     if [ $? -eq 0 -a -n "${arg}" ] ; then
-       case $NETWORK_MODE in
-           bridge)
-               case "${arg}" in 
-                   true|on) echo 1 > /sys/class/net/${dev}/brport/promisc ;;
-                   *) echo 0 > /sys/class/net/${dev}/brport/promisc ;;
-               esac
-               ;;
-           openvswitch)
-               logger -t script-vif "${dev}: Promiscuous ports are not 
supported via Open vSwitch."
-               ;;
-       esac
+        case $NETWORK_MODE in
+            bridge)
+                case "${arg}" in 
+                    true|on) echo 1 > /sys/class/net/${dev}/brport/promisc ;;
+                    *) echo 0 > /sys/class/net/${dev}/brport/promisc ;;
+                esac
+                ;;
+            openvswitch)
+                logger -t script-vif "${dev}: Promiscuous ports are not 
supported via Open vSwitch."
+                ;;
+        esac
     fi
 }
 
@@ -70,8 +70,8 @@
 {
     local mtu=$(xenstore-read "${PRIVATE}/MTU" 2>/dev/null)
     if [ $? -eq 0 -a -n "${mtu}" ]; then
-       logger -t scripts-vif "Setting ${dev} MTU ${mtu}"
-       ${IP} link set "${dev}" mtu ${mtu} || logger -t scripts-vif "Failed to 
ip link set ${dev} mtu ${mtu}. Error code $?"
+        logger -t scripts-vif "Setting ${dev} MTU ${mtu}"
+        ${IP} link set "${dev}" mtu ${mtu} || logger -t scripts-vif "Failed to 
ip link set ${dev} mtu ${mtu}. Error code $?"
     fi
 }
 
@@ -89,10 +89,10 @@
 {
     local vm=$(xenstore-read "/local/domain/$DOMID/vm" 2>/dev/null)
     if [ $? -eq 0 -a -n "${vm}" ] ; then
-       local vm_uuid=$(xenstore-read "$vm/uuid" 2>/dev/null)
+        local vm_uuid=$(xenstore-read "$vm/uuid" 2>/dev/null)
     fi
     if [ -n "${vm_uuid}" ] ; then
-       set_vif_external_id "vm-uuid" "${vm_uuid}"
+        set_vif_external_id "vm-uuid" "${vm_uuid}"
     fi
 
     local vif_uuid=$(xenstore-read "${PRIVATE}/vif-uuid" 2>/dev/null)
@@ -100,7 +100,7 @@
         vif_uuid=$(xe vif-list --minimal vm-uuid="${vm_uuid}" device=$DEVID)
     fi
     if [ -n "${vif_uuid}" ] ; then
-       set_vif_external_id "vif-uuid" "${vif_uuid}"
+        set_vif_external_id "vif-uuid" "${vif_uuid}"
     fi
 
     local vif_details=
@@ -109,12 +109,12 @@
         net_uuid=$(xe vif-param-get uuid="${vif_uuid}" param-name=network-uuid)
     fi
     if [ -n "${net_uuid}" ] ; then
-       set_vif_external_id "network-uuid" "${net_uuid}"
+        set_vif_external_id "network-uuid" "${net_uuid}"
     fi
 
     local address=$(xenstore-read "/local/domain/$DOMID/device/vif/$DEVID/mac" 
2>/dev/null)
     if [ -n "${address}" ] ; then
-       set_vif_external_id "vif-mac" "${address}"
+        set_vif_external_id "vif-mac" "${address}"
     fi
 
     if $xs550; then
@@ -139,13 +139,13 @@
 {
     local address=$(xenstore-read "${PRIVATE}/bridge-MAC")
     if [ $? -ne 0 -o -z "${address}" ]; then
-       logger -t scripts-vif "Failed to read ${PRIVATE}/bridge-MAC from 
xenstore"
-       exit 1
+        logger -t scripts-vif "Failed to read ${PRIVATE}/bridge-MAC from 
xenstore"
+        exit 1
     fi
     local bridge=$(xenstore-read "${PRIVATE}/bridge")
     if [ $? -ne 0 -o -z "${bridge}" ]; then
-       logger -t scripts-vif "Failed to read ${PRIVATE}/bridge from xenstore"
-       exit 1
+        logger -t scripts-vif "Failed to read ${PRIVATE}/bridge from xenstore"
+        exit 1
     fi
     logger -t scripts-vif "Adding ${dev} to ${bridge} with address ${address}"
 
@@ -156,34 +156,34 @@
     ${IP} addr flush "${dev}"                           || logger -t 
scripts-vif "Failed to ip addr flush ${dev}"
 
     case $NETWORK_MODE in
-       bridge)
-           ${BRCTL} setfd "${bridge}" 0                        || logger -t 
scripts-vif "Failed to brctl setfd ${bridge} 0"
-           ${BRCTL} addif "${bridge}" "${dev}"                 || logger -t 
scripts-vif "Failed to brctl addif ${bridge} ${dev}"
-           ;;
-       openvswitch)
-           if [ "$TYPE" = "vif" ] ; then
-               local vif_details=$(handle_vswitch_vif_details $bridge)
-           fi
+    bridge)
+        ${BRCTL} setfd "${bridge}" 0                    || logger -t 
scripts-vif "Failed to brctl setfd ${bridge} 0"
+        ${BRCTL} addif "${bridge}" "${dev}"             || logger -t 
scripts-vif "Failed to brctl addif ${bridge} ${dev}"
+        ;;
+    openvswitch)
+        if [ "$TYPE" = "vif" ] ; then
+            local vif_details=$(handle_vswitch_vif_details $bridge)
+        fi
 
-           $vsctl -- --if-exists del-port $dev -- add-port $bridge $dev 
$vif_details
-           ;;
+        $vsctl -- --if-exists del-port $dev -- add-port $bridge $dev 
$vif_details
+        ;;
     esac
-           
+        
     ${IP} link set "${dev}" up                          || logger -t 
scripts-vif "Failed to ip link set ${dev} up"
 }
 
 remove_from_bridge()
 {
     case $NETWORK_MODE in
-       bridge)
-           # Nothing to do
-           ;;
-       openvswitch)
-            # If ovs-brcompatd is running, it might already have deleted the
-            # port.  Use --if-exists to suppress the error that would otherwise
-            # arise in that case.
-           $vsctl -- --if-exists del-port $dev
-           ;;
+    bridge)
+        # Nothing to do
+        ;;
+    openvswitch)
+        # If ovs-brcompatd is running, it might already have deleted the
+        # port.  Use --if-exists to suppress the error that would otherwise
+        # arise in that case.
+        $vsctl -- --if-exists del-port $dev
+        ;;
     esac
 }
 
@@ -201,26 +201,26 @@
     bridge|openvswitch) ;;
     vswitch) NETWORK_MODE=openvswitch ;;
     *)
-       logger -t scripts-vif "Unknown network mode $NETWORK_MODE"
-       exit 1
-       ;;
+        logger -t scripts-vif "Unknown network mode $NETWORK_MODE"
+        exit 1
+        ;;
 esac
 
 case ${TYPE} in
     vif)
-       DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
-       DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
-       dev=vif${DOMID}.${DEVID}
-       ;;
+        DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
+        DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
+        dev=vif${DOMID}.${DEVID}
+        ;;
     tap)
-       dev=$INTERFACE
-       DOMID=`echo ${dev#tap} | cut -f 1 -d '.'`
-       DEVID=`echo ${dev#tap} | cut -f 2 -d '.'`
-       ;;
+        dev=$INTERFACE
+        DOMID=`echo ${dev#tap} | cut -f 1 -d '.'`
+        DEVID=`echo ${dev#tap} | cut -f 2 -d '.'`
+        ;;
     *)  
-       logger -t scripts-vif "unknown interface type ${TYPE}"
-       exit 1
-       ;;
+        logger -t scripts-vif "unknown interface type ${TYPE}"
+        exit 1
+        ;;
 esac
 
 XAPI=/xapi/${DOMID}/hotplug/vif/${DEVID}
@@ -230,37 +230,37 @@
 logger -t scripts-vif "Called as \"$@\" domid:$DOMID devid:$DEVID 
mode:$NETWORK_MODE"
 case "${ACTION}" in
 online)
-       if [ "${TYPE}" = "vif" ] ; then
-           handle_ethtool rx
-           handle_ethtool tx
-           handle_ethtool sg
-           handle_ethtool tso
-           handle_ethtool ufo
-           handle_ethtool gso
+    if [ "${TYPE}" = "vif" ] ; then
+        handle_ethtool rx
+        handle_ethtool tx
+        handle_ethtool sg
+        handle_ethtool tso
+        handle_ethtool ufo
+        handle_ethtool gso
 
-           handle_mtu
-           add_to_bridge
-           handle_promiscuous
+        handle_mtu
+        add_to_bridge
+        handle_promiscuous
 
-           xenstore-write "${HOTPLUG}/vif" "${dev}"
-           xenstore-write "${HOTPLUG}/hotplug" "online"
+        xenstore-write "${HOTPLUG}/vif" "${dev}"
+        xenstore-write "${HOTPLUG}/hotplug" "online"
 
-           # xs-xen.pq.hq:91e986b8e49f netback-wait-for-hotplug
-           xenstore-write 
"/local/domain/0/backend/vif/${DOMID}/${DEVID}/hotplug-status" "connected"
-       fi
-       ;;
+        # xs-xen.pq.hq:91e986b8e49f netback-wait-for-hotplug
+        xenstore-write 
"/local/domain/0/backend/vif/${DOMID}/${DEVID}/hotplug-status" "connected"
+    fi
+    ;;
 
 add)
-       if [ "${TYPE}" = "tap" ] ; then
-           add_to_bridge
-       fi
-       ;;
+    if [ "${TYPE}" = "tap" ] ; then
+        add_to_bridge
+    fi
+    ;;
 
 remove)
-       if [ "${TYPE}" = "vif" ] ;then
-           xenstore-rm "${HOTPLUG}/hotplug"
-       fi
-       logger -t scripts-vif "${dev} has been removed"
-       remove_from_bridge
-       ;;
+    if [ "${TYPE}" = "vif" ] ;then
+        xenstore-rm "${HOTPLUG}/hotplug"
+    fi
+    logger -t scripts-vif "${dev} has been removed"
+    remove_from_bridge
+    ;;
 esac
 scripts/vif |  164 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 82 insertions(+), 82 deletions(-)


Attachment: xenserver_Clean-up_space_tabs_issues_in_vif_script.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api