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

feat: precondition checks as a feature #322

Merged
merged 7 commits into from
Feb 20, 2024
Merged

feat: precondition checks as a feature #322

merged 7 commits into from
Feb 20, 2024

Conversation

de-sh
Copy link
Contributor

@de-sh de-sh commented Jan 29, 2024

Closes #

Changes

If enabled, the action should be configured to first head into the precondition checker for space verification before heading into downloader to be downloaded as follows:

action_redirections = [{ "update_firmware" = "download_firmware", "download_firmware" = "install_firmware" }]

[precondition_checks]
actions = [{ name = "update_firmware" }]
path = "/path/to/install"

[downloader]
actions = [{ name = "download_firmware" }]
path = "/path/to/download"

[ota_installer]
actions = [{ name = "install_firmware" }]
path = "/path/to/install"

Payload attached to the download action routed to this precondition checker must henceforth have the following fields:

{
...
  "content-length": // size of file to be downloaded,
  "uncompressed-length": // size of uncompressed files
}

Why?

It has become necessary for there to be a means by which the customer can define a precondition, in this case disk space required for an firmware update installation to succeed. With this feature we will be able to fail update_firmware actions before the download stage to ensure that valuable bandwidth isn't utilized in downloading a file that can't then be decompressed on device because of disk size constraints. We verify if the download and installation/decompression paths are in the same disk partition to ensure that the calculations are done appropriately.

Trials Performed

Uplink running on three devices as follows:

  1. Configured to download and decompress into the same partition where both have sufficient space(control)
  1. Configured to download into partition A and decompress into partition B where both have sufficient space
  1. Configured to download and decompress into the same partition where this is only sufficient space to download the file(precondition stage fails)
  1. Configured to download into partition A and decompress into partition B where A doesn't have sufficient space(precondition stage succeeds but download should fail)
  1. Configured to download into partition A and decompress into partition B where B doesn't have sufficient space(precondition stage fails)

The observations are made in the gist show that file download happened when space was available to decompress. whereas it did not when there wasn't enough, despite the compressed file being able to fit in.

@de-sh de-sh marked this pull request as ready for review February 20, 2024 06:03
@de-sh de-sh merged commit 5018130 into main Feb 20, 2024
2 checks passed
de-sh added a commit that referenced this pull request Feb 20, 2024
@de-sh de-sh deleted the preconditions branch February 20, 2024 06:47
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.

1 participant