summaryrefslogtreecommitdiff
path: root/xenserver/etc_xensource_scripts_vif
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-01-16 11:23:26 -0800
committerBen Pfaff <blp@nicira.com>2012-01-24 09:52:48 -0800
commitacfb4e95970bc6ff851fd21a7f055f503faca144 (patch)
treee1bf418a6dedf0be635e46189a7c5039149e5213 /xenserver/etc_xensource_scripts_vif
parent490df1ef184f4a506aa1837e35179e3f340be8d0 (diff)
downloadopenvswitch-acfb4e95970bc6ff851fd21a7f055f503faca144.tar.gz
xenserver: Synchronize scripts with XenServer 6.0.0.
This commit updates the "vif" and "interface-reconfigure" scripts installed by Open vSwitch on Citrix XenServer with those in XenServer 6.0.0. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'xenserver/etc_xensource_scripts_vif')
-rwxr-xr-xxenserver/etc_xensource_scripts_vif40
1 files changed, 38 insertions, 2 deletions
diff --git a/xenserver/etc_xensource_scripts_vif b/xenserver/etc_xensource_scripts_vif
index 062549862..78434fb6c 100755
--- a/xenserver/etc_xensource_scripts_vif
+++ b/xenserver/etc_xensource_scripts_vif
@@ -150,6 +150,30 @@ remove_from_bridge()
esac
}
+call_hook_script() {
+ local domid=$1
+ local action=$2
+ # Call the VIF hotplug hook if present
+ if [ -x /etc/xapi.d/vif-hotplug ]; then
+ 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)
+ fi
+ if [ -n "${vm_uuid}" ] ; then
+ logger -t scripts-vif "VM UUID ${vm_uuid}"
+ fi
+
+ local vif_uuid=$(xenstore-read "${PRIVATE}/vif-uuid" 2>/dev/null)
+ if [ -n "${vif_uuid}" ] ; then
+ logger -t scripts-vif "VIF UUID ${vif_uuid}"
+ fi
+ if [ -n "${vif_uuid}" -a -n "${vm_uuid}" ] ; then
+ logger -t scripts-vif "Calling VIF hotplug hook for VM ${vm_uuid}, VIF ${vif_uuid}"
+ /etc/xapi.d/vif-hotplug -action "${action}" -vifuuid "${vif_uuid}" -vmuuid "${vm_uuid}"
+ fi
+ fi
+}
+
NETWORK_MODE=$(cat /etc/xensource/network.conf)
ACTION=$1
@@ -171,8 +195,13 @@ esac
case ${TYPE} in
vif)
- DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
- DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
+ if [ -z ${XENBUS_PATH} ]; then
+ DOMID=$3
+ DEVID=$4
+ else
+ DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
+ DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
+ fi
dev=vif${DOMID}.${DEVID}
;;
tap)
@@ -210,6 +239,7 @@ online)
# xs-xen.pq.hq:91e986b8e49f netback-wait-for-hotplug
xenstore-write "/local/domain/0/backend/vif/${DOMID}/${DEVID}/hotplug-status" "connected"
+ call_hook_script $DOMID "${ACTION}"
fi
;;
@@ -222,8 +252,14 @@ add)
remove)
if [ "${TYPE}" = "vif" ] ;then
xenstore-rm "${HOTPLUG}/hotplug"
+ call_hook_script $DOMID "${ACTION}"
fi
logger -t scripts-vif "${dev} has been removed"
remove_from_bridge
;;
+
+move)
+ if [ "${TYPE}" = "vif" ] ;then
+ add_to_bridge
+ fi
esac