Skip to content

Commit 92ad18c

Browse files
committed
fix: write correct capacity to the ovf
With the refactoring to 1.5, the confusion between bytes and megabytes introduced this bug. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 6b0373e commit 92ad18c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/imager/ova/ova.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ func CreateOVAFromRAW(name, path, arch, scratchPath string, diskSize int64, prin
161161
return err
162162
}
163163

164-
size := f.Size()
164+
imageSize := f.Size()
165165

166-
ovf, err := renderOVF(name, size, diskSize)
166+
ovf, err := renderOVF(name, imageSize, diskSize)
167167
if err != nil {
168168
return err
169169
}
@@ -241,15 +241,15 @@ func renderMF(name, vmdkSHA25Sum, ovfSHA25Sum string) (string, error) {
241241
return buf.String(), nil
242242
}
243243

244-
func renderOVF(name string, size, capacity int64) (string, error) {
244+
func renderOVF(name string, imageSize, diskSize int64) (string, error) {
245245
cfg := struct {
246246
VMDK string
247247
Size int64
248248
Capacity int64
249249
}{
250250
VMDK: name + ".vmdk",
251-
Size: size,
252-
Capacity: capacity,
251+
Size: imageSize,
252+
Capacity: diskSize / (1 << 20),
253253
}
254254

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

0 commit comments

Comments
 (0)