nodedev: Fold SCSIDevice into NodeDevice

This commit is contained in:
Cole Robinson 2019-06-05 15:46:26 -04:00
parent cf3bc3eb3b
commit eeb7babef7
2 changed files with 12 additions and 16 deletions

View File

@ -112,6 +112,13 @@ class TestNodeDev(unittest.TestCase):
dev = self._nodeDevFromName(devname)
self.assertTrue(dev.is_usb_linux_root_hub())
def testSCSIDevice(self):
devname = "pci_8086_2829_scsi_host_scsi_device_lun0"
dev = self._nodeDevFromName(devname)
self.assertEqual(dev.host, "0")
self.assertEqual(dev.bus, "0")
self.assertEqual(dev.target, "0")
def testStorageDevice1(self):
devname = "storage_serial_SATA_WDC_WD1600AAJS__WD_WCAP95119685"
vals = {"name": "storage_serial_SATA_WDC_WD1600AAJS__WD_WCAP95119685",
@ -154,14 +161,6 @@ class TestNodeDev(unittest.TestCase):
"wwnn": "20000000c9848141", "wwpn": "10000000c9848141"}
self._testCompare(devname, vals)
def testSCSIDevice(self):
devname = "pci_8086_2829_scsi_host_scsi_device_lun0"
vals = {"name": "pci_8086_2829_scsi_host_scsi_device_lun0",
"parent": "pci_8086_2829_scsi_host",
"host": "0", "bus": "0", "target": "0", "lun": "0",
"type": "disk"}
self._testCompare(devname, vals)
def testDRMDevice(self):
devname = "drm_renderD129"
vals = {"name": "drm_renderD129",

View File

@ -220,6 +220,11 @@ class NodeDevice(XMLBuilder):
product_id = XMLProperty("./capability/product/@id")
vendor_id = XMLProperty("./capability/vendor/@id")
# type='scsi' options
host = XMLProperty("./capability/host")
target = XMLProperty("./capability/target")
lun = XMLProperty("./capability/lun")
class StorageDevice(NodeDevice):
block = XMLProperty("./capability/block")
@ -265,12 +270,6 @@ class StorageDevice(NodeDevice):
return desc
class SCSIDevice(NodeDevice):
host = XMLProperty("./capability/host")
bus = XMLProperty("./capability/bus")
target = XMLProperty("./capability/target")
lun = XMLProperty("./capability/lun")
type = XMLProperty("./capability/type")
class SCSIBus(NodeDevice):
@ -364,8 +363,6 @@ def _typeToDeviceClass(t):
return StorageDevice
elif t == NodeDevice.CAPABILITY_TYPE_SCSIBUS:
return SCSIBus
elif t == NodeDevice.CAPABILITY_TYPE_SCSIDEV:
return SCSIDevice
elif t == NodeDevice.CAPABILITY_TYPE_DRM:
return DRMDevice
else: