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
restartcheck: add NILRT ARM kernel version detection #47610
restartcheck: add NILRT ARM kernel version detection #47610
Conversation
@jirikotlin is this something you could help us review? |
07f186e
to
830f9b7
Compare
@isbm You came up on GitHub's reviewers suggestions list, so I've requested a review from you here. Would you mind taking a look? |
salt/modules/restartcheck.py
Outdated
re_result = re.search(kvregex, kernel_strings) | ||
return None if re_result is None else re_result.group(0) | ||
|
||
if _is_older_nilrt(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, very nice! if distribution_i_use_at_my_office():
anyone? 😉
@10ne1 since seems NILRT does not have a proper versioning, then can we come up with something generic instead, like property checker etc, which will do decision based on that (say, "foo is installed", "bar is located there" etc) instead of hardcoding "older version" or "even_older_version" right into the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can modify the distro rootfs without breaking backwards compatibility such that the lsb_release DISTRIB_ID field reflects the difference between these older/newer versions and that would automatically get picked up by the existing lsb_distrib_id grain, so then we'd just have to test for grains[lsb_distrib_id] == 'nilrt'.
Are you ok with this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rallytime seems your bot works very well! Last time I was reviewing this indeed. You should also probably take to the account number of comments posted by a reviewer... 😆 |
salt/modules/restartcheck.py
Outdated
kver = None | ||
|
||
def _get_kver_from_bin(kbin): | ||
'''Get kernel version from a binary image or None if detection fails''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split this doc string into 3 lines instead of 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rallytime Yes, done.
830f9b7
to
b944c86
Compare
@isbm @rallytime I've rebased on top of the develop branch and removed _is_older_nilrt in favor of the lsb_distrib_id grain which recently got fixed by #47951 |
b944c86
to
4eafcf6
Compare
8d0dbb1
to
9e9b4e4
Compare
Detecting the NXG ARM kernel version is easy because the kernel is installed the same way as on x64, only uncompressed (uImage). For older ARM NILRT however on-disk kernel version detection is harder because the kernel is compressed and stored inside an u-boot "itb" image alongside it's device tree, ramdisk and a bootscript, so we need to extract it and decompress. Make the distinction between older vs newer NILRT useing the new lsb_distrib_id grain which recently got repurposed in NILRT. Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Kind reminder. Ping? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@10ne1 oh, sorry! Thanks for the reminder, it was really needed. Yeah, looks better. I still don't like that you need to re-check the path to the image and in my personal opinion I would move it away to a separate function, like _get_kernel_path
. If you would be kind to do that, go ahead.
Otherwise you can leave it as is for now.
What does this PR do?
Adds the capability to detect ARM kernel versions to restartcheck on NI Linux RT platforms.
Tests written?
No
Commits signed with GPG?
No