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-devel

[Xen-devel] [PATCH 6 of 6] dm-userspace backend script and xmexample cha

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6 of 6] dm-userspace backend script and xmexample change
From: Ryan Grimm <grimm@xxxxxxxxxx>
Date: Fri, 25 Aug 2006 16:24:14 -0500
Cc: Dan Smith <danms@xxxxxxxxxx>
Delivery-date: Fri, 25 Aug 2006 14:29:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1156540578@venkman-64>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
Signed-off-by: Ryan Grimm <grimm@xxxxxxxxxx>
Signed-off-by: Dan Smith <danms@xxxxxxxxxx>

# HG changeset patch
# User Ryan Grimm <grimm@xxxxxxxxxx>
# Date 1156536098 18000
# Node ID 55e3795e5bc46ea6a205e60ebf27ed9faf306616
# Parent  be4574d288030b64d4623dd33505d0990185a6b9
dm-userspace backend script and xmexample change

diff -r be4574d28803 -r 55e3795e5bc4 tools/examples/Makefile
--- a/tools/examples/Makefile   Fri Aug 25 15:01:36 2006 -0500
+++ b/tools/examples/Makefile   Fri Aug 25 15:01:38 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 be4574d28803 -r 55e3795e5bc4 tools/examples/README
--- a/tools/examples/README     Fri Aug 25 15:01:36 2006 -0500
+++ b/tools/examples/README     Fri Aug 25 15:01:38 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 be4574d28803 -r 55e3795e5bc4 tools/examples/xmexample1
--- a/tools/examples/xmexample1 Fri Aug 25 15:01:36 2006 -0500
+++ b/tools/examples/xmexample1 Fri Aug 25 15:01:38 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 be4574d28803 -r 55e3795e5bc4 tools/examples/block-dmu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/examples/block-dmu  Fri Aug 25 15:01:38 2006 -0500
@@ -0,0 +1,57 @@
+#!/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")
+
+wait_for_cowd_exit() {
+       while ps ax | grep -v grep | grep cowd | grep -q $1; do
+               sleep 1
+       done
+}
+
+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'
+
+               wait_for_cowd_exit $target
+
+               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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 6 of 6] dm-userspace backend script and xmexample change, Ryan Grimm <=