Bug 1724832 - Introspection fails with ValueError: too many values to unpack
Summary: Introspection fails with ValueError: too many values to unpack
Keywords:
Status: CLOSED EOL
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-hardware
Version: 14.0 (Rocky)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Riccardo Pittau
QA Contact: mlammon
URL:
Whiteboard:
Depends On:
Blocks: 1757755
TreeView+ depends on / blocked
 
Reported: 2019-06-27 21:53 UTC by Andreas Karis
Modified: 2020-01-14 20:18 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1757755 (view as bug list)
Environment:
Last Closed: 2020-01-14 20:18:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-cip hardware pull 109 0 'None' closed Rename FakeAMD back to AuthenticAMD 2020-04-22 11:34:27 UTC
Github redhat-cip hardware pull 93 0 'None' closed Split lscpu output on first colon occurrence only 2020-04-22 11:34:27 UTC

Description Andreas Karis 2019-06-27 21:53:52 UTC
Description of problem:
Introspection fails with ValueError: too many values to unpack --
~~~
Traceback (most recent call last):
  File "/usr/bin/hardware-detect", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 997, in main
    _main(options)
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 924, in _main
    if not detect_system(hrdw):
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 666, in detect_system
    get_cpus(hw_lst)
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 699, in get_cpus
    item, value = line.split(\':\')
ValueError: too many values to unpack
~~~

Version-Release number of selected component (if applicable):
likely python-hardware-detect-0.18.1-0.20190301121902.b417976.el7ost.noarch.rpm

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

~~~
(...)
2019-06-25 10:00:41.373 1 ERROR ironic_inspector.utils [req-a7e27f27-a007-4e01-bc34-be4737550fa2 - - - - -] [node: MAC ... BMC 10.227.9.93] The following failures happened during running pre-processing hooks:
Preprocessing hook ramdisk_error: Ramdisk reported error: The following errors were encountered:
* failed to run hardware-detect utility: Unexpected error while running command.
Command: hardware-detect
Exit code: 1
Stdout: u''
Stderr: u'/bin/sh: cli64: command not found\nInfo: detect_areca: No controller found\nCannot find megacli on the system\nread_smart: Reading S.M.A.R.T information on /dev/sda\nread_smart_ata: Found S.M.A.R.T information on /dev/sda\nread_smart: Reading S.M.A.R.T information on /dev/sdb\nread_smart_ata: Found S.M.A.R.T information on /dev/sdb\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nTraceback (most recent call last):\n  File "/usr/bin/hardware-detect", line 10, in <module>\n    sys.exit(main())\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 997, in main\n    _main(options)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 924, in _main\n    if not detect_system(hrdw):\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 666, in detect_system\n    get_cpus(hw_lst)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 699, in get_cpus\n    item, value = line.split(\':\')\nValueError: too many values to unpack\n'
Node not found hook failed: Node 9c1c82ef-8e92-4ac0-9745-2974605a51cb already has BMC address 10.227.9.93, not enrolling
2019-06-25 10:00:41.374 1 DEBUG ironic_inspector.main [req-a7e27f27-a007-4e01-bc34-be4737550fa2 - - - - -] Returning error to client: The following failures happened during running pre-processing hooks:
Preprocessing hook ramdisk_error: Ramdisk reported error: The following errors were encountered:
* failed to run hardware-detect utility: Unexpected error while running command.
Command: hardware-detect
Exit code: 1
Stdout: u''
Stderr: u'/bin/sh: cli64: command not found\nInfo: detect_areca: No controller found\nCannot find megacli on the system\nread_smart: Reading S.M.A.R.T information on /dev/sda\nread_smart_ata: Found S.M.A.R.T information on /dev/sda\nread_smart: Reading S.M.A.R.T information on /dev/sdb\nread_smart_ata: Found S.M.A.R.T information on /dev/sdb\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nTraceback (most recent call last):\n  File "/usr/bin/hardware-detect", line 10, in <module>\n    sys.exit(main())\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 997, in main\n    _main(options)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 924, in _main\n    if not detect_system(hrdw):\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 666, in detect_system\n    get_cpus(hw_lst)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 699, in get_cpus\n    item, value = line.split(\':\')\nValueError: too many values to unpack\n'
Node not found hook failed: Node 9c1c82ef-8e92-4ac0-9745-2974605a51cb already has BMC address 10.227.9.93, not enrolling error_response /usr/lib/python2.7/site-packages/ironic_inspector/main.py:69
2019-06-25 10:00:41.375 1 INFO werkzeug [req-a7e27f27-a007-4e01-bc34-be4737550fa2 - - - - -] 10.227.10.220 - - [25/Jun/2019 10:00:41] "POST /v1/continue HTTP/1.1" 400 -
(...)
~~~

~~~
[akaris@wks-akaris ~]$ cat<<'EOF' | sed 's/\\n/\n/g'
> /bin/sh: cli64: command not found\nInfo: detect_areca: No controller found\nCannot find megacli on the system\nread_smart: Reading S.M.A.R.T information on /dev/sda\nread_smart_ata: Found S.M.A.R.T information on /dev/sda\nread_smart: Reading S.M.A.R.T information on /dev/sdb\nread_smart_ata: Found S.M.A.R.T information on /dev/sdb\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nconnect: Connection refused\nFailed to connect to lldpad - clif_open: Invalid argument\nTraceback (most recent call last):\n  File "/usr/bin/hardware-detect", line 10, in <module>\n    sys.exit(main())\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 997, in main\n    _main(options)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 924, in _main\n    if not detect_system(hrdw):\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 666, in detect_system\n    get_cpus(hw_lst)\n  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 699, in get_cpus\n    item, value = line.split(\':\')\nValueError: too many values to unpack\n
> EOF
/bin/sh: cli64: command not found
Info: detect_areca: No controller found
Cannot find megacli on the system
read_smart: Reading S.M.A.R.T information on /dev/sda
read_smart_ata: Found S.M.A.R.T information on /dev/sda
read_smart: Reading S.M.A.R.T information on /dev/sdb
read_smart_ata: Found S.M.A.R.T information on /dev/sdb
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
connect: Connection refused
Failed to connect to lldpad - clif_open: Invalid argument
Traceback (most recent call last):
  File "/usr/bin/hardware-detect", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 997, in main
    _main(options)
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 924, in _main
    if not detect_system(hrdw):
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 666, in detect_system
    get_cpus(hw_lst)
  File "/usr/lib/python2.7/site-packages/hardware/detect.py", line 699, in get_cpus
    item, value = line.split(\':\')
ValueError: too many values to unpack
~~~

Just checking in the repositories:
~~~
[root@overcloud-controller-0 ~]# yum provides '*hardware/detect.py'
Loaded plugins: product-id, search-disabled-repos, subscription-manager
python-hardware-detect-0.18.1-0.20180219184858.f649210.el7ost.noarch : Hardware detection and classification utilities
Repo        : rhel-7-server-openstack-13-rpms
Matched from:
Filename    : /usr/lib/python2.7/site-packages/hardware/detect.py

python-hardware-detect-0.18.1-0.20180516112600.eb66b8c.el7ost.noarch : Hardware detection and classification utilities
Repo        : rhel-7-server-openstack-13-rpms
Matched from:
Filename    : /usr/lib/python2.7/site-packages/hardware/detect.py
~~~

Upstream: https://github.com/redhat-cip/hardware/blob/master/hardware/detect.py

And this must be here more or less: https://github.com/redhat-cip/hardware/blob/master/hardware/detect.py#L668

Looking at the OSP 14 RPM:
https://access.redhat.com/downloads/content/python-hardware-detect/0.18.1-0.20190301121902.b417976.el7ost/noarch/fd431d51/package

Indeed, after extracting with: `rpm2cpio  python-hardware-detect-0.18.1-0.20190301121902.b417976.el7ost.noarch.rpm  | cpio -idmv`

/home/akaris/cases/02412118/usr/lib/python2.7/site-packages/hardware/detect.py
~~~
(...)
692 def get_cpus(hw_lst):
693     # Extracting lspcu information
694     lscpu = {}
695     output = detect_utils.output_lines('LANG=en_US.UTF-8 lscpu')
696 
697     for line in output:
698         if ':' in line:
699             item, value = line.split(':')               <---------------------------------- we fail here
700             lscpu[item.strip(':')] = value.strip()
701 
702     # Extracting lspcu -x information
703     lscpux = {}
704     output = detect_utils.output_lines('LANG=en_US.UTF-8 lscpu -x')
705 
706     for line in output:
707         if ':' in line:
708             item, value = line.split(':')
709             lscpux[item.strip(':')] = value.strip()
710 
711     hw_lst.append(("cpu", "physical", "number", int(lscpu["Socket(s)"])))
712     for processor in range(int(lscpu["Socket(s)"])):
713         boost = "/sys/devices/system/cpu/cpufreq/boost"
714         if os.path.exists(boost):
715             with open(boost) as boostfile:
716                 value = boostfile.readline().rstrip('\n')
717                 if value == "1":
718                     value = "enabled"
719                 else:
720                     value = "disabled"
721                 hw_lst.append(
722                     ('cpu', "physical_{}".format(processor), 'boost', value))
723 
724         hw_lst.append(('cpu', "physical_{}".format(
725             processor), 'vendor', lscpu['Vendor ID']))
726         hw_lst.append(('cpu', "physical_{}".format(
727             processor), 'product', lscpu['Model name']))
728         hw_lst.append(('cpu', "physical_{}".format(
729             processor), 'cores', int(lscpu['Core(s) per socket'])))
730         hw_lst.append(('cpu', "physical_{}".format(
731             processor), 'threads', int(lscpu['Thread(s) per core']) * int(lscpu['Core(s) per socket'])))
732         hw_lst.append(('cpu', "physical_{}".format(
(...)
~~~

Comment 1 Andreas Karis 2019-06-27 21:55:00 UTC
How can we best narrow down why this fails?

Comment 4 Bob Fournier 2019-07-19 12:33:06 UTC
Fix is in 0.21.1 - https://github.com/redhat-cip/hardware/releases

Comment 5 Bob Fournier 2019-09-25 15:53:59 UTC
Fix is in python-hardware release 0.21.1 - https://github.com/redhat-cip/hardware/releases.

We need to have a version built for osp-14.

Thierry - would it be possible to build python-hardware for OSP-14?

Comment 6 Andreas Karis 2019-11-05 16:20:25 UTC
Hi,

The customer just re-ran Ironic Inspector on the same system, one with production processors (no colon in name), one with pre-preproduction (with colon), and they get the error again.

Any ETA for this issue?

Thanks,

Andreas

Comment 7 Bob Fournier 2019-11-05 16:31:23 UTC
Andreas - the fix is available upstream but hasn't been pulled into an IPA zstream release yet, it will be in z5 along with other python-hardware fixes.

Comment 8 Andreas Karis 2019-11-05 16:36:20 UTC
Hi Bob, 

Great, thanks for that info!

- Andreas

Comment 10 Bob Fournier 2019-11-05 16:48:04 UTC
Andreas - it won't be in the z4 release next week as we need a new upstream release with the most recent python-hardware fixes.  It will be in the release after that.

Comment 13 Bob Fournier 2020-01-14 20:18:08 UTC
Closing this due to EOL, fix will be in OSP-13/15/16 etc.


Note You need to log in before you can comment on or make changes to this bug.