vmexport

package
v0.59.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Available vmexport functions
	CREATE   = "create"
	DELETE   = "delete"
	DOWNLOAD = "download"

	// Available vmexport flags
	OUTPUT_FLAG   = "--output"
	VOLUME_FLAG   = "--volume"
	VM_FLAG       = "--vm"
	SNAPSHOT_FLAG = "--snapshot"
	INSECURE_FLAG = "--insecure"
	KEEP_FLAG     = "--keep-vme"
	PVC_FLAG      = "--pvc"
	TTL_FLAG      = "--ttl"

	// ErrRequiredFlag serves as error message when a mandatory flag is missing
	ErrRequiredFlag = "Need to specify the '%s' flag when using '%s'"
	// ErrIncompatibleFlag serves as error message when an incompatible flag is used
	ErrIncompatibleFlag = "The '%s' flag is incompatible with '%s'"
	// ErrRequiredExportType serves as error message when no export kind is provided
	ErrRequiredExportType = "Need to specify export kind when attempting to create a VirtualMachineExport [--pvc|--vm|--snapshot]"
	// ErrIncompatibleExportType serves as error message when an export kind is provided with an incompatible argument
	ErrIncompatibleExportType = "Should not specify export kind"
)

Variables

View Source
var ExportProcessingComplete exportCompleteFunc = waitForVirtualMachineExport

ExportProcessingComplete is used to store the function to wait for the export object to be ready. Useful for unit tests.

Functions

func CreateVirtualMachineExport

func CreateVirtualMachineExport(client kubecli.KubevirtClient, vmeInfo *VMExportInfo) error

CreateVirtualMachineExport serves as a wrapper to create the virtualMachineExport object and, if needed, do error handling

func DeleteVirtualMachineExport

func DeleteVirtualMachineExport(client kubecli.KubevirtClient, vmeInfo *VMExportInfo) error

DeleteVirtualMachineExport serves as a wrapper to delete the virtualMachineExport object

func DownloadVirtualMachineExport

func DownloadVirtualMachineExport(client kubecli.KubevirtClient, vmeInfo *VMExportInfo) error

DownloadVirtualMachineExport handles the process of downloading the requested volume from a VirtualMachineExport object

func GetUrlFromVirtualMachineExport

func GetUrlFromVirtualMachineExport(vmexport *exportv1.VirtualMachineExport, vmeInfo *VMExportInfo) (string, error)

GetUrlFromVirtualMachineExport inspects the VirtualMachineExport status to fetch the extected URL

func NewVirtualMachineExportCommand

func NewVirtualMachineExportCommand(clientConfig clientcmd.ClientConfig) *cobra.Command

NewVirtualMachineExportCommand returns a cobra.Command to handle the export process

func SetDefaultHTTPClientCreator

func SetDefaultHTTPClientCreator()

SetDefaultHTTPClientCreator sets the http client creator back to default

func SetHTTPClientCreator

func SetHTTPClientCreator(f HTTPClientCreator)

SetHTTPClientCreator allows overriding the default http client (useful for unit testing)

Types

type HTTPClientCreator

type HTTPClientCreator func(*http.Transport, bool) *http.Client

type VMExportInfo

type VMExportInfo struct {
	ShouldCreate bool
	Insecure     bool
	KeepVme      bool
	OutputFile   string
	VolumeName   string
	Namespace    string
	Name         string
	ExportSource k8sv1.TypedLocalObjectReference
	TTL          metav1.Duration
}

Jump to

Keyboard shortcuts

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