Martin Polednik has uploaded a new change for review. Change subject: hostdev: report storage model as product ......................................................................
hostdev: report storage model as product Change-Id: I8258988363faa00a9a32aa637dbed06ab82da55f Signed-off-by: Martin Polednik <[email protected]> --- M lib/vdsm/hostdev.py M tests/devices/data/Makefile.am A tests/devices/data/block_sda_ssd.xml M tests/hostdevTests.py 4 files changed, 34 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/56123/1 diff --git a/lib/vdsm/hostdev.py b/lib/vdsm/hostdev.py index 004b9b8..3bc033a 100644 --- a/lib/vdsm/hostdev.py +++ b/lib/vdsm/hostdev.py @@ -123,6 +123,15 @@ return _parse_address(caps, ('bus', 'device')) +def _process_storage(caps): + try: + model = caps.find('model').text + except AttributeError: + return {} + else: + return {'product': model} + + def _parse_device_params(device_xml): """ Process device_xml and return dict of found known parameters, @@ -158,6 +167,9 @@ if elementXML.text: params[element] = elementXML.text + if params['capability'] == 'storage': + params.update(_process_storage(caps)) + physfn = caps.find('capability') if physfn is not None and physfn.attrib['type'] == 'phys_function' \ and params['capability'] == 'pci': diff --git a/tests/devices/data/Makefile.am b/tests/devices/data/Makefile.am index f0136a8..4c77b5b 100644 --- a/tests/devices/data/Makefile.am +++ b/tests/devices/data/Makefile.am @@ -21,6 +21,7 @@ vdsmdevdatatestsdir = ${vdsmtestsdir}/devices/data dist_vdsmdevdatatests_DATA = \ + block_sda_ssd.xml \ computer.xml \ net_em1_28_d2_44_55_66_88.xml \ pci_0000_00_02_0.xml \ diff --git a/tests/devices/data/block_sda_ssd.xml b/tests/devices/data/block_sda_ssd.xml new file mode 100644 index 0000000..168ae53 --- /dev/null +++ b/tests/devices/data/block_sda_ssd.xml @@ -0,0 +1,16 @@ +<device> + <name>block_sda_ssd</name> + <path>/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sdb</path> + <parent>scsi_0_0_0_0</parent> + <capability type='storage'> + <block>/dev/sda</block> + <bus>ata</bus> + <drive_type>disk</drive_type> + <model>SSD</model> + <vendor>ATA</vendor> + <serial>1234</serial> + <size>1</size> + <logical_block_size>1</logical_block_size> + <num_blocks>1</num_blocks> + </capability> +</device> diff --git a/tests/hostdevTests.py b/tests/hostdevTests.py index b7fc4d3..8226b92 100644 --- a/tests/hostdevTests.py +++ b/tests/hostdevTests.py @@ -34,7 +34,8 @@ _PCI_DEVICES = ['pci_0000_00_1a_0', 'pci_0000_00_1f_2', 'pci_0000_00_02_0', 'pci_0000_00_19_0', 'pci_0000_00_1b_0'] _USB_DEVICES = ['usb_usb1', 'usb_1_1', 'usb_1_1_4'] -_SCSI_DEVICES = ['scsi_host0', 'scsi_target0_0_0', 'scsi_0_0_0_0'] +_SCSI_DEVICES = ['scsi_host0', 'scsi_target0_0_0', 'scsi_0_0_0_0', + 'block_sda_ssd'] _SRIOV_PF = 'pci_0000_05_00_1' _SRIOV_VF = 'pci_0000_05_10_7' _ADDITIONAL_DEVICE = 'pci_0000_00_09_0' @@ -176,6 +177,9 @@ 'function': '2'}}, u'scsi_target0_0_0': {'capability': 'scsi_target', 'parent': 'scsi_host0'}, + u'block_sda_ssd': {'capability': 'storage', 'product': 'SSD', + 'parent': 'scsi_0_0_0_0', + 'vendor': 'ATA'}, u'pci_0000_00_02_0': {'product': '2nd Generation Core ' 'Processor Family Integrated ' 'Graphics Controller', -- To view, visit https://gerrit.ovirt.org/56123 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8258988363faa00a9a32aa637dbed06ab82da55f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
