FUJITA Tomonori
2007-Jan-02 17:58 UTC
[Xen-devel] [PATCH 4/4] add the scsifront/scsiback userspace scripts
This includes the userspace scripts for scsifront/scsiback. Now they just exploit blkback/blktap user-space scripts. I will work on the own format to handle more complicated scsi configurations later on. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> diff -r 6061275e566f -r c8417a9bd13c tools/examples/Makefile --- a/tools/examples/Makefile Wed Jan 03 01:36:42 2007 +0900 +++ b/tools/examples/Makefile Wed Jan 03 01:37:43 2007 +0900 @@ -22,6 +22,7 @@ XEN_SCRIPTS += network-route vif-route XEN_SCRIPTS += network-route vif-route XEN_SCRIPTS += network-nat vif-nat XEN_SCRIPTS += block +XEN_SCRIPTS += scsi XEN_SCRIPTS += block-enbd block-nbd XEN_SCRIPTS += blktap XEN_SCRIPTS += vtpm vtpm-delete diff -r 6061275e566f -r c8417a9bd13c tools/examples/xen-backend.agent --- a/tools/examples/xen-backend.agent Wed Jan 03 01:36:42 2007 +0900 +++ b/tools/examples/xen-backend.agent Wed Jan 03 01:37:43 2007 +0900 @@ -12,6 +12,9 @@ case "$XENBUS_TYPE" in ;; vbd) /etc/xen/scripts/block "$ACTION" + ;; + scsi) + /etc/xen/scripts/scsi "$ACTION" ;; vtpm) /etc/xen/scripts/vtpm "$ACTION" diff -r 6061275e566f -r c8417a9bd13c tools/examples/xen-backend.rules --- a/tools/examples/xen-backend.rules Wed Jan 03 01:36:42 2007 +0900 +++ b/tools/examples/xen-backend.rules Wed Jan 03 01:37:43 2007 +0900 @@ -1,5 +1,6 @@ SUBSYSTEM=="xen-backend", KERNEL=="tap*" SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/etc/xen/scripts/blktap $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="scsi*", RUN+="/etc/xen/scripts/scsi $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online" SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline" diff -r 6061275e566f -r c8417a9bd13c tools/python/xen/xend/XendDevices.py --- a/tools/python/xen/xend/XendDevices.py Wed Jan 03 01:36:42 2007 +0900 +++ b/tools/python/xen/xend/XendDevices.py Wed Jan 03 01:37:43 2007 +0900 @@ -21,6 +21,7 @@ from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, usbif, vfbif from xen.xend.server.BlktapController import BlktapController +from xen.xend.server.SCSIController import SCSIController class XendDevices: """ An ugly halfway point between the module local device name @@ -43,6 +44,7 @@ class XendDevices: ''tap'': BlktapController, ''vfb'': vfbif.VfbifController, ''vkbd'': vfbif.VkbdifController, + ''scsi'': SCSIController, } #@classmethod diff -r 6061275e566f -r c8417a9bd13c tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Wed Jan 03 01:36:42 2007 +0900 +++ b/tools/python/xen/xm/create.py Wed Jan 03 01:37:43 2007 +0900 @@ -534,6 +534,8 @@ def configure_disks(config_devs, vals): for (uname, dev, mode, backend) in vals.disk: if uname.startswith(''tap:''): cls = ''tap'' + elif uname.startswith(''scsi:''): + cls = ''scsi'' else: cls = ''vbd'' diff -r 6061275e566f -r c8417a9bd13c tools/examples/scsi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/examples/scsi Wed Jan 03 01:37:43 2007 +0900 @@ -0,0 +1,24 @@ +#!/bin/sh + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +log debug "udev event." + +case "$command" in + add) + done=$(xenstore_read_default "$XENBUS_PATH/scsi" ''MISSING'') + if [ "$done" != ''MISSING'' ] + then + exit 0 + fi + + xenstore_write "$XENBUS_PATH/scsi" "info" + success + ;; + remove) + # TODO + ;; +esac + +exit 0 diff -r 6061275e566f -r c8417a9bd13c tools/python/xen/xend/server/SCSIController.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/python/xen/xend/server/SCSIController.py Wed Jan 03 01:37:43 2007 +0900 @@ -0,0 +1,14 @@ +# Copyright (c) 2005, XenSource Ltd. + + +from xen.xend.server.blkif import BlkifController + + +class SCSIController(BlkifController): + def __init__(self, vm): + BlkifController.__init__(self, vm) + + def frontendRoot(self): + """@see DevController#frontendRoot""" + + return "%s/device/scsi" % self.vm.getDomainPath() _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel