ova

package
v0.0.0-...-79a645e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ImageFormatOVA = vdisk.Format("ova")

ImageFormatOVA ...

Variables

This section is empty.

Functions

func GenerateOVF

func GenerateOVF(imageName string, cfg *vcfg.VCFG, capacity int) vio.File

GenerateOVF A OVF File to be used in the creation of a OVA image. This OVF will created with the name {imageName}.ovf and will have one image configured named {imageName}.vmdk

Types

type Sizer

type Sizer interface {
	Size() int64
}

Sizer is an interface that shouldn't exist in a vacuum, but does because our other image formats follow a similar patten and need more information. A Sizer should return the true and final RAW size of the image and be callable before the first byte of data is written to the Writer. Note that our vimg.Builder implements this interface and is the intended argument in most cases.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer implements io.Closer, io.Writer, and io.Seeker interfaces. Creating an OVA image is as simple as getting one of these writers and copying a raw image into it.

func NewWriter

func NewWriter(w io.Writer, h Sizer, cfg *vcfg.VCFG) (*Writer, error)

NewWriter Creates a tar writer and a VMDK Stream Optimized Writer. The OVA writer wraps the VMDK writer and will write the raw image directly to it. The OVA will only be constructed on the .Close() function, and will do so by adding the built vmdk and a generated ovf to a tar archive. The vmdk writer writes to a temp file.

func (*Writer) Close

func (w *Writer) Close() error

Close does the following steps: 1) Close VMDK writer 2) Generate OVF 3) Tar OVF and VMDK, and write that to the OVA 4) Clean up VMDK in temp directory.

func (*Writer) Seek

func (w *Writer) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker. (Wraps Stream Optimised VMDK Writer)

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write implements io.Writer. (Wraps Stream Optimised VMDK Writer)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL