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

Implement core grains support for Linux ppc64le #60519

Merged
merged 3 commits into from
Aug 31, 2022

Conversation

lukasraska
Copy link
Contributor

@lukasraska lukasraska commented Jul 10, 2021

What does this PR do?

Implements support for core grains for Linux ppc64le architecture.

More specifically:

Side note - there seems to be DT uuid attribute, it's not in specs and I don't have any machine currently with this set, so uuid grain is ommited

The tests (especially the test_linux_devicetree_data) are still a little bit sketchy, so I will try to make them a bit better.

What issues does this PR fix or reference?

Related to #60518

Previous Behavior

cpu_model:  Unknown
virtual: physical

Grains that rely on dmidecode (productname, manufacturer, serialnumber) are missing completely

New Behavior

cpu_model: POWER9 (architected), altivec supported
virtual: LPAR
virtual_subtype: shared
manufacturer: IBM
serialnumber: IBM,123456789
productname: ABCDEF

Merge requirements satisfied?

Commits signed with GPG?

Yes

@lukasraska lukasraska force-pushed the linux-ppc64le-support branch from 264af20 to 65dbb04 Compare July 13, 2021 07:47
@lukasraska
Copy link
Contributor Author

As this PR adds support for reading arbitrary Device Tree data into grains, I've tested this on Raspberry PI as well (as ARM also has DT subsystem):

  • there is no vendor attribute and the model attribute doesn't conform to the suggested structure (vendor,product), so manufacturer grain can't be obtained easily (even lshw doesn't show any vendor, so no idea where it could be taken from)
  • there is no system-id attribute, but there is serial-number attribute, which presumably get's populated by bootloader and the it's sourced by Linux kernel (https://github.com/torvalds/linux/blob/master/arch/arm/kernel/setup.c#L961)

So following grains will get set for RPi devices:

productname: Raspberry Pi 4 Model B Rev 1.1
serialnumber: 100000000123456789

That will presumably work for all ARM devices / all devices that have Device Tree subsystem, I don't have any other I could test that on. I've tried to spawn AWS Graviton 2 instance, minion runs there fine (had to rebuild packages, it's aarch64), but it doesn't have DT, it rather has SMBIOS 🤷‍♂️

FYI @waynew

@lukasraska lukasraska force-pushed the linux-ppc64le-support branch from 65dbb04 to b6a1c1a Compare July 16, 2021 09:24
@lukasraska
Copy link
Contributor Author

FYI,
I've managed to get my hands on TYAN Habanero with Power8 CPU and on RHEL 7 it yields following new grains:

serialnumber: TCGQX04D0111
productname: TN71-BP012
cpu_model: POWER8 (raw), altivec supported

(it's very similar to RPi 4 - no vendor attribute or vendor information in model, but there is system-id attribute at least)

@lukasraska lukasraska force-pushed the linux-ppc64le-support branch from b6a1c1a to a93db95 Compare August 16, 2021 14:05
@lukasraska lukasraska marked this pull request as ready for review August 16, 2021 16:11
@lukasraska lukasraska requested a review from a team as a code owner August 16, 2021 16:11
@lukasraska lukasraska requested review from dhiltonp and removed request for a team August 16, 2021 16:11
@lukasraska
Copy link
Contributor Author

FYI, this is how this MR looks like for QEMU virtualized ppc64el Ubuntu:

Salt Version:
          Salt: 3003.2
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.2
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.9.7
        pygit2: Not Installed
        Python: 3.9.5 (default, May 11 2021, 08:20:37)
  python-gnupg: 0.4.6
        PyYAML: 5.3.1
         PyZMQ: 20.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 21.04 hirsute
        locale: utf-8
       machine: ppc64le
       release: 5.11.0-16-generic
        system: Linux
       version: Ubuntu 21.04 hirsute

Grains:

root@kvm-ppc64el-01:~# for g in {cpu_model,productname,serialnumber}; do salt-call --local grains.get $g; done
local:                      
    POWER8 (architected), altivec supported
local:
    IBM pSeries (emulated by qemu)
local:
    e3bcd582-d5d3-4e90-aa23-98d337685f5f

@github-actions
Copy link

github-actions bot commented Nov 2, 2021

Hi! I'm your friendly PR bot!

You might be wondering what I'm doing commenting here on your PR.

Yes, as a matter of fact, I am...

I'm just here to help us improve the documentation. I can't respond to
questions or anything, but what I can do, I do well!

Okay... so what do you do?

I detect modules that are missing docstrings or "CLI Example" on existing docstrings!
When I was created we had a lot of these. The documentation for these
modules need some love and attention to make Salt better for our users.

So what does that have to do with my PR?

I noticed that in this PR there are some files changed that have some of these
issues. So I'm leaving this comment to let you know your options.

Okay, what are they?

Well, my favorite, is that since you were making changes here I'm hoping that
you would be the most familiar with this module and be able to add some other
examples or fix any of the reported issues.

If I can, then what?

Well, you can either add them to this PR or add them to another PR. Either way is fine!

Well... what if I can't, or don't want to?

That's also fine! We appreciate all contributions to the Salt Project. If you
can't add those other examples, either because you're too busy, or unfamiliar,
or you just aren't interested, we still appreciate the contributions that
you've made already.

Whatever approach you decide to take, just drop a comment here letting us know!

Detected Issues (click me)
[INFO] Initializing environment for https://github.com/saltstack/pip-tools-compile-impersonate.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/saltstack/pre-commit-remove-import-headers.
[INFO] Initializing environment for https://github.com/s0undt3ch/salt-rewrite.
[INFO] Initializing environment for https://github.com/timothycrosley/isort.
[INFO] Initializing environment for https://github.com/timothycrosley/isort:toml.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/asottile/blacken-docs.
[INFO] Initializing environment for https://github.com/asottile/blacken-docs:black==21.7b0.
[INFO] Initializing environment for https://github.com/PyCQA/bandit.
[INFO] Initializing environment for https://github.com/saltstack/invoke-pre-commit.
[INFO] Initializing environment for https://github.com/saltstack/invoke-pre-commit:blessings,distro,jinja2,msgpack,pyyaml.
[INFO] Initializing environment for https://github.com/saltstack/mirrors-nox.
[INFO] Initializing environment for https://github.com/saltstack/mirrors-nox:pip>=20.2.4,<21.2,setuptools<58.0.
[INFO] Installing environment for https://github.com/saltstack/invoke-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Check Known Missing Docstrings...........................................Passed
- hook id: invoke
- duration: 1.27s

Thanks again!

@lukasraska
Copy link
Contributor Author

@dhiltonp is there any way to get this forward? it's more or less 4 months since I've created this PR with no reply from core team, thanks

@dhiltonp dhiltonp requested review from a team and garethgreenaway and removed request for dhiltonp and a team November 3, 2021 14:46
@lukasraska lukasraska force-pushed the linux-ppc64le-support branch from 9160dd9 to 7417b31 Compare August 24, 2022 19:17
@Ch3LL Ch3LL merged commit 8d9e19d into saltstack:master Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants