Files
podman/pkg/machine/define/image_format.go
Brent Baude a31e8d2a23 zstd now default compression for podman machine
given that we are moving to building our own machine images, we have
decided to use zstd compression as it is superior in speed to the
alternatives.  as such, this pr adds zstd to our machine code; and also
has to account for dealing with sparseness on darwin; which the default
zstd golang library does not.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-20 14:26:41 -06:00

33 lines
434 B
Go

package define
import "fmt"
type ImageFormat int64
const (
Qcow ImageFormat = iota
Vhdx
Tar
Raw
)
func (imf ImageFormat) Kind() string {
switch imf {
case Vhdx:
return "vhdx"
case Tar:
return "tar"
case Raw:
return "raw"
}
return "qcow2"
}
func (imf ImageFormat) KindWithCompression() string {
// Tar uses xz; all others use zstd
if imf == Tar {
return "tar.xz"
}
return fmt.Sprintf("%s.zst", imf.Kind())
}