Skip to content
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

VM: Firmware detection fixes (from Incus) #14050

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

tomponline
Copy link
Member

@tomponline tomponline commented Sep 6, 2024

Based on:

Follows on from #14032

Also improves the removal of old firmware vars files by not checking the if the associated firmwares exist on the host and not trying to remove the same files multiple times.

@tomponline tomponline self-assigned this Sep 6, 2024
@tomponline tomponline marked this pull request as ready for review September 6, 2024 08:51
Signed-off-by: Stéphane Graber <[email protected]>
(cherry picked from commit 20e228fa146569b78a36320a4c808da0782e038f)
Signed-off-by: Thomas Parrott <[email protected]>
License: Apache-2.0
The NVRAM symlink was previously deleted thanks to a bug in the firmware
lookup logic. That logic got recently corrected which in turn caused the
symlink to no longer be deleted, causing it to occasionaly point to the
incorrect target...

Signed-off-by: Stéphane Graber <[email protected]>
(cherry picked from commit 17cba6ecb8900c8fc462e8ab59a1cd509567a91d)
Signed-off-by: Thomas Parrott <[email protected]>
License: Apache-2.0
mihalicyn
mihalicyn previously approved these changes Sep 6, 2024
…tAchitectureFirmwareVarsCandidates

Now that GetArchitectureFirmwarePairsForUsage is checking for the existence of the firmware files (good)
it means that calling GetAchitectureFirmwarePairs is also checking for the existence of the firmware files.

This is inefficient because GetAchitectureFirmwarePairs is only during setupNvram() in order to build a
list of candidate firmware vars names in order to see if the VM currently has any of those to be deleted.

In this scenario we don't need to check whether the firmwares exist on the host, and actually it is
undesirable to do this as if the firmwares were removed from the host then old vars files may be left
behind in the VM's config volume.

Additionally the current return value of GetAchitectureFirmwarePairs means that LXD will check if
the same files exist several times (because the same vars file name can be used for different usages).

So this commit reworks GetAchitectureFirmwarePairs into GetAchitectureFirmwareVarsCandidates which
returns just a unqiue slice of candidate var names without checking if the associated firmware files
exist on the host.

The caller can then use this slice to try and remove the vars files from the VM's config volume.
Because it is a unique slice, LXD will only try to remove each file once avoiding unnecessary syscalls.

Signed-off-by: Thomas Parrott <[email protected]>
…s usage

And error message improvement.

Signed-off-by: Thomas Parrott <[email protected]>
@tomponline tomponline merged commit be65fe0 into canonical:main Sep 6, 2024
28 checks passed
@tomponline tomponline deleted the tp-vm-firmwares branch September 6, 2024 10:27
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