openstack

package
v0.0.0-...-dbbfab9 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateOSLabel                 = "os.template.kubevirt.io/%s"
	TemplateWorkloadLabel           = "workload.template.kubevirt.io/%s"
	TemplateWorkloadServer          = "server"
	TemplateWorkloadDesktop         = "desktop"
	TemplateWorkloadHighPerformance = "highperformance"
	TemplateFlavorLabel             = "flavor.template.kubevirt.io/%s"
	TemplateFlavorTiny              = "tiny"
	TemplateFlavorSmall             = "small"
	TemplateFlavorMedium            = "medium"
	TemplateFlavorLarge             = "large"
)

Template labels

View Source
const (
	ArchLinux   = "arch"
	CentOS      = "centos"
	Debian      = "debian"
	Fedora      = "fedora"
	FreeBSD     = "freebsd"
	Gentoo      = "gentoo"
	Mandrake    = "mandrake"
	Mandriva    = "mandriva"
	MES         = "mes"
	MSDOS       = "msdos"
	NetBSD      = "netbsd"
	Netware     = "netware"
	OpenBSD     = "openbsd"
	OpenSolaris = "opensolaris"
	OpenSUSE    = "opensuse"
	RHEL        = "rhel"
	SLED        = "sled"
	Ubuntu      = "ubuntu"
	Windows     = "windows"
)

OS Distros

View Source
const (
	DefaultWindows = "win10"
	DefaultLinux   = "rhel8.1"
	UnknownOS      = "unknown"
)

Default Operating Systems

View Source
const (
	SecureBootRequired = "required"
	SecureBootDisabled = "disabled"
	SecureBootOptional = "optional"
)

Secure boot options

View Source
const (
	BIOS = "bios"
	EFI  = "uefi"
)

Firmware types

View Source
const (
	CpuPolicyDedicated = "dedicated"
	CpuPolicyShared    = "shared"
)

CPU Policies

View Source
const (
	CpuThreadPolicyPrefer  = "prefer"
	CpuThreadPolicyIsolate = "isolate"
	CpuThreadPolicyRequire = "require"
)

CPU Thread policies

View Source
const (
	ScsiBus   = "scsi"
	VirtioBus = "virtio"
	SataBus   = "sata"
	UmlBus    = "uml"
	XenBus    = "xen"
	IdeBus    = "ide"
	UsbBus    = "usb"
	LxcBus    = "lxc"
)

Bus types

View Source
const (
	Tablet    = "tablet"
	UsbTablet = "usbtablet"
)

Input types

View Source
const (
	VideoVga    = "vga"
	VideoVirtio = "virtio"
	VideoCirrus = "cirrus"
	VideoVmVga  = "vmvga"
	VideoXen    = "xen"
	VideoQxl    = "qxl"
	VideoGop    = "gop"
	VideoNONE   = "none"
	VideoBochs  = "bochs"
)

Video models

View Source
const (
	// KVM/Xen/VMWare
	VifModelE1000 = "e1000"
	// KVM/VMWare
	VifModelE1000e = "e1000e"
	// KVM/Xen
	VifModelNe2kpci = "ne2k_pci"
	VifModelPcnet   = "pcnet"
	VifModelRtl8139 = "rtl8139"
	// KVM
	VifModelVmxnet3 = "vmxnet3"
	VifModelVirtio  = "virtio"
	// VMWare
	VifModelVirtualE1000   = "VirtualE1000"
	VifModelVirtualE1000e  = "VirtualE1000e"
	VifModelVirtualPcnet32 = "VirtualPCNet32"
	VifModelVirtualVmxnet  = "VirtualVmxnet"
	VifModelVirtualVmxnet3 = "VirtualVmxnet3"
	//Xen
	VifModelNetfront = "netfront"
)

Vif models

View Source
const (
	AMI   = "ami"
	ARI   = "ari"
	AKI   = "aki"
	VHD   = "vhd"
	VHDX  = "vhdx"
	VMDK  = "vmdk"
	RAW   = "raw"
	QCOW2 = "qcow2"
	VDI   = "vdi"
	PLOOP = "ploop"
	ISO   = "iso"
)

Disk Formats

View Source
const (
	Architecture         = "architecture"
	HypervisorType       = "hypervisor_type"
	CpuPolicy            = "hw_cpu_policy"
	CpuThreadPolicy      = "hw_cpu_thread_policy"
	CpuCores             = "hw_cpu_cores"
	CpuSockets           = "hw_cpu_sockets"
	CpuThreads           = "hw_cpu_threads"
	FirmwareType         = "hw_firmware_type"
	CdromBus             = "hw_cdrom_bus"
	PointerModel         = "hw_pointer_model"
	VideoModel           = "hw_video_model"
	DiskBus              = "hw_disk_bus"
	VifModel             = "hw_vif_model"
	OsType               = "os_type"
	OsDistro             = "os_distro"
	OsVersion            = "os_version"
	OsSecureBoot         = "os_secure_boot"
	HwVideoRam           = "hw_video_ram"
	HwRngModel           = "hw_rng_model"
	VifMultiQueueEnabled = "hw_vif_multiqueue_enabled"
)

Image Properties

View Source
const (
	FlavorSecureBoot           = "os:secure_boot"
	FlavorCpuPolicy            = "hw:cpu_policy"
	FlavorCpuThreadPolicy      = "hw:cpu_thread_policy"
	FlavorEmulatorThreadPolicy = "hw:emulator_threads_policy"
	FlavorCpuCores             = "hw:cpu_cores"
	FlavorCpuSockets           = "hw:cpu_sockets"
	FlavorCpuThreads           = "hw:cpu_threads"
	FlavorMaxCpuCores          = "hw:max_cpu_cores"
	FlavorMaxCpuSockets        = "hw:max_cpu_sockets"
	FlavorMaxCpuThreads        = "hw:max_cpu_threads"
	FlavorVifMultiQueueEnabled = "hw:vif_multiqueue_enabled"
	FlavorHwRng                = "hw_rng:allowed"
	FlavorHwVideoRam           = "hw_video:ram_max_mb"
)

Flavor ExtraSpecs

View Source
const (
	Pod     = "pod"
	Multus  = "multus"
	Ignored = "ignored"
)

Network types

View Source
const (
	ImageStatusActive    = libclient.ImageStatusActive
	ImageStatusImporting = libclient.ImageStatusImporting
	ImageStatusQueued    = libclient.ImageStatusQueued
	ImageStatusSaving    = libclient.ImageStatusSaving
	ImageStatusUploading = libclient.ImageStatusUploading

	SnapshotStatusAvailable = libclient.SnapshotStatusAvailable
	SnapshotStatusCreating  = libclient.SnapshotStatusCreating
	SnapshotStatusDeleting  = libclient.SnapshotStatusDeleting
	SnapshotStatusDeleted   = libclient.SnapshotStatusDeleted

	VolumeStatusAvailable = libclient.VolumeStatusAvailable
	VolumeStatusInUse     = libclient.VolumeStatusInUse
	VolumeStatusCreating  = libclient.VolumeStatusCreating
	VolumeStatusDeleting  = libclient.VolumeStatusDeleting
	VolumeStatusUploading = libclient.VolumeStatusUploading
)
View Source
const (
	HwRngModelVirtio = "virtio"
)

HW RNG models

View Source
const (
	Linux = "linux"
)

OS types

Variables

Default properties

View Source
var NameOrIDRequiredError = errors.New("id or name is required")
View Source
var ResourceNotFoundError = errors.New("resource not found")
View Source
var UnexpectedVolumeStatusError = errors.New("unexpected volume status")

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

Openstack adapter.

func (*Adapter) Builder

func (r *Adapter) Builder(ctx *plancontext.Context) (builder base.Builder, err error)

Constructs a openstack builder.

func (*Adapter) Client

func (r *Adapter) Client(ctx *plancontext.Context) (client base.Client, err error)

Constructs an openstack client.

func (*Adapter) DestinationClient

func (r *Adapter) DestinationClient(ctx *plancontext.Context) (destinationClient base.DestinationClient, err error)

Constucts a destination client.

func (*Adapter) Ensurer

func (r *Adapter) Ensurer(ctx *plancontext.Context) (ensure base.Ensurer, err error)

Constructs a ensurer.

func (*Adapter) Validator

func (r *Adapter) Validator(ctx *plancontext.Context) (validator base.Validator, err error)

Constructs a openstack validator.

type Builder

type Builder struct {
	*plancontext.Context
}

Openstack builder.

func (*Builder) ConfigMap

func (r *Builder) ConfigMap(_ ref.Ref, in *core.Secret, object *core.ConfigMap) (err error)

Create DataVolume certificate configmap.

func (*Builder) ConfigMaps

func (r *Builder) ConfigMaps(vmRef ref.Ref) (list []core.ConfigMap, err error)

func (*Builder) ConversionPodConfig

func (r *Builder) ConversionPodConfig(_ ref.Ref) (*planbase.ConversionPodConfigResult, error)

ConversionPodConfig returns provider-specific configuration for the virt-v2v conversion pod. OpenStack provider does not require any special configuration.

func (*Builder) DataVolumes

func (r *Builder) DataVolumes(vmRef ref.Ref, secret *core.Secret, configMap *core.ConfigMap, dvTemplate *cdi.DataVolume, vddkConfigMap *core.ConfigMap) (dvs []cdi.DataVolume, err error)

func (*Builder) GetPopulatorTaskName

func (r *Builder) GetPopulatorTaskName(pvc *core.PersistentVolumeClaim) (taskName string, err error)

func (*Builder) LunPersistentVolumeClaims

func (r *Builder) LunPersistentVolumeClaims(vmRef ref.Ref) (pvcs []core.PersistentVolumeClaim, err error)

Build LUN PVCs.

func (*Builder) LunPersistentVolumes

func (r *Builder) LunPersistentVolumes(vmRef ref.Ref) (pvs []core.PersistentVolume, err error)

Build LUN PVs.

func (*Builder) NetAppShiftPVCs

func (r *Builder) NetAppShiftPVCs(vmRef ref.Ref, labels map[string]string) ([]core.PersistentVolumeClaim, error)

func (*Builder) PodEnvironment

func (r *Builder) PodEnvironment(_ ref.Ref, _ *core.Secret) (env []core.EnvVar, err error)

func (*Builder) PopulatorTransferredBytes

func (r *Builder) PopulatorTransferredBytes(persistentVolumeClaim *core.PersistentVolumeClaim) (transferredBytes int64, err error)

func (*Builder) PopulatorVolumes

func (r *Builder) PopulatorVolumes(vmRef ref.Ref, annotations map[string]string, secretName string) (pvcs []*core.PersistentVolumeClaim, err error)

func (*Builder) PreferenceName

func (r *Builder) PreferenceName(vmRef ref.Ref, configMap *core.ConfigMap) (name string, err error)

func (*Builder) ResolveDataVolumeIdentifier

func (r *Builder) ResolveDataVolumeIdentifier(dv *cdi.DataVolume) string

Return a stable identifier for a DataVolume.

func (*Builder) ResolvePersistentVolumeClaimIdentifier

func (r *Builder) ResolvePersistentVolumeClaimIdentifier(pvc *core.PersistentVolumeClaim) string

Return a stable identifier for a PersistentDataVolume

func (*Builder) Secret

func (r *Builder) Secret(_ ref.Ref, in, secret *core.Secret) (err error)

Build credential secret.

func (*Builder) Secrets

func (r *Builder) Secrets(vmRef ref.Ref) (list []core.Secret, err error)

func (*Builder) SetPopulatorDataSourceLabels

func (r *Builder) SetPopulatorDataSourceLabels(vmRef ref.Ref, pvcs []*core.PersistentVolumeClaim) (err error)

func (*Builder) SourceVMLabelsAndAnnotations

func (r *Builder) SourceVMLabelsAndAnnotations(vmRef ref.Ref, tagMapping *api.TagMapping) (labels map[string]string, annotations map[string]string, sanitizationReport map[string]string, err error)

func (*Builder) SupportsVolumePopulators

func (r *Builder) SupportsVolumePopulators() bool

func (*Builder) Tasks

func (r *Builder) Tasks(vmRef ref.Ref) (tasks []*plan.Task, err error)

Build tasks.

func (*Builder) TemplateLabels

func (r *Builder) TemplateLabels(vmRef ref.Ref) (labels map[string]string, err error)

Build tasks.

func (*Builder) VirtualMachine

func (r *Builder) VirtualMachine(vmRef ref.Ref, vmSpec *cnv.VirtualMachineSpec, persistentVolumeClaims []*core.PersistentVolumeClaim, usesInstanceType bool, sortVolumesByLibvirt bool) (err error)

Create the destination Kubevirt VM.

type Client

type Client struct {
	libclient.Client
	Context *plancontext.Context
}

func (*Client) CheckSnapshotReady

func (r *Client) CheckSnapshotReady(vmRef ref.Ref, precopy planapi.Precopy, hosts util.HostsFunc) (ready bool, snapshotId string, err error)

Check if a snapshot is ready to transfer.

func (*Client) CheckSnapshotRemove

func (r *Client) CheckSnapshotRemove(vmRef ref.Ref, precopy planapi.Precopy, hosts util.HostsFunc) (bool, error)

CheckSnapshotRemove implements base.Client

func (*Client) Close

func (r *Client) Close()

Close connections to the provider API.

func (*Client) CreateSnapshot

func (r *Client) CreateSnapshot(vmRef ref.Ref, hostsFunc util.HostsFunc) (snapshotId string, creationTaskId string, err error)

Create a snapshot of the source VM.

func (*Client) DetachDisks

func (r *Client) DetachDisks(vmRef ref.Ref) (err error)

func (*Client) Finalize

func (r *Client) Finalize(vmStatuses []*planapi.VMStatus, migrationName string)

func (*Client) GetSnapshotDeltas

func (r *Client) GetSnapshotDeltas(vmRef ref.Ref, snapshot string, hostsFunc util.HostsFunc) (s map[string]string, err error)

Get disk deltas for a VM snapshot. No-op for this provider.

func (*Client) PowerOff

func (r *Client) PowerOff(vmRef ref.Ref) (err error)

Power off the source VM.

func (*Client) PowerOn

func (r *Client) PowerOn(vmRef ref.Ref) (err error)

Power on the source VM.

func (*Client) PowerState

func (r *Client) PowerState(vmRef ref.Ref) (state planapi.VMPowerState, err error)

Return the source VM's power state.

func (*Client) PoweredOff

func (r *Client) PoweredOff(vmRef ref.Ref) (off bool, err error)

Return whether the source VM is powered off.

func (*Client) PreTransferActions

func (r *Client) PreTransferActions(vmRef ref.Ref) (ready bool, err error)

func (*Client) RemoveSnapshot

func (r *Client) RemoveSnapshot(vmRef ref.Ref, snapshot string, hostsFunc util.HostsFunc) (removeTaskId string, err error)

Remove a VM snapshot. No-op for this provider.

func (*Client) SetCheckpoints

func (r *Client) SetCheckpoints(vmRef ref.Ref, precopies []planapi.Precopy, datavolumes []cdi.DataVolume, final bool, hostsFunc util.HostsFunc) error

Set DataVolume checkpoints.

type DestinationClient

type DestinationClient struct {
	*plancontext.Context
}

func (*DestinationClient) DeleteObject

func (r *DestinationClient) DeleteObject(object client.Object, vm *plan.VMStatus, message, objType string) (err error)

Deletes an object from destination cluster associated with the VM.

func (*DestinationClient) DeletePopulatorDataSource

func (r *DestinationClient) DeletePopulatorDataSource(vm *plan.VMStatus) error

Delete OpenstackVolumePopulator CustomResource list.

func (*DestinationClient) SetPopulatorCrOwnership

func (r *DestinationClient) SetPopulatorCrOwnership() (err error)

Set the OpenstackVolumePopulator CustomResource Ownership.

type Validator

type Validator struct {
	*plancontext.Context
}

Validator

func (*Validator) ChangeTrackingEnabled

func (r *Validator) ChangeTrackingEnabled(vmRef ref.Ref) (bool, error)

NO-OP

func (*Validator) DirectStorage

func (r *Validator) DirectStorage(vmRef ref.Ref) (bool, error)

NO-OP

func (*Validator) GuestToolsInstalled

func (r *Validator) GuestToolsInstalled(vmRef ref.Ref) (ok bool, err error)

NO-OP

func (*Validator) HasSnapshot

func (r *Validator) HasSnapshot(vmRef ref.Ref) (ok bool, msg string, category string, err error)

HasSnapshot - OpenStack doesn't support warm migration, so no snapshot validation needed

func (*Validator) InvalidDiskSizes

func (r *Validator) InvalidDiskSizes(vmRef ref.Ref) ([]string, error)

func (*Validator) MacConflicts

func (r *Validator) MacConflicts(vmRef ref.Ref) ([]planbase.MacConflict, error)

func (*Validator) MaintenanceMode

func (r *Validator) MaintenanceMode(vmRef ref.Ref) (ok bool, err error)

Validate that a VM's Host isn't in maintenance mode.

func (*Validator) MigrationType

func (r *Validator) MigrationType() bool

MigrationType indicates whether the plan's migration type is supported by this provider.

func (*Validator) NICNetworkRefs

func (r *Validator) NICNetworkRefs(vmRef ref.Ref) (refs []ref.Ref, err error)

NICNetworkRefs returns one source-network ref per VM network attachment.

func (*Validator) NetworksMapped

func (r *Validator) NetworksMapped(vmRef ref.Ref) (ok bool, err error)

Validate that a VM's networks have been mapped.

func (*Validator) PVCNameTemplate

func (r *Validator) PVCNameTemplate(vmRef ref.Ref, pvcNameTemplate string) (ok bool, err error)

NO-OP

func (*Validator) PowerState

func (r *Validator) PowerState(vmRef ref.Ref) (ok bool, err error)

func (*Validator) SharedDisks

func (r *Validator) SharedDisks(vmRef ref.Ref, client client.Client) (ok bool, s string, s2 string, err error)

func (*Validator) StaticIPs

func (r *Validator) StaticIPs(vmRef ref.Ref) (bool, error)

NO-OP

func (*Validator) StorageMapped

func (r *Validator) StorageMapped(vmRef ref.Ref) (ok bool, err error)

func (*Validator) UdnStaticIPs

func (r *Validator) UdnStaticIPs(vmRef ref.Ref, client client.Client) (ok bool, err error)

NO-OP

func (*Validator) VMMigrationType

func (r *Validator) VMMigrationType(vmRef ref.Ref) (ok bool, err error)

func (*Validator) WarmMigration

func (r *Validator) WarmMigration() (ok bool)

Validate whether warm migration is supported from this provider type.

Jump to

Keyboard shortcuts

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