Bug 1729282

Summary: Beaker-system-scan inventories disks twice for witherspoon power9 systems. 8335-GTH (ibm,witherspoon) 8335-GTC (ibm,witherspoon)
Product: [Retired] Beaker Reporter: sdoherty
Component: inventoryAssignee: beaker-dev-list
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: developCC: bpeck, cbouchar, jbastian, mastyk, pbunyan, sdoherty, tklohna
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-26 12:08:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description sdoherty 2019-07-11 18:36:54 UTC
Description of problem:
Beaker details of the number of disks and total size of storage are incorrect for 
IBM ppcle models  8335-GTC (ibm,witherspoon)  8335-GTH (ibm,witherspoon) 
Version-Release number of selected component (if applicable):


How reproducible:
faithfully.


Steps to Reproduce:
1. /distribution/inventory beaker-system-scan

Actual results:
Disks are listed twice in details page. 
example: 
https://beaker.engineering.redhat.com/view/ibm-p9wr-02.pnr.lab.eng.bos.redhat.com#details
Disks
Model 	Size 	Logical sector size 	Physical sector size
ST2000NX0253 	2000.40 GB / 1863.02 GiB 	512 bytes 	4096 bytes
	2000.40 GB / 1863.02 GiB 	512 bytes 	512 bytes
ST2000NX0253 	2000.40 GB / 1863.02 GiB 	512 bytes 	4096 bytes
	2000.40 GB / 1863.02 GiB 	512 bytes 	512 bytes 


Expected results:
Disks to be listed correctly
example:https://beaker.engineering.redhat.com/view/ibm-p9b-04.pnr.lab.eng.bos.redhat.com#details
Disks
Model 	Size 	Logical sector size 	Physical sector size
ST2000NM0045 	2000.40 GB / 1863.02 GiB 	512 bytes 	512 bytes
ST2000NM0045 	2000.40 GB / 1863.02 GiB 	512 bytes 	512 bytes 



Additional info:
lshw -xml appears to be a child node class="disk" under each parent node that is populating the disklist array. 

from beaker-system-scan XML is parsed by nodes with a class of "disk"

    disklist = []
    for disk in inventory.xpath('.//node[@class="disk"]'):

On a Witherspoon with multiple disks there is a child node of id="medium" under the parent id="disk:#" node both with class="disk" with the same size assignment. 

Example output of ibm-p9wr-02# lshw -class disk -xml:

 <node id="disk:0" claimed="true" class="disk" handle="SCSI:00:00:00:00">
   <description>ATA Disk</description>
   <product>ST2000NX0253</product>
   <physid>0</physid>
   <businfo>scsi@0:0.0.0</businfo>
   <logicalname>/dev/sda</logicalname>
   <dev>8:0</dev>
   <version>BE35</version>
   <serial>W460J0D3</serial>
   <size units="bytes">2000398934016</size>
   <configuration>
    <setting id="ansiversion" value="5" />
    <setting id="logicalsectorsize" value="512" />
    <setting id="sectorsize" value="4096" />
   </configuration>
   <capabilities>
    <capability id="removable" >support is removable</capability>
   </capabilities>
   <hints>
    <hint name="icon" value="disc" />
   </hints>
    <node id="medium" claimed="true" class="disk">
     <physid>0</physid>
     <logicalname>/dev/sda</logicalname>
     <dev>8:0</dev>
     <size units="bytes">2000398934016</size>
     <configuration>
      <setting id="signature" value="a9e15407" />
     </configuration>
     <capabilities>
      <capability id="partitioned" >Partitioned disk</capability>
      <capability id="partitioned:dos" >MS-DOS partition table</capability>
     </capabilities>
    </node>
  </node>

Compared with the desireable output of ibm-p9b-04 #lshw -class disk -xml

<node id="disk:0" claimed="true" class="disk" handle="SCSI:00:02:00:00">
   <description>SCSI Disk</description>
   <product>ST2000NM0045</product>
   <vendor>SEAGATE</vendor>
   <physid>2.0.0</physid>
   <businfo>scsi@0:2.0.0</businfo>
   <logicalname>/dev/sda</logicalname>
   <dev>8:0</dev>
   <version>N003</version>
   <serial>ZC20J5DK0000R727HYTP</serial>
   <size units="bytes">2000398934016</size>
   <configuration>
    <setting id="ansiversion" value="6" />
    <setting id="logicalsectorsize" value="512" />
    <setting id="sectorsize" value="512" />
    <setting id="signature" value="f889ab6e" />
   </configuration>
   <capabilities>
    <capability id="7200rpm" >7200 rotations per minute</capability>
    <capability id="partitioned" >Partitioned disk</capability>
    <capability id="partitioned:dos" >MS-DOS partition table</capability>
   </capabilities>
   <hints>
    <hint name="bus.icon" value="scsi" />
    <hint name="icon" value="disc" />
   </hints>
  </node>

Comment 1 sdoherty 2019-07-11 18:50:35 UTC
All testing using RHEL-8.0.0 BaseOS ppc64le

https://beaker.engineering.redhat.com/jobs/3667063
https://beaker.engineering.redhat.com/jobs/3667457

Comment 2 Jeff Bastian 2019-07-25 17:12:53 UTC
This was reported a couple years ago against the Garrison POWER systems too.  See bug 1493491.

Comment 3 Jeff Bastian 2019-07-25 18:20:09 UTC
This patch fixes the issue.  Hopefully it doesn't break other systems!

[root@ibm-p9wr-07 ~]# diff -u /usr/lib/python3.6/site-packages/systemscan/main.py{.ORIG,}
--- /usr/lib/python3.6/site-packages/systemscan/main.py.ORIG	2019-07-25 14:15:23.038204006 -0400
+++ /usr/lib/python3.6/site-packages/systemscan/main.py	2019-07-25 14:16:58.644141206 -0400
@@ -451,7 +451,7 @@
 
 
     disklist = []
-    for disk in inventory.xpath('.//node[@class="disk"]'):
+    for disk in inventory.xpath('.//node[@class="disk" and @id!="medium"]'):
         diskinfo = {}
         if disk.find('size') is None:
             continue # probably an optical drive


::::::::::::
:: Before ::
::::::::::::

~]# beaker-system-scan -d
...
'Disk': {'Disks': [{'model': 'ST1000NX0313',
                    'phys_sector_size': 4096,
                    'sector_size': 512,
                    'size': '1000204886016'},
                   {'model': None,
                    'phys_sector_size': 512,
                    'sector_size': 512,
                    'size': '1000204886016'},
                   {'model': 'ST1000NX0313',
                    'phys_sector_size': 4096,
                    'sector_size': 512,
                    'size': '1000204886016'},
                   {'model': None,
                    'phys_sector_size': 512,
                    'sector_size': 512,
                    'size': '1000204886016'}]},
...

:::::::::::
:: After ::
:::::::::::

~]# beaker-system-scan -d
...
'Disk': {'Disks': [{'model': 'ST1000NX0313',
                    'phys_sector_size': 4096,
                    'sector_size': 512,
                    'size': '1000204886016'},
                   {'model': 'ST1000NX0313',
                    'phys_sector_size': 4096,
                    'sector_size': 512,
                    'size': '1000204886016'}]},
...

Comment 4 Jeff Bastian 2019-07-25 18:44:17 UTC
Patch submitted to Gerrit for review:
https://gerrit.beaker-project.org/6620