[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 6 of 6] dm-userspace backend script and xmexample
Here's the updated patch, just added to xmexample1 instead of a whole new example. Signed-off-by: Ryan Grimm <grimm@xxxxxxxxxx> Signed-off-by: Dan Smith <danms@xxxxxxxxxx> diff -r 5e07f07351fd -r 1e3f83f3baab tools/examples/Makefile --- a/tools/examples/Makefile Tue Aug 22 11:49:18 2006 -0500 +++ b/tools/examples/Makefile Tue Aug 22 12:02:22 2006 -0500 @@ -32,6 +32,7 @@ XEN_SCRIPTS += vtpm vtpm-delete XEN_SCRIPTS += vtpm vtpm-delete XEN_SCRIPTS += xen-hotplug-cleanup XEN_SCRIPTS += external-device-migrate +XEN_SCRIPTS += block-dmu XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh diff -r 5e07f07351fd -r 1e3f83f3baab tools/examples/README --- a/tools/examples/README Tue Aug 22 11:49:18 2006 -0500 +++ b/tools/examples/README Tue Aug 22 12:02:22 2006 -0500 @@ -13,6 +13,7 @@ block-common.sh - sourced by block, block-common.sh - sourced by block, block-* block-enbd - binds/unbinds network block devices block-nbd - binds/unbinds network block devices +block-dmu - binds/unbinds dm-userspace devices external-device-migrate - called by xend for migrating external devices locking.sh - locking functions to prevent concurrent access to critical sections inside script files diff -r 5e07f07351fd -r 1e3f83f3baab tools/examples/xmexample1 --- a/tools/examples/xmexample1 Tue Aug 22 11:49:18 2006 -0500 +++ b/tools/examples/xmexample1 Tue Aug 22 12:02:22 2006 -0500 @@ -64,6 +64,13 @@ vif = [ '' ] # and MODE is r for read-only, w for read-write. disk = [ 'phy:hda1,hda1,w' ] + +#---------------------------------------------------------------------------- +# Using a dm-userspace backed device +# for dmu, the syntax is dmu:<plugin>:<cow file>:<base file> +# if <cow file> does not exist, it is created and <base file> is used +# as a base. if <cow file> does exist, <base file> is ignored. +# disk = [ 'dmu:dscow:/path/to/domain.dscow:/path/to/domain.img,hda1,w'] #---------------------------------------------------------------------------- # Define to which TPM instance the user domain should communicate. diff -r 5e07f07351fd -r 1e3f83f3baab tools/examples/block-dmu --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/examples/block-dmu Tue Aug 22 12:02:22 2006 -0500 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Copyright (C) International Business Machines Corp., 2006 +# Author: Ryan Grimm <grimm@xxxxxxxxxx> + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +p=$(xenstore_read "$XENBUS_PATH/params") +mode=$(xenstore_read "$XENBUS_PATH/mode") + +case "$command" in + add) + plugin=$(echo $p | cut -d: -f1) + dmu_file=$(echo $p | cut -d: -f2) + base_file=$(echo $p | cut -d: -f3) + + domain_name=$(xenstore_read "$XENBUS_PATH/domain") + domain_dev=$(xenstore_read "$XENBUS_PATH/dev") + target="$domain_name""_""$domain_dev" + md_dev="/dev/mapper/$target" + + lsmod | grep -q dm_user || modprobe dm-user || fatal \ + 'cannot load module dm-user' + + if [ ! -e $dmu_file ] + then + dscow_tool -c $dmu_file $base_file || fatal \ + 'creation of $dmu_file failed' + fi + + cowd --sync --pidfile=/var/run/cowd.$target.pid -p $plugin \ + $target $dmu_file || fatal 'cowd failed' + + xenstore_write "$XENBUS_PATH/node" "$target" + + claim_lock "block" + write_dev $md_dev + release_lock "block" + exit 0 + ;; + + remove) + node=$(xenstore_read "$XENBUS_PATH/node") + cowd_pid=$(cat "/var/run/cowd.$node.pid") + kill $cowd_pid + exit 0 + ;; +esac -- Thanks, Ryan Grimm IBM Linux Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |