Skip to content

Commit

Permalink
Add disk space check to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Szubie committed Oct 5, 2022
1 parent f3a7403 commit ab8809a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions platform/host_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,9 +1087,19 @@ func (bh *BraveHost) InitUnit(backend Backend, unitParams shared.Service) (err e
if err != nil {
return fmt.Errorf("failed to obtain image hash %q", unitParams.Image)
}
imgSize, err := localImageSize(imageStruct)
if err != nil {
return fmt.Errorf("failed to get image size for image %q", imageStruct.String())
}
defer DeleteImageByFingerprint(lxdServer, fingerprint)

// Resource checks
if unitParams.Storage != "" {
err = CheckStoragePoolSpace(lxdServer, unitParams.Storage, imgSize)
if err != nil {
return err
}
}
err = CheckMemory(lxdServer, unitParams.Resources.RAM)
if err != nil {
return err
Expand Down

0 comments on commit ab8809a

Please sign in to comment.