[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 05 of 13 RFC] hotplug NetBSD: pass an action instead of a state to hotplug scripts
# HG changeset patch # User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx> # Date 1326564288 -3600 # Node ID 0b45289e57b9fbeee3780f24a6398f7911a3320c # Parent 4ae3d8e89ed8b491d342ebb8877386f9b72e1c06 hotplug NetBSD: pass an action instead of a state to hotplug scripts change second parameter of NetBSD hotplug scripts to take an action (CONNECT/DISCONNECT) instead of a xenbus state. This patch also changes the behaviour of xenbackend to pass an action instead of a state. Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx> diff -r 4ae3d8e89ed8 -r 0b45289e57b9 tools/hotplug/NetBSD/block --- a/tools/hotplug/NetBSD/block Sat Jan 14 19:04:48 2012 +0100 +++ b/tools/hotplug/NetBSD/block Sat Jan 14 19:04:48 2012 +0100 @@ -18,7 +18,7 @@ error() { xpath=$1 -xstatus=$2 +xaction=$2 xparams=$(xenstore-read "$xpath/params") if [ -f $xparams ]; then @@ -27,8 +27,8 @@ else xtype="phy" fi -case $xstatus in -6) +case $xaction in +2) # device removed case $xtype in file) @@ -46,7 +46,7 @@ 6) xenstore-rm $xpath exit 0 ;; -2) +1) case $xtype in file) # Store the list of available vnd(4) devices in diff -r 4ae3d8e89ed8 -r 0b45289e57b9 tools/hotplug/NetBSD/vif-bridge --- a/tools/hotplug/NetBSD/vif-bridge Sat Jan 14 19:04:48 2012 +0100 +++ b/tools/hotplug/NetBSD/vif-bridge Sat Jan 14 19:04:48 2012 +0100 @@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P export PATH xpath=$1 -xstatus=$2 +xaction=$2 -case $xstatus in -6) +case $xaction in +2) # device removed xenstore-rm $xpath exit 0 ;; -2) +1) xbridge=$(xenstore-read "$xpath/bridge") xfid=$(xenstore-read "$xpath/frontend-id") xhandle=$(xenstore-read "$xpath/handle") diff -r 4ae3d8e89ed8 -r 0b45289e57b9 tools/hotplug/NetBSD/vif-ip --- a/tools/hotplug/NetBSD/vif-ip Sat Jan 14 19:04:48 2012 +0100 +++ b/tools/hotplug/NetBSD/vif-ip Sat Jan 14 19:04:48 2012 +0100 @@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P export PATH xpath=$1 -xstatus=$2 +xaction=$2 -case $xstatus in -6) +case $xaction in +2) # device removed xenstore-rm $xpath exit 0 ;; -2) +1) xip=$(xenstore-read "$xpath/ip") xfid=$(xenstore-read "$xpath/frontend-id") xhandle=$(xenstore-read "$xpath/handle") diff -r 4ae3d8e89ed8 -r 0b45289e57b9 tools/xenbackendd/xenbackendd.c --- a/tools/xenbackendd/xenbackendd.c Sat Jan 14 19:04:48 2012 +0100 +++ b/tools/xenbackendd/xenbackendd.c Sat Jan 14 19:04:48 2012 +0100 @@ -34,6 +34,9 @@ #define DEVTYPE_VIF 1 #define DEVTYPE_VBD 2 +#define CONNECT "1" +#define DISCONNECT "2" + #define DOMAIN_PATH "/local/domain/0" #ifndef XEN_SCRIPT_DIR @@ -149,6 +152,7 @@ main(int argc, char * const argv[]) unsigned int num; char *s; int state; + char *action; char *sstate; char *p; char buf[80]; @@ -297,11 +301,13 @@ main(int argc, char * const argv[]) strerror(errno)); goto next2; } - doexec(s, vec[XS_WATCH_PATH], sstate); + action = (state == 6 ? DISCONNECT : CONNECT); + doexec(s, vec[XS_WATCH_PATH], action); break; case DEVTYPE_VBD: - doexec(vbd_script, vec[XS_WATCH_PATH], sstate); + action = (state == 6 ? DISCONNECT : CONNECT); + doexec(vbd_script, vec[XS_WATCH_PATH], action); break; default: _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |