Skip to content
Browse files

Make the xapi vif script a little more like upstream's

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
  • Loading branch information...
1 parent 9666f1c commit 84770f0d94266e4dde162d97ce963c66472b13bd @jonludlam jonludlam committed Nov 1, 2012
Showing with 20 additions and 10 deletions.
  1. +3 −1 Makefile
  2. +5 −5 scripts/OMakefile
  3. +10 −2 scripts/vif
  4. +2 −2 scripts/xen-backend.rules
View
4 Makefile
@@ -42,6 +42,7 @@ WEBDIR=/var/www/html
XHADIR=/opt/xensource/xha
BINDIR=/usr/lib/xcp/bin
SBINDIR=/usr/sbin
+UDEVDIR=/lib/udev
else
VARDIR=/var/xapi
VARPATCHDIR=/var/patch
@@ -59,10 +60,11 @@ WEBDIR=/opt/xensource/www
XHADIR=/opt/xensource/xha
BINDIR=/opt/xensource/bin
SBINDIR=/opt/xensource/bin
+UDEVDIR=/etc/udev
endif
-export VARDIR ETCDIR OPTDIR PLUGINDIR HOOKSDIR INVENTORY VARPATCHDIR LIBEXECDIR XAPICONF RRDDCONF SCRIPTSDIR SHAREDIR WEBDIR XHADIR BINDIR SBINDIR
+export VARDIR ETCDIR OPTDIR PLUGINDIR HOOKSDIR INVENTORY VARPATCHDIR LIBEXECDIR XAPICONF RRDDCONF SCRIPTSDIR SHAREDIR WEBDIR XHADIR BINDIR SBINDIR UDEVDIR
.PHONY: all
all: version ocaml/fhs.ml
View
10 scripts/OMakefile
@@ -5,12 +5,12 @@ SITE_DIR=$(shell python -c "from distutils.sysconfig import get_python_lib; prin
.SUBDIRS: examples host-backup-restore poweron rrdd templates
noarch-install:
- mkdir -p $(DESTDIR)/etc/udev ### FHS_FIXME
- $(IPROG) xen-backend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
- $(IPROG) xen-frontend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
- mkdir -p $(DESTDIR)/etc/udev/rules.d ### FHS_FIXME
+ mkdir -p $(DESTDIR)$(UDEVDIR)
+ $(IPROG) xen-backend.rules $(DESTDIR)$(UDEVDIR)
+ $(IPROG) xen-frontend.rules $(DESTDIR)$(UDEVDIR)
+ mkdir -p $(DESTDIR)$(UDEVDIR)/rules.d
sh -c \
- 'cd $(DESTDIR)/etc/udev/rules.d; \
+ 'cd $(DESTDIR)$(UDEVDIR)/rules.d; \
ln -sf ../xen-backend.rules; \
ln -sf ../xen-frontend.rules'
mkdir -p $(DESTDIR)$(SCRIPTSDIR)
View
12 scripts/vif
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright (C) 2008,2009 Citrix Systems, Inc.
#
@@ -21,6 +21,9 @@
# Keep other-config/ keys in sync with device.ml:vif_udev_keys
BRCTL="/usr/sbin/brctl"
+if [ ! -e $BRCTL ] ; then
+ BRCTL="/sbin/brctl"
+fi
IP="/sbin/ip"
vsctl="/usr/bin/ovs-vsctl"
@@ -225,7 +228,12 @@ ACTION=$1
if [[ $# -lt 2 ]]; then
TYPE=vif
else
- TYPE=$2
+# This script is invoked by the udev script xen-backend.rules, which
+# for XCP/XS lives in xen-api.git. However, there is also a version
+# included in the xen repo. For the sake of compatibility we retain
+# the format of the xen scripts, for which the format of $2 is something
+# like: type_if=vif. In this case, we here set TYPE to 'vif'.
+ TYPE=`echo $2 | cut -d= -f2`
fi
case $NETWORK_MODE in
View
4 scripts/xen-backend.rules
@@ -1,7 +1,7 @@
SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="@SCRIPTSDIR@/tap $env{ACTION}"
SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="@SCRIPTSDIR@/block $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif*", RUN+="@SCRIPTSDIR@/vif $env{ACTION} vif"
-SUBSYSTEM=="net", KERNEL=="tap*", RUN+="@SCRIPTSDIR@/vif $env{ACTION} tap"
+SUBSYSTEM=="xen-backend", KERNEL=="vif*", RUN+="@SCRIPTSDIR@/vif $env{ACTION} type_if=vif"
+SUBSYSTEM=="net", KERNEL=="tap*", RUN+="@SCRIPTSDIR@/vif $env{ACTION} type_if=tap"
KERNEL=="evtchn", NAME="xen/%k"

0 comments on commit 84770f0

Please sign in to comment.
Something went wrong with that request. Please try again.