Skip to contentSkip to conversation

pvSCSI : xend

PATCH In review Jun Kamada 1 participant 2 messages Jul 3, 2008

lore
Share & tools
lore

Jun Kamada

author
#0 lore raw

PATCH 3/4 pvSCSI : xend

"xend" which is needed to use the pvSCSI driver.

-----
Jun Kamada

pvscsi: Fix attach, detach

tools/examples/vscsi new file +22 -0
diff -r 3d5f28d6e777 tools/examples/vscsi
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2007, FUJITSU Limited
+# Based on the block scripts code.
+#
+
+dir=$(dirname "$0")
+. "$dir/xen-hotplug-common.sh"
+
+findCommand "$@"
+
+case "$command" in
+	add)
+		success
+		;;
+	remove)
+		# TODO
+		exit 0
+		;;
+esac
+
+exit 0
tools/examples/xen-backend.agent +3 -0
diff -r 3d5f28d6e777 tools/examples/xen-backend.agent
@@ -19,6 +19,9 @@ case "$XENBUS_TYPE" in
   vif)
     [ -n "$script" ] && $script "$ACTION"
     ;;
+  vscsi)
+    /etc/xen/scripts/vscsi "$ACTION"
+    ;;
 esac
 
 case "$ACTION" in
tools/examples/xen-backend.rules +1 -0
diff -r 3d5f28d6e777 tools/examples/xen-backend.rules
@@ -3,6 +3,7 @@ SUBSYSTEM=="xen-backend", KERNEL=="vtpm*
 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"
+SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}"
 SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
 KERNEL=="evtchn", NAME="xen/%k"
 KERNEL=="blktap[0-9]*", NAME="xen/%k"
tools/examples/xmexample.hvm +23 -0
diff -r 3d5f28d6e777 tools/examples/xmexample.hvm
@@ -282,3 +282,26 @@ serial='pty'
 #  '0' -> the bit must be '0'
 #  'x' -> we don't care (do not check)
 #  's' -> the bit must be the same as on the host that started this VM
+
+
+#-----------------------------------------------------------------------------
+#   Configure PVSCSI devices:
+#
+#vscsi=[ 'PDEV, VDEV' ]
+#
+#   PDEV   gives physical SCSI device to be attached to specified guest
+#          domain by one of the following identifier format.
+#          - XX:XX:XX:XX (4-tuples with decimal notation which shows
+#                          "host:channel:target:lun")
+#          - /dev/sdxx or sdx
+#          - /dev/stxx or stx
+#          - /dev/sgxx or sgx
+#          - result of 'scsi_id -gu -s'.
+#            ex. # scsi_id -gu -s /block/sdb
+#                  36000b5d0006a0000006a0257004c0000
+#
+#   VDEV   gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as 
+#          which the specified guest domain recognize.
+#
+
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
tools/examples/xmexample.vti +22 -0
diff -r 3d5f28d6e777 tools/examples/xmexample.vti
@@ -161,3 +161,25 @@ serial='pty'
 #    'windows' - All Windows variants (Windows Server 2003/2008)
 #
 #guest_os_type='default'
+
+#-----------------------------------------------------------------------------
+#   Configure PVSCSI devices:
+#
+#vscsi=[ 'PDEV, VDEV' ]
+#
+#   PDEV   gives physical SCSI device to be attached to specified guest
+#          domain by one of the following identifier format.
+#          - XX:XX:XX:XX (4-tuples with decimal notation which shows
+#                          "host:channel:target:lun")
+#          - /dev/sdxx or sdx
+#          - /dev/stxx or stx
+#          - /dev/sgxx or sgx
+#          - result of 'scsi_id -gu -s'.
+#            ex. # scsi_id -gu -s /block/sdb
+#                  36000b5d0006a0000006a0257004c0000
+#
+#   VDEV   gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as 
+#          which the specified guest domain recognize.
+#
+
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
tools/examples/xmexample1 +24 -1
diff -r 3d5f28d6e777 tools/examples/xmexample1
@@ -185,4 +185,27 @@ extra = "4"
 #on_reboot   = 'restart'
 #on_crash    = 'restart'
 
-#============================================================================
+#-----------------------------------------------------------------------------
+#   Configure PVSCSI devices:
+#
+#vscsi=[ 'PDEV, VDEV' ]
+#
+#   PDEV   gives physical SCSI device to be attached to specified guest
+#          domain by one of the following identifier format.
+#          - XX:XX:XX:XX (4-tuples with decimal notation which shows
+#                          "host:channel:target:lun")
+#          - /dev/sdxx or sdx
+#          - /dev/stxx or stx
+#          - /dev/sgxx or sgx
+#          - result of 'scsi_id -gu -s'.
+#            ex. # scsi_id -gu -s /block/sdb
+#                  36000b5d0006a0000006a0257004c0000
+#
+#   VDEV   gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as 
+#          which the specified guest domain recognize.
+#
+
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
+
+#============================================================================
+
tools/examples/xmexample2 +23 -1
diff -r 3d5f28d6e777 tools/examples/xmexample2
@@ -221,4 +221,26 @@ extra = "4 VMID=%d usr=/dev/sda6" % vmid
 #on_reboot   = 'restart'
 #on_crash    = 'restart'
 
-#============================================================================
+#-----------------------------------------------------------------------------
+#   Configure PVSCSI devices:
+#
+#vscsi=[ 'PDEV, VDEV' ]
+#
+#   PDEV   gives physical SCSI device to be attached to specified guest
+#          domain by one of the following identifier format.
+#          - XX:XX:XX:XX (4-tuples with decimal notation which shows
+#                          "host:channel:target:lun")
+#          - /dev/sdxx or sdx
+#          - /dev/stxx or stx
+#          - /dev/sgxx or sgx
+#          - result of 'scsi_id -gu -s'.
+#            ex. # scsi_id -gu -s /block/sdb
+#                  36000b5d0006a0000006a0257004c0000
+#
+#   VDEV   gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as 
+#          which the specified guest domain recognize.
+#
+
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
+
+#============================================================================
tools/python/xen/util/vscsi_util.py new file +133 -0

133 lines not on this page · raw message

tools/python/xen/xend/XendConfig.py +7 -4
diff -r 3d5f28d6e777 tools/python/xen/xend/XendConfig.py
@@ -1227,7 +1227,7 @@ class XendConfig(dict):
             #
             # [device, [pci, [domain, 0], [bus, 0], [dev, 1], [func, 2]]]
 
-            if dev_type == 'pci':
+            if dev_type == 'pci' or dev_type == 'vscsi':
                 pci_devs_uuid = sxp.child_value(config, 'uuid',
                                                 uuid.createString())
                 pci_devs = []
@@ -1555,7 +1555,7 @@ class XendConfig(dict):
 
             dev_type, dev_info = self['devices'][dev_uuid]
 
-            if dev_type == 'pci': # Special case for pci
+            if dev_type == 'pci' or dev_type == 'vscsi': # Special case for pci
                 pci_devs = []
                 for pci_dev in sxp.children(config, 'dev'):
                     pci_dev_info = {}
@@ -1656,8 +1656,11 @@ class XendConfig(dict):
         ordered_refs = self.ordered_device_refs(target = target)
         for dev_uuid in ordered_refs:
             dev_type, dev_info = target['devices'][dev_uuid]
-            if dev_type == 'pci': # special case for pci devices
-                sxpr = ['pci', ['uuid', dev_info['uuid']]]
+            if dev_type == 'pci' or dev_type == 'vscsi': # special case for pci devices
+                if dev_type == 'pci':
+                    sxpr = ['pci', ['uuid', dev_info['uuid']]]
+                elif dev_type == 'vscsi':
+                    sxpr = ['vscsi', ['uuid', dev_info['uuid']]]
                 for pci_dev_info in dev_info['devs']:
                     pci_dev_sxpr = ['dev']
                     for opt, val in pci_dev_info.items():
tools/python/xen/xend/XendDevices.py +2 -1
diff -r 3d5f28d6e777 tools/python/xen/xend/XendDevices.py
@@ -19,7 +19,7 @@
 # A collection of DevControllers 
 #
 
-from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, vfbif
+from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, vfbif, vscsiif
 from xen.xend.server.BlktapController import BlktapController
 from xen.xend.server.ConsoleController import ConsoleController
 
@@ -45,6 +45,7 @@ class XendDevices:
         'vfb': vfbif.VfbifController,
         'vkbd': vfbif.VkbdifController,
         'console': ConsoleController,
+        'vscsi': vscsiif.VSCSIController,
     }
 
     #@classmethod
tools/python/xen/xend/XendDomainInfo.py +92 -1

126 lines not on this page · raw message

tools/python/xen/xend/server/vscsiif.py new file +228 -0

228 lines not on this page · raw message

tools/python/xen/xm/create.py +94 -0

130 lines not on this page · raw message

tools/python/xen/xm/main.py +101 -0

143 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#1 lore raw

Hi,

Sorry, I forgot to show usage of the "xend". I will describe it below.

1.) Configuration FIle
#-----------------------------------------------------------------------------
# Configure PVSCSI devices:
#
#vscsi=[ 'PDEV, VDEV' ]
#

#   PDEV   gives physical SCSI device to be attached to specified guest
#          domain by one of the following identifier format.
#          - XX:XX:XX:XX (4-tuples with decimal notation which shows
#                          "host:channel:target:lun")
#          - /dev/sdxx or sdx
#          - /dev/stxx or stx
#          - /dev/sgxx or sgx
#          - result of 'scsi_id -gu -s'.

# ex. # scsi_id -gu -s /block/sdb
# 36000b5d0006a0000006a0257004c0000
#
# VDEV gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as
# which the specified guest domain recognize.
#

#vscsi = [ '/dev/sdx, 0:0:0:0' ]

2.) Command
'scsi-attach' : ('<Domain> <PhysDevice> <VirtDevice> [BackDomain]',
'Attach a new SCSI device.'),
'scsi-detach' : ('<Domain> <VirtDevice>',
'Detach a specified SCSI device.'),
'scsi-list' : ('<Domain> [--long]',
'List all SCSI devices currently attached.'),

-----
Jun Kamada