qemuimg

package
v0.3.10-0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 25

Documentation

Index

Constants

View Source
const (
	QCOW2 = TImageFormat("qcow2")
	VMDK  = TImageFormat("vmdk")
	VHD   = TImageFormat("vhd")
	ISO   = TImageFormat("iso")
	RAW   = TImageFormat("raw")
)
View Source
const (
	// The scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle.
	IONiceNone       = TIONiceLevel(0)
	IONiceRealTime   = TIONiceLevel(1)
	IONiceBestEffort = TIONiceLevel(2)
	IONiceIdle       = TIONiceLevel(3)
)
View Source
const (
	EncryptFormatLuks = "luks"
)

Variables

View Source
var (
	ErrUnsupportedFormat = errors.Error("unsupported format")
)

Functions

func Convert

func Convert(srcInfo, destInfo SImageInfo, compact bool, workerOpions []string) error

func GetQemuFilepath

func GetQemuFilepath(path string, encKey string, encFormat TEncryptFormat) string

func IsSupportedImageFormat

func IsSupportedImageFormat(fmtStr string) bool

func ParseQemuFilepath

func ParseQemuFilepath(pathInfo string) (string, error)

"json:{\"driver\":\"qcow2\",\"file\":{\"driver\":\"file\",\"filename\":\"/opt/cloud/workspace/disks/snapshots/72a2383d-e980-486f-816c-6c562e1757f3_snap/f39f225a-921f-492e-8fb6-0a4167d6ed91\"}}"

func Qcow2SparseOptions

func Qcow2SparseOptions() []string

func QemuImgInit

func QemuImgInit() error

Types

type SFileInfo

type SFileInfo struct {
	Driver   string `json:"driver"`
	Filename string `json:"filename"`
	Locking  string `json:"locking"`
}

type SImageInfo

type SImageInfo struct {
	Path     string
	Format   TImageFormat
	IoLevel  TIONiceLevel
	Password string

	// only luks supported
	EncryptFormat TEncryptFormat
	// aes-256, sm4
	EncryptAlg seclib2.TSymEncAlg
	// contains filtered or unexported fields
}

func (SImageInfo) Encrypted

func (info SImageInfo) Encrypted() bool

func (SImageInfo) ImageOptions

func (info SImageInfo) ImageOptions() string

func (SImageInfo) SecretOptions

func (info SImageInfo) SecretOptions() string

func (*SImageInfo) SetSecId

func (info *SImageInfo) SetSecId(id string)

type SQcow2FileInfo

type SQcow2FileInfo struct {
	Driver           string    `json:"driver"`
	EncryptKeySecret string    `json:"encrypt.key-secret"`
	EncryptFormat    string    `json:"encrypt.format"`
	File             SFileInfo `json:"file"`
}

type SQemuImage

type SQemuImage struct {
	Path            string
	Password        string
	Format          TImageFormat
	SizeBytes       int64
	ActualSizeBytes int64
	ClusterSize     int
	BackFilePath    string
	Compat          string
	Encrypted       bool
	Subformat       string
	IoLevel         TIONiceLevel

	EncryptFormat TEncryptFormat
	EncryptAlg    seclib2.TSymEncAlg
}

func NewQemuImage

func NewQemuImage(path string) (*SQemuImage, error)

func NewQemuImageWithIOLevel

func NewQemuImageWithIOLevel(path string, ioLevel TIONiceLevel) (*SQemuImage, error)

func (*SQemuImage) Check

func (img *SQemuImage) Check() error

func (*SQemuImage) Clone

func (img *SQemuImage) Clone(name string, format TImageFormat, compact bool) (*SQemuImage, error)

func (*SQemuImage) CloneQcow2

func (img *SQemuImage) CloneQcow2(name string, compact bool) (*SQemuImage, error)

func (*SQemuImage) CloneRaw

func (img *SQemuImage) CloneRaw(name string) (*SQemuImage, error)

func (*SQemuImage) CloneVhd

func (img *SQemuImage) CloneVhd(name string) (*SQemuImage, error)

func (*SQemuImage) CloneVmdk

func (img *SQemuImage) CloneVmdk(name string, compact bool) (*SQemuImage, error)

func (*SQemuImage) Convert2Qcow2

func (img *SQemuImage) Convert2Qcow2(compact bool, password string, encFormat TEncryptFormat, encAlg seclib2.TSymEncAlg) error

func (*SQemuImage) Convert2Qcow2To

func (img *SQemuImage) Convert2Qcow2To(output string, compact bool, password string, encFormat TEncryptFormat, encAlg seclib2.TSymEncAlg) error

func (*SQemuImage) Convert2Raw

func (img *SQemuImage) Convert2Raw() error

func (*SQemuImage) Convert2Vhd

func (img *SQemuImage) Convert2Vhd() error

func (*SQemuImage) Convert2Vmdk

func (img *SQemuImage) Convert2Vmdk(compact bool) error

func (*SQemuImage) Copy

func (img *SQemuImage) Copy(name string) (*SQemuImage, error)

func (*SQemuImage) CreateQcow2

func (img *SQemuImage) CreateQcow2(sizeMB int, compact bool, backPath string, password string, encFormat TEncryptFormat, encAlg seclib2.TSymEncAlg) error

func (*SQemuImage) CreateRaw

func (img *SQemuImage) CreateRaw(sizeMB int) error

func (*SQemuImage) CreateVhd

func (img *SQemuImage) CreateVhd(sizeMB int) error

func (*SQemuImage) CreateVmdk

func (img *SQemuImage) CreateVmdk(sizeMB int, compact bool) error

func (*SQemuImage) Delete

func (img *SQemuImage) Delete() error

func (*SQemuImage) Expand

func (img *SQemuImage) Expand() error

func (*SQemuImage) Fallocate

func (img *SQemuImage) Fallocate() error

func (*SQemuImage) GetActualSizeMB

func (img *SQemuImage) GetActualSizeMB() int

func (*SQemuImage) GetSizeMB

func (img *SQemuImage) GetSizeMB() int

func (*SQemuImage) IsChained

func (img *SQemuImage) IsChained() bool

func (*SQemuImage) IsRaw

func (img *SQemuImage) IsRaw() bool

func (*SQemuImage) IsSparse

func (img *SQemuImage) IsSparse() bool

func (*SQemuImage) IsSparseQcow2

func (img *SQemuImage) IsSparseQcow2() bool

func (*SQemuImage) IsSparseVmdk

func (img *SQemuImage) IsSparseVmdk() bool

func (*SQemuImage) IsValid

func (img *SQemuImage) IsValid() bool

func (*SQemuImage) Rebase

func (img *SQemuImage) Rebase(backPath string, force bool) error

func (*SQemuImage) Resize

func (img *SQemuImage) Resize(sizeMB int) error

func (*SQemuImage) SetPassword

func (img *SQemuImage) SetPassword(password string)

base64 password

func (*SQemuImage) String

func (img *SQemuImage) String() string

func (*SQemuImage) WholeChainFormatIs

func (img *SQemuImage) WholeChainFormatIs(format string) (bool, error)

type TEncryptFormat

type TEncryptFormat string

type TIONiceLevel

type TIONiceLevel int

type TImageFormat

type TImageFormat string

func String2ImageFormat

func String2ImageFormat(fmt string) TImageFormat

func (TImageFormat) String

func (fmt TImageFormat) String() string

Jump to

Keyboard shortcuts

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