Author: gnichols
Date: 2012-01-20 17:49:19 +0000 (Fri, 20 Jan 2012)
New Revision: 1158
Modified:
trunk/tests/storage/storage.py
Log:
Bug 782197 - FEAT: v7 should support dbus udisks in place of hal/kudzu/hardware.py for
storage test
Modified: trunk/tests/storage/storage.py
===================================================================
--- trunk/tests/storage/storage.py 2012-01-20 17:47:55 UTC (rev 1157)
+++ trunk/tests/storage/storage.py 2012-01-20 17:49:19 UTC (rev 1158)
@@ -25,6 +25,7 @@
from v7.test import Test, TestTag
from v7.command import Command, V7CommandException
from v7.tags import DeviceClass
+from v7.dbusDevice import UDisksDrive
class StorageTest(Test):
@@ -46,52 +47,78 @@
tests = dict()
controllers = ''
for device in devices:
- disk = None
- # via HAL
- if 'storage' in device.getProperty("info.capabilities") and
device.getProperty("storage.drive_type") in ["disk",
"sd_mmc"]:
- disk = device.getProperty("block.device")
- # bug#437866 , plan by each controller, block device's parent is the
HD, HD's parent is the controller, so need to track back twice
- # what's the HD's ID ?
- blockDeviceParent = device.getProperty("info.parent")
- # and what's the HD's parent's ID ?
- controllerId = 'none'
- for deviceItem in devices:
- if blockDeviceParent in
deviceItem.getProperty("info.udi"):
- # then the contoller's ID is found
- controllerId = deviceItem.getProperty("info.parent")
- continue
- if controllerId in controllers:
- print "the controller %s is already in testplan, will skip the
block device %s" % (controllerId, disk)
- disk = ''
- else:
- # add the controller to the plan and record it
- controllers = controllers + ', ' + controllerId
- # chop off /dev/ (5 characters)
- if disk and len(disk) > 5:
- disk = disk[5:]
- # handle cciss devices
- elif device.getProperty("info.linux.driver") == "cciss":
- sysfsPath = device.getProperty("pci.linux.sysfs_path")
- # grep for the block device name, if one cciss controller has
- # multiple "drives" attached, we pick only one(the first one)
to test
- storageDevice = commands.getoutput("ls %s | grep block | head -n 1 |
colrm 1 12" % sysfsPath)
- disk = 'cciss/' + storageDevice
+ disk = self.planUDisks(device, devices)
+
+ if not disk:
+ disk = self.planHAL(device, devices)
+
+ if not disk:
+ disk = self.planKudzu(device)
- # via Kudzu
- elif "HD" in device.getPropertyString("class"):
- if "SERVERAID" in device.getProperty("desc"):
- disk = device.getProperty("device")
- elif "cciss" in device.getProperty("device"):
- disk = device.getProperty("device") # the value should be
something like 'cciss/c0d0' etc.
- else:
- disk = device.getProperty("device")
-
+
if disk and not disk in tests:
test = self.makeCopy()
test.setDevice(device)
test.setLogicalDeviceName(disk)
tests[disk] = test
return tests.values()
+
+ def planUDisks(self, device, devices):
+ disk = None
+ if isinstance(device, UDisksDrive):
+ if device.getProperty("DeviceIsPartitionTable"):
+ disk = device.getProperty("DeviceFile")
+ print "found device file " + disk
+ # get rid of the "/dev/"
+ if '/'in disk:
+ disk = disk.split('/')[-1]
+ return disk
+
+ def planHAL(self, device, devices):
+ disk = None
+ if 'storage' in device.getProperty("info.capabilities") and
device.getProperty("storage.drive_type") in ["disk",
"sd_mmc"]:
+ disk = device.getProperty("block.device")
+ # bug#437866 , plan by each controller, block device's parent is the HD,
HD's parent is the controller, so need to track back twice
+ # what's the HD's ID ?
+ blockDeviceParent = device.getProperty("info.parent")
+ # and what's the HD's parent's ID ?
+ controllerId = 'none'
+ for deviceItem in devices:
+ if blockDeviceParent in deviceItem.getProperty("info.udi"):
+ # then the contoller's ID is found
+ controllerId = deviceItem.getProperty("info.parent")
+ continue
+ if controllerId in controllers:
+ print "the controller %s is already in testplan, will skip the block
device %s" % (controllerId, disk)
+ disk = ''
+ else:
+ # add the controller to the plan and record it
+ controllers = controllers + ', ' + controllerId
+ # chop off /dev/ (5 characters)
+ if disk and len(disk) > 5:
+ disk = disk[5:]
+ # handle cciss devices
+ elif device.getProperty("info.linux.driver") == "cciss":
+ sysfsPath = device.getProperty("pci.linux.sysfs_path")
+ # grep for the block device name, if one cciss controller has
+ # multiple "drives" attached, we pick only one(the first one) to
test
+ storageDevice = commands.getoutput("ls %s | grep block | head -n 1 |
colrm 1 12" % sysfsPath)
+ disk = 'cciss/' + storageDevice
+
+ return disk
+
+ def planKudzu(self, device):
+ disk = None
+ if "HD" in device.getPropertyString("class"):
+ if "SERVERAID" in device.getProperty("desc"):
+ disk = device.getProperty("device")
+ elif "cciss" in device.getProperty("device"):
+ disk = device.getProperty("device") # the value should be
something like 'cciss/c0d0' etc.
+ else:
+ disk = device.getProperty("device")
+
+ return disk
+
def doDt(self, minBs, maxBs, size, options):
"""Helper function: run dt with various block sizes and reasonable
defaults."""
Show replies by date