Documentation ¶
Index ¶
- Constants
- func ConvertToRawStream(url *url.URL, dest string, preallocate bool) error
- func CreateBlankImage(dest string, size resource.Quantity, preallocate bool) error
- func Resize(image string, size resource.Quantity) error
- func Validate(url *url.URL, availableSize int64, filesystemOverhead float64) error
- type Header
- type Headers
- type ImgInfo
- type Nbdkit
- type NbdkitFilter
- type NbdkitPlugin
- type QEMUOperations
Constants ¶
const ( // ExtImg is a constant for the .img extenstion ExtImg = ".img" // ExtIso is a constant for the .iso extenstion ExtIso = ".iso" // ExtGz is a constant for the .gz extenstion ExtGz = ".gz" // ExtQcow2 is a constant for the .qcow2 extenstion ExtQcow2 = ".qcow2" // ExtTar is a constant for the .tar extenstion ExtTar = ".tar" // ExtXz is a constant for the .xz extenstion ExtXz = ".xz" // ExtTarXz is a constant for the .tar.xz extenstion ExtTarXz = ExtTar + ExtXz // ExtTarGz is a constant for the .tar.gz extenstion ExtTarGz = ExtTar + ExtGz )
const MaxExpectedHdrSize = 512
MaxExpectedHdrSize defines the Size of buffer used to read file headers. Note: this is the size of tar's header. If a larger number is used the tar unarchive operation
creates the destination file too large, by the difference between this const and 512.
Variables ¶
This section is empty.
Functions ¶
func ConvertToRawStream ¶ added in v1.8.0
ConvertToRawStream converts an http accessible image to raw format without locally caching the image
func CreateBlankImage ¶ added in v1.4.0
CreateBlankImage creates empty raw image
Types ¶
type Header ¶
type Header struct { Format string SizeOff int // in bytes SizeLen int // in bytes // contains filtered or unexported fields }
Header represents our parameters for a file format header
type Headers ¶
Headers provides a map for header info, key is file format, eg. "gz" or "tar", value is metadata describing the layout for this hdr
func CopyKnownHdrs ¶
func CopyKnownHdrs() Headers
CopyKnownHdrs performs a simple map copy since := assignment copies the reference to the map, not contents.
type ImgInfo ¶ added in v1.4.0
type ImgInfo struct { // Format contains the format of the image Format string `json:"format"` // BackingFile is the file name of the backing file BackingFile string `json:"backing-filename"` // VirtualSize is the disk size of the image which will be read by vm VirtualSize int64 `json:"virtual-size"` // ActualSize is the size of the qcow2 image ActualSize int64 `json:"actual-size"` }
ImgInfo contains the virtual image information.
type Nbdkit ¶ added in v1.29.0
type Nbdkit struct { NbdPidFile string // contains filtered or unexported fields }
Nbdkit represents struct for an nbdkit instance
func NewNbdkit ¶ added in v1.29.0
func NewNbdkit(plugin NbdkitPlugin, nbdkitPidFile string) *Nbdkit
NewNbdkit creates a new Nbdkit instance with an nbdkit plugin and pid file
func NewNbdkitCurl ¶ added in v1.29.0
NewNbdkitCurl creates a new Nbdkit instance with the curl plugin
func (*Nbdkit) AddFilter ¶ added in v1.29.0
func (n *Nbdkit) AddFilter(filter NbdkitFilter)
AddFilter adds a nbdkit filter if it doesn't already exist
type NbdkitFilter ¶ added in v1.29.0
type NbdkitFilter string
NbdkitFilter represents s filter for nbdkit
const ( NbdkitXzFilter NbdkitFilter = "xz" NbdkitTarFilter NbdkitFilter = "tar" NbdkitGzipFilter NbdkitFilter = "gzip" )
Nbdkit filters
type NbdkitPlugin ¶ added in v1.29.0
type NbdkitPlugin string
NbdkitPlugin represents a plugin for nbdkit
const (
NbdkitCurlPlugin NbdkitPlugin = "curl"
)
Nbdkit plugins
type QEMUOperations ¶
type QEMUOperations interface { ConvertToRawStream(*url.URL, string, bool) error Resize(string, resource.Quantity) error Info(url *url.URL) (*ImgInfo, error) Validate(*url.URL, int64, float64) error CreateBlankImage(string, resource.Quantity, bool) error }
QEMUOperations defines the interface for executing qemu subprocesses
func NewNbdkitOperations ¶ added in v1.29.0
func NewNbdkitOperations(n *Nbdkit) QEMUOperations
NewNbdkitOperations return the implementation of nbdkit of QEMUOperations
func NewQEMUOperations ¶
func NewQEMUOperations() QEMUOperations
NewQEMUOperations returns the default implementation of QEMUOperations