Documentation ¶
Index ¶
- Constants
- Variables
- type BootManager
- type GuestOS
- type LinuxConfigManager
- type MemoryBackingType
- type MemoryConfig
- type MemoryManager
- type NetworkManager
- type PCIManager
- type Plan9Manager
- type ProcessorManager
- type Resource
- type ResourceOperation
- type SCSIDiskType
- type SCSIManager
- type SerialManager
- type StorageQosManager
- type UVM
- type UVMBuilder
- type VMSocketManager
- type VMSocketType
- type VPMemImageFormat
- type VPMemManager
- type VSMBManager
- type VSMBOptions
- type WindowsConfigManager
Constants ¶
const ( HCS = "hcs" RemoteVM = "remotevm" )
const ( VPMem = iota SCSI Network VSMB PCI Plan9 Memory Processor CPUGroup )
Variables ¶
var ( ErrNotSupported = errors.New("virtstack does not support the operation") ErrAlreadySet = errors.New("field has already been set") ErrUnsupportedGuestOS = errors.New("virtstack does not support the guest operating system") ErrUnknownGuestOS = errors.New("unknown guest operating system supplied") )
Functions ¶
This section is empty.
Types ¶
type BootManager ¶
type BootManager interface { // SetUEFIBoot sets UEFI configurations for booting a Utility VM. SetUEFIBoot(dir string, path string, args string) error // SetLinuxKernelDirectBoot sets Linux direct boot configurations for booting a Utility VM. SetLinuxKernelDirectBoot(kernel string, initRD string, cmd string) error }
BootManager manages boot configurations for the Utility VM.
type GuestOS ¶
type GuestOS string
GuestOS signifies the guest operating system that a Utility VM will be running.
type LinuxConfigManager ¶
type LinuxConfigManager interface{}
LinuxConfigManager manages options specific to a Linux host.
type MemoryBackingType ¶
type MemoryBackingType uint8
const ( MemoryBackingTypeVirtual MemoryBackingType = iota MemoryBackingTypePhysical )
type MemoryConfig ¶
type MemoryConfig struct { BackingType MemoryBackingType DeferredCommit bool HotHint bool ColdHint bool ColdDiscardHint bool }
MemoryConfig holds the memory options that should be configurable for a Utility VM.
type MemoryManager ¶
type MemoryManager interface { // SetMemoryLimit sets the amount of memory in megabytes that the Utility VM will be assigned. SetMemoryLimit(memoryMB uint64) error // SetMemoryConfig sets an array of different memory configuration options available. This includes things like the // type of memory to back the VM (virtual/physical). SetMemoryConfig(config *MemoryConfig) error // SetMMIOConfig sets memory mapped IO configurations for the Utility VM. SetMMIOConfig(lowGapMB uint64, highBaseMB uint64, highGapMB uint64) error }
MemoryManager handles setting and managing memory configurations for the Utility VM.
type NetworkManager ¶
type NetworkManager interface { // AddNIC adds a network adapter to the Utility VM. `nicID` should be a string representation of a // Windows GUID. AddNIC(ctx context.Context, nicID string, endpointID string, macAddr string) error // RemoveNIC removes a network adapter from the Utility VM. `nicID` should be a string representation of a // Windows GUID. RemoveNIC(ctx context.Context, nicID string, endpointID string, macAddr string) error }
NetworkManager manages adding and removing network adapters for a Utility VM.
type PCIManager ¶
type PCIManager interface { // AddDevice adds the pci device identified by `instanceID` to the Utility VM. // https://docs.microsoft.com/en-us/windows-hardware/drivers/install/instance-ids AddDevice(ctx context.Context, instanceID string, vmbusGUID string) error // RemoveDevice removes the pci device identified by `instanceID` from the Utility VM. RemoveDevice(ctx context.Context, instanceID string, vmbusGUID string) error }
PCIManager manages assiging pci devices to a Utility VM. This is Windows specific at the moment.
type Plan9Manager ¶
type Plan9Manager interface { // AddPlan9 adds a plan 9 share to a running Utility VM. AddPlan9(ctx context.Context, path, name string, port int32, flags int32, allowed []string) error // RemovePlan9 removes a plan 9 share from a running Utility VM. RemovePlan9(ctx context.Context, name string, port int32) error }
Plan9Manager manages adding plan 9 shares to a Utility VM.
type ProcessorManager ¶
type ProcessorManager interface { // SetProcessorCount sets the number of virtual processors that will be assigned to the Utility VM. SetProcessorCount(count uint32) error }
ProcessorManager handles setting and managing processor configurations for the Utility VM.
type ResourceOperation ¶
type ResourceOperation uint8
Operation refers to the type of operation to perform on a given resource.
const ( Add ResourceOperation = iota Remove Update )
type SCSIDiskType ¶
type SCSIDiskType uint8
SCSIDiskType refers to the disk type of the scsi device. This is either a vhd, vhdx, or a physical disk.
const ( SCSIDiskTypeVHD1 SCSIDiskType = iota SCSIDiskTypeVHDX SCSIDiskTypePassThrough )
type SCSIManager ¶
type SCSIManager interface { // AddSCSIController adds a SCSI controller to the Utility VM configuration document. AddSCSIController(id uint32) error // AddSCSIDisk adds a SCSI disk to the configuration document if in a precreated state, or hot adds a // SCSI disk to the Utility VM if the VM is running. AddSCSIDisk(ctx context.Context, controller uint32, lun uint32, path string, typ SCSIDiskType, readOnly bool) error // RemoveSCSIDisk removes a SCSI disk from a Utility VM. RemoveSCSIDisk(ctx context.Context, controller uint32, lun uint32, path string) error }
SCSIManager manages adding and removing SCSI devices for a Utility VM.
type SerialManager ¶
type SerialManager interface { // SetSerialConsole sets up a serial console for `port`. Output will be relayed to the listener specified // by `listenerPath`. For HCS `listenerPath` this is expected to be a path to a named pipe. SetSerialConsole(port uint32, listenerPath string) error }
SerialManager manages setting up serial consoles for the Utility VM.
type StorageQosManager ¶
type StorageQosManager interface { // SetStorageQos sets storage related options for the Utility VM SetStorageQos(iopsMaximum int64, bandwidthMaximum int64) error }
StorageQosManager manages setting storage limits on the Utility VM.
type UVM ¶
type UVM interface { // ID will return a string identifier for the Utility VM. ID() string // Start will power on the Utility VM and put it into a running state. This will boot the guest OS and start all of the // devices configured on the machine. Start(ctx context.Context) error // Stop will shutdown the Utility VM and place it into a terminated state. Stop(ctx context.Context) error // Pause will place the Utility VM into a paused state. The guest OS will be halted and any devices will have be in a // a suspended state. Save can be used to snapshot the current state of the virtual machine, and Resume can be used to // place the virtual machine back into a running state. Pause(ctx context.Context) error // Resume will put a previously paused Utility VM back into a running state. The guest OS will resume operation from the point // in time it was paused and all devices should be un-suspended. Resume(ctx context.Context) error // Save will snapshot the state of the Utility VM at the point in time when the VM was paused. Save(ctx context.Context) error // Wait synchronously waits for the Utility VM to shutdown or terminate. A call to stop will trigger this // to unblock. Wait() error // Stats returns statistics about the Utility VM. This includes things like assigned memory, available memory, // processor runtime etc. Stats(ctx context.Context) (*stats.VirtualMachineStatistics, error) // Supported returns if the virt stack supports a given operation on a resource. Supported(resource Resource, operation ResourceOperation) bool // ExitError will return any error if the Utility VM exited unexpectedly, or if the Utility VM experienced an // error after Wait returned, it will return the wait error. ExitError() error }
UVM is an abstraction around a lightweight virtual machine. It houses core lifecycle methods such as Create Start, and Stop and also several optional nested interfaces that can be used to determine what the virtual machine supports and to configure these resources.
type UVMBuilder ¶
type VMSocketManager ¶
type VMSocketManager interface { // VMSocketListen will create the requested vmsocket type and listen on the address specified by `connID`. // For HvSocket the type expected is a GUID, for Vsock it's a port of type uint32. VMSocketListen(ctx context.Context, socketType VMSocketType, connID interface{}) (net.Listener, error) }
VMSocketManager manages configuration for a hypervisor socket transport. This includes sockets such as HvSocket and Vsock.
type VMSocketType ¶
type VMSocketType uint8
VMSocketType refers to which hypervisor socket transport type to use.
const ( HvSocket VMSocketType = iota VSock )
type VPMemImageFormat ¶
type VPMemImageFormat uint8
VPMemImageFormat refers to the image type of the vpmem block device. This is either a vhd or vhdx.
const ( VPMemImageFormatVHD1 VPMemImageFormat = iota VPMemImageFormatVHDX )
type VPMemManager ¶
type VPMemManager interface { // AddVPMemController adds a new virtual pmem controller to the Utility VM. // `maximumDevices` specifies how many vpmem devices will be present in the guest. // `maximumSizeBytes` specifies the maximum size allowed for a vpmem device. AddVPMemController(maximumDevices uint32, maximumSizeBytes uint64) error // AddVPMemDevice adds a virtual pmem device to the Utility VM. AddVPMemDevice(ctx context.Context, id uint32, path string, readOnly bool, imageFormat VPMemImageFormat) error // RemoveVpmemDevice removes a virtual pmem device from the Utility VM. RemoveVPMemDevice(ctx context.Context, id uint32, path string) error }
VPMemManager manages adding and removing virtual persistent memory devices for a Utility VM.
type VSMBManager ¶
type VSMBManager interface { // AddVSMB adds a virtual smb share to a running Utility VM. AddVSMB(ctx context.Context, hostPath string, name string, allowedFiles []string, options *VSMBOptions) error // RemoveVSMB removes a virtual smb share from a running Utility VM. RemoveVSMB(ctx context.Context, name string) error }
VSMBManager manages adding virtual smb shares to a Utility VM.