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 1 of 3] scripts/block: Update and disable blkback queue

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 1 of 3] scripts/block: Update and disable blkback queue state callbacks
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 8 Jul 2010 13:00:23 +0100
Delivery-date: Thu, 08 Jul 2010 05:10:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1278590422@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.1278590422@ely>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# HG changeset patch
# User Daniel Stodden <daniel.stodden@xxxxxxxxxx>
# Date 1278590394 -3600
# Node ID 95410b9efc9a51ccefa25f2e5048c25cef2bd1b4
# Parent  383da5eaa8ae4555c33afea04d5f7a19c5c726c3
scripts/block: Update and disable blkback queue state callbacks.

Fixed, then disabled for now. The change handler is only left around
for reference, and upstreaming to xen.org, eventually.

The queue state variable in kernel space was eliminated, we now exit
the dispatcher for any of pause/shutdown/disconnect operations.
Instead we cleanly write/remove the kthread-pid before signalling
transitions.

Scripts now can hook into shutdown-done too. This is useful because
the hotplug scripts want time to ack the shutdown change, before the
agent gets to remove the backend. Exit signalling might later aid in
other areas, e.g. for consistent ionice modes.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 383da5eaa8ae -r 95410b9efc9a scripts/block
--- a/scripts/block     Thu Jul 08 11:21:19 2010 +0100
+++ b/scripts/block     Thu Jul 08 12:59:54 2010 +0100
@@ -11,9 +11,15 @@
 XAPI=/xapi/${DOMID}/hotplug/${TYPE}/${DEVID}
 
 HOTPLUG="${XAPI}/hotplug"
+
+KTHREAD_PID="${XENBUS_PATH}/kthread-pid"
+
 PAUSE="${XENBUS_PATH}/pause"
 PAUSE_DONE="${XENBUS_PATH}/pause-done"
 
+SHUTDOWN="${XENBUS_PATH}/shutdown-request"
+SHUTDOWN_DONE="${XENBUS_PATH}/shutdown-done"
+
 syslog ()
 {
        logger -pdaemon.info -tscripts-block -- "$DEVNAME[$ACTION]: $*"
@@ -24,26 +30,37 @@
        syslog "writing $HOTPLUG = online"
        xenstore write "$HOTPLUG" "online"
 
-       echo $(((1<<1) | (1<<3))) > $SYSFS_PATH/queue_events # running|paused
+       # RUNNING          (1<<0)
+       # PAUSE_DONE       (1<<1)
+       # SHUTDOWN_DONE    (1<<2)
+       # PAUSE_REQUEST    (1<<3)
+       # SHUTDOWN_REQUEST (1<<4)
+
+       # echo $(((1<<1) | (1<<3))) > $SYSFS_PATH/queue_events # unpaused|paused
        ;;
 
 change)
-       state=$(xenstore read "${XENBUS_PATH}/queue-state")
-       case "$state" in
-               1) state=running;;
-               3) state=paused;;
-               *) state="unexpected-$state";;
-       esac
+       if pid=$(xenstore read "$KTHREAD_PID" 2>/dev/null)
+       then
+               state=running
+       else
+               state=stopped
+       fi
 
-       syslog "queue-state = $state"
+       syslog "kthread-pid = '$pid'"
 
        case "$state" in
-               paused)
+               stopped)
                        if xenstore exists "$PAUSE"
                        then
                                syslog "writing $PAUSE_DONE"
                                xenstore write "$PAUSE_DONE" ""
                        fi
+                       if xenstore exists "$SHUTDOWN"
+                       then
+                               syslog "writing $SHUTDOWN_DONE"
+                               xenstore write "$SHUTDOWN_DONE" ""
+                       fi
                        ;;
                running)
                        if xenstore exists "$PAUSE_DONE"
@@ -51,12 +68,16 @@
                                syslog "removing $PAUSE_DONE"
                                xenstore rm "$PAUSE_DONE"
                        fi
+                       if xenstore exists "$SHUTDOWN_DONE"
+                       then
+                               syslog "WARNING: queue restart in shutdown 
state."
+                       fi
                        ;;
        esac
        ;;
 
 remove)
        syslog "removing $HOTPLUG"
-       xenstore rm "${XAPI}/hotplug"
+       xenstore rm "$HOTPLUG"
        ;;
 esac
 scripts/block |  41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)


Attachment: blkback-next-scripts-block.diff
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>