[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 06 of 29 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 2c5bf4967eb769c69de665fc84a4d3c0d87d3440
# Parent  98c4670598600f62df864840a0cffb96ad9553f2
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 98c467059860 -r 2c5bf4967eb7 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 98c467059860 -r 2c5bf4967eb7 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 98c467059860 -r 2c5bf4967eb7 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 98c467059860 -r 2c5bf4967eb7 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.