Skip to content

Comments

Add KernelCommandLine to OperatingSystemStatus#244

Merged
anokfireball merged 1 commit intomainfrom
feature/add-kernel-parameters
Feb 20, 2026
Merged

Add KernelCommandLine to OperatingSystemStatus#244
anokfireball merged 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.

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.

@anokfireball anokfireball force-pushed the feature/add-kernel-parameters branch from 29c50b7 to 0c70725 Compare February 20, 2026 12:16
Store the raw /proc/cmdline content as a string in the hypervisor
status.
@anokfireball anokfireball force-pushed the feature/add-kernel-parameters branch from 0c70725 to 77e78a9 Compare February 20, 2026 12:22
@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/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.

@anokfireball
Copy link
Contributor Author

Decided to go with the raw string, the intent of this was to show "what we supply" to the kernel.

@anokfireball anokfireball merged commit c971fc1 into main Feb 20, 2026
5 of 6 checks passed
@anokfireball anokfireball deleted the feature/add-kernel-parameters branch February 20, 2026 14:17
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