Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some parsing issues with nvme values #63

Merged
merged 2 commits into from
Mar 24, 2023
Merged

Fix some parsing issues with nvme values #63

merged 2 commits into from
Mar 24, 2023

Conversation

rhoriguchi
Copy link
Contributor

> glances
Traceback (most recent call last):
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/bin/..glances-wrapped-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/__init__.py", line 179, in main
    start(config=core.get_config(), args=core.get_args())
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/__init__.py", line 108, in start
    mode = GlancesMode(config=config, args=args)
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/standalone.py", line 72, in __init__
    self.stats.update()
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/stats.py", line 216, in update
    self._plugins[p].update()
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/plugins/glances_plugin.py", line 1114, in wrapper
    ret = fct(self, *args, **kw)
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/plugins/glances_plugin.py", line 1131, in wrapper
    ret = fct(*args, **kw)
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/plugins/glances_smart.py", line 151, in update
    stats = get_smart_data()
  File "/nix/store/irv4jls0zafjnrfh6n4hz90mix1sdpxz-glances-3.3.1/lib/python3.10/site-packages/glances/plugins/glances_smart.py", line 89, in get_smart_data
    devlist = DeviceList()
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/device_list.py", line 64, in __init__
    self.initialize(catch_errors)
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/device_list.py", line 134, in initialize
    raise e
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/device_list.py", line 123, in initialize
    Device(name, interface=interface, smartctl=self.smartctl))
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/device.py", line 295, in __init__
    self.update()
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/device.py", line 959, in update
    self.if_attributes = NvmeAttributes(iter(_stdout))
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/interface/nvme.py", line 483, in __init__
    self.parse(data)
  File "/nix/store/m1i6plrq14jd6qka5qwrw864hhak2s1b-python3.10-pysmart-1.2.3/lib/python3.10/site-packages/pySMART/interface/nvme.py", line 526, in parse
    self.dataUnitsRead = int(
ValueError: invalid literal for int() with base 10: '24’376’437'

@ralequi ralequi self-assigned this Mar 21, 2023
Copy link
Collaborator

@ralequi ralequi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some output (or directly a test) that requires your changes?

Just to take them into account in the future versions and prevent your change to be accidentally deleted

@ralequi ralequi added the bug label Mar 21, 2023
@ralequi ralequi changed the base branch from master to develop March 21, 2023 16:40
@rhoriguchi
Copy link
Contributor Author

rhoriguchi commented Mar 23, 2023

What am I doing wrong, my test file is not detected? @ralequi

___ TestListDevice.test_list_devices[./tests/dataset/listingtests/linux_01] ____

self = <tests.test_device_list.TestListDevice object at 0x7ffff68d0b80>
folder = './tests/dataset/listingtests/linux_01'

    @pytest.mark.parametrize("folder", folders)
    def test_list_devices(self, folder):

        data = self.get_device_data(folder)

        device_data: DeviceList = self.create_list_device(folder, data)

        # Check that the number of devices is correct
>       assert len(device_data.devices) == data['count']
E       assert 1 == 2
E        +  where 1 = len([<NVME device on /dev/nvme0 mod:KBG30ZMV256G TOSHIBA sn:XXXXXXXXXXXX>])
E        +    where [<NVME device on /dev/nvme0 mod:KBG30ZMV256G TOSHIBA sn:XXXXXXXXXXXX>] = <DeviceList contents:\n<NVME device on /dev/nvme0 mod:KBG30ZMV256G TOSHIBA sn:XXXXXXXXXXXX>\n>.devices

tests/test_device_list.py:63: AssertionError

@ralequi
Copy link
Collaborator

ralequi commented Mar 24, 2023

Let me check

@ralequi ralequi merged commit aebb2b5 into truenas:develop Mar 24, 2023
@ralequi
Copy link
Collaborator

ralequi commented Mar 24, 2023

Thank you @rhoriguchi !

@rhoriguchi
Copy link
Contributor Author

@ralequi thank you for cleaning up my failing test.

@rhoriguchi rhoriguchi deleted the nvme branch March 24, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants