Skip to content

Add KernelCommandLine to OperatingSystemStatus#244

Open
anokfireball wants to merge 1 commit intomainfrom
feature/add-kernel-parameters
Open

Add KernelCommandLine to OperatingSystemStatus#244
anokfireball wants to merge 1 commit intomainfrom
feature/add-kernel-parameters

Conversation

@anokfireball
Copy link
Contributor

Add KernelCommandLine []string field to OperatingSystemStatus to report kernel boot parameters from /proc/cmdline, split by whitespace.

Add KernelCommandLine []string field to OperatingSystemStatus to report
kernel boot parameters from /proc/cmdline, split by whitespace.
@github-actions
Copy link

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1 0.00% (ø)
github.com/cobaltcore-dev/openstack-hypervisor-operator/applyconfigurations/api/v1 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1/hypervisor_types.go 0.00% (ø) 0 0 0
github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1/zz_generated.deepcopy.go 0.00% (ø) 0 0 0
github.com/cobaltcore-dev/openstack-hypervisor-operator/applyconfigurations/api/v1/operatingsystemstatus.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Copy link
Contributor

@fwiesel fwiesel left a comment

Choose a reason for hiding this comment

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

I'd rather keep it as a string, because that is how it is passed.

This implies parsing the string, and the implementation proposed ("split by whitespace") is too simple, and raises the question, how do you pass parameters with white-spaces? How they are quoted, and how are the quotes escaped?

Either way, something one probably really doesn't want to solve, as you're likely fine with a regexp to search the argument that you are interested in out.

@anokfireball
Copy link
Contributor Author

anokfireball commented Feb 19, 2026

Fine by me. If we want them as separate values reliably, we could simply imitate the kernels (admittedly rather trivial) parsing in next_arg(): The only supported whitespace containing-args are quoted with single "

  • You can use " around spaces, but can't escape ".
  • Hyphens and underscores equivalent in parameter names.

@fwiesel
Copy link
Contributor

fwiesel commented Feb 19, 2026

Well, but what the kernel understands is not the same as what the kernel gets passed (i.e. KernelCommandLine).

The kernel parses parameters from the kernel command line up to “--“; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “--” is passed as an argument to init.

So, yes, you can implement that parsing, and but essentially it is a free for all.

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.

2 participants

Comments