Skip to content

Commit

Permalink
fix: write correct capacity to the ovf
Browse files Browse the repository at this point in the history
With the refactoring to 1.5, the confusion between bytes and megabytes
introduced this bug.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Aug 17, 2023
1 parent 6b0373e commit 92ad18c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/imager/ova/ova.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ func CreateOVAFromRAW(name, path, arch, scratchPath string, diskSize int64, prin
return err
}

size := f.Size()
imageSize := f.Size()

ovf, err := renderOVF(name, size, diskSize)
ovf, err := renderOVF(name, imageSize, diskSize)
if err != nil {
return err
}
Expand Down Expand Up @@ -241,15 +241,15 @@ func renderMF(name, vmdkSHA25Sum, ovfSHA25Sum string) (string, error) {
return buf.String(), nil
}

func renderOVF(name string, size, capacity int64) (string, error) {
func renderOVF(name string, imageSize, diskSize int64) (string, error) {
cfg := struct {
VMDK string
Size int64
Capacity int64
}{
VMDK: name + ".vmdk",
Size: size,
Capacity: capacity,
Size: imageSize,
Capacity: diskSize / (1 << 20),
}

templ := template.Must(template.New("ovf").Parse(ovfTpl))
Expand Down

0 comments on commit 92ad18c

Please sign in to comment.