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

Before writing to partition check for sufficient space on partition #3276

Conversation

zedi-pramodh
Copy link

  1. Get the size of the image using contenttree status
  2. Get the size of the partition using zboot
  3. If partition size is < image size, error out
  4. Fixed zboot API to be more portable

1. Get the size of the image using contenttree status
2. Get the size of the partition using zboot
3. If partition size is < image size, error out
4. Fixed zboot API to be more portable

Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
@zedi-pramodh
Copy link
Author

Tried to upgrade to image of size 321MB

dev.log.2224562291:{"severity":"info","source":"zedagent","iid":"1865","content":"{"error":"doBaseOsActivate: Image size 336605184 bytes greater than partition size 314572800 bytes","error-time":"2023-06-10T03:02:30.384830099Z","file":"/pillar/types/zedagenttypes.go:136","func":"github.com/lf-edge/eve/pkg/pillar/types.BaseOsStatus.LogModify","level":"info","log_event_type":"log","msg":"BaseOs status modify","obj_key":"baseos_status-v7.4.0-master-private-1212-g92de24282-kubevirt-amd64","obj_name":"v7.4.0-master-private-1212-g92de24282-kubevirt-amd64","obj_type":"baseos_status","pid":1865,"source":"zedagent","state":"LOADED","time":"2023-06-10T03:02:30.386236254Z"}\n","msgid":3412,"timestamp":{"seconds":1686366150,"nanos":386236254},"filename":"/pillar/types/zedagenttypes.go:136","function":"github.com/lf-edge/eve/pkg/pillar/types.BaseOsStatus.LogModify"}

On the controller

ALERTS
Date & Time Severity Description
Jun 09, 2023 8:02 PM Error doBaseOsActivate: Image size 336605184 bytes greater than partition size 314572800 bytes


if cts.State == types.LOADED {
partSize := zboot.GetPartitionSizeInBytes(status.PartitionLabel)
imageSize := cts.MaxDownloadSize
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we have an actual size which could be smaller than MaxDownloadSize?

Copy link
Author

Choose a reason for hiding this comment

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

MaxDownloadSize seems to be the size of image sent from the controller in the content tree config. zedagent is parsing that value from the config. To me that seems to be the actual size of the image. Let me know if that is not correct.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

Kick off tests

@eriknordmark eriknordmark merged commit bc703fe into lf-edge:master Jun 14, 2023
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