Skip to content

Conversation

@KevinLCtx
Copy link
Contributor

This makes MenuEntry.contents more useful as a way to inject arbitrary data into a menuentry. Before this change setNextBoot assumed it was the only user of this field as was clobbering any existing data.

New method setGrubVariable() which will be used by an external tool.

@KevinLCtx
Copy link
Contributor Author

@rosslagerwall @freddy77 @GeraldEV sorry it looks like I don't have permission to add reviewers.

@rosslagerwall rosslagerwall self-requested a review November 25, 2025 10:34

clear_default = ['\tunset override_entry', '\tsave_env override_entry']
self.menu[entry].contents = clear_default
self.menu[entry].contents = clear_default + self.menu[entry].contents
Copy link
Contributor

Choose a reason for hiding this comment

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

This was idempotent before but now it is not. Could it be made idempotent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a check to make sure the data isn't already in the list before adding it
26f4b66#diff-ef827c75981754adfd2ddfe6664bca4b0642718b9a3fe197f9b54bd0ed53e48cR377

@rosslagerwall
Copy link
Contributor

Can you please add a ticket reference to the commit message?

I believe that @alexbrett was planning to open a PR with a significant rework of this code imminently so maybe check with him if these changes will collide.

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #184     +/-   ##
========================================
+ Coverage    83.2%   83.6%   +0.3%     
========================================
  Files          23      23             
  Lines        3348    3368     +20     
========================================
+ Hits         2788    2817     +29     
+ Misses        560     551      -9     
Files with missing lines Coverage Δ
xcp/bootloader.py 93.7% <100.0%> (+3.5%) ⬆️

@KevinLCtx
Copy link
Contributor Author

KevinLCtx commented Nov 25, 2025

The pre-commit job is removing trailing whitespace from the expected GRUB output in the unit tests (changing "xen_hypervisor xen.efi " to "xen_hypervisor xen.efi") and now the unit tests fail because the real output does have whitespace at the end.

Fixed this by adding cmdline args so "xen_hypervisor xen.efi " becomes "xen_hypervisor xen.efi args" with no whitespace at the end.

…tNextBoot

This makes MenuEntry.contents more useful as a way to inject arbitrary
data into a menuentry. Before this change setNextBoot assumed it was the
only user of this field as was clobbering any existing data.

New method setGrubVariable() which will be used by an external tool.

Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
@KevinLCtx
Copy link
Contributor Author

Now it's failing because my test function names are too long and descriptive.

Notice: Convention: Method name "test_set_grub_variable_throws_without_envfile" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern
Notice: Convention: Method name "test_contents_not_clobbered_by_setnextboot" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern

Variable name "COUNTER" doesn't conform to '[a-z_][a-zA-Z0-9_]{0,30}$' pattern
Method name "test_set_grub_variable_throws_without_envfile" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern
Method name "test_contents_not_clobbered_by_setnextboot" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern

Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
@KevinLCtx
Copy link
Contributor Author

Added an extra commit to fix the pylint errors

I believe that @alexbrett was planning to open a PR with a significant rework of this code imminently so maybe check with him if these changes will collide.

Alex said he will incorporate these changes as his aren't ready yet.

@KevinLCtx
Copy link
Contributor Author

Pylint failed because Warning: Using an f-string that does not have any interpolated variables

Doing RPU from a host with Secure Boot has extra challenges.

We can't do XS9 Shim -> XS9 GRUB -> XS10 Xen because
XS9 Shim can't verify XS10 Xen's signature.

We need to chainload XS10 Shim before loading any XS10 components.
XS9 Shim -> XS9 GRUB -> XS10 Shim -> XS10 Xen -> ...

After chainloading XS10 Shim the system will end up back in the same
GRUB menu so we also have a guard variable to ensure on first boot we
chainload the shim and on second been we proceed with the RPU.

Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
@KevinLCtx
Copy link
Contributor Author

Changes in last push:
Use search --label instead of search --file, caller of
setRpuChainloader() now needs to pass in the ESP partition label.

@KevinLCtx KevinLCtx merged commit f6b180f into xenserver:master Dec 1, 2025
9 checks passed
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