Skip to content

Manage firecracker images in usr not var#75

Open
schaefi wants to merge 2 commits intomainfrom
firecracker_to_usr_not_var
Open

Manage firecracker images in usr not var#75
schaefi wants to merge 2 commits intomainfrom
firecracker_to_usr_not_var

Conversation

@schaefi
Copy link
Copy Markdown
Contributor

@schaefi schaefi commented Apr 9, 2026

Store firecracker images and the storage blob to
/usr/share/firecracker instead of /var/lib/firecracker. This serves the needs for SUSE's immutable mode and is also more consistent with other flake files e.g /usr/share/flakes. This Fixes jira#1054

@schaefi schaefi requested a review from rjschwei April 9, 2026 09:16
@schaefi schaefi self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@rjschwei rjschwei left a comment

Choose a reason for hiding this comment

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

Code looks good. It would be nice to have a %post that moves any existing images from the old to the new location on package update.

Store firecracker images and the storage blob to
/usr/share/firecracker instead of /var/lib/firecracker.
This serves the needs for SUSE's immutable mode and
is also more consistent with other flake files e.g
/usr/share/flakes. This Fixes jira#1054
@schaefi schaefi force-pushed the firecracker_to_usr_not_var branch from 3cf17e6 to 87ee356 Compare April 13, 2026 11:02
@schaefi
Copy link
Copy Markdown
Contributor Author

schaefi commented Apr 13, 2026

Code looks good. It would be nice to have a %post that moves any existing images from the old to the new location on package update.

@rjschwei Thanks, I added a %post. Can you please have a very close look to the %post coding :) I tend to make stupid mistakes with spec file scrips and I very much appreciate if you can double check it.

Thanks

@schaefi schaefi requested a review from rjschwei April 13, 2026 11:19
%post -n flake-pilot-firecracker
if [ "$YAST_IS_RUNNING" != "instsys" ] && [ -d /var/lib/firecracker ];then
rsync -za /var/lib/firecracker/ /usr/share/firecracker/
rm -rf /var/lib/firecracker
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this might trigger an RPM error on package upgrade. RPM will try to remove any files that are not part of the new package on it's own. Since the new package no longer owns /var/lib/firecracker RPM will try to remove this directory, but it will already be gone due to the %post action. I am not sure if RPM ignores that error or complains.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's worse. I talked to some rpm experts. Here is the answer

you need to keep the old directory in the filelist or rpm will delete it on transaction which breaks your post script

I added a commit to address this situation

@rjschwei now the question is, if I have to keep the old location as a %dir in order to allow the move, does that break the idea of SUSE's immutable system concept ?

Thanks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, when I reviewed this I completely lost track of the context as to why these changes are being made, my bad. There should actually not be any moving. On a transactional-update system /usr is immutable, meaning with the current code if a user actually wants to add a firecracker image that operation would fail. The location where the images are store has to remain the same, i.e. /var/lib/firecracker.

What you need to do is create flake-pilot.conf file which contains

d /var/lib/firecracker
d /var/lib/firecracker/images
d /var/lib/firecracker/storage

and then in the spec file own those directories as %ghost.

Sorry for not picking up on this on the first review.

@schaefi schaefi force-pushed the firecracker_to_usr_not_var branch from 8d158b9 to 267f2aa Compare April 14, 2026 16:20
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