Documentation
¶
Index ¶
- Constants
- func AddVirtualMachineHardDiskDrive(vmName string, path string, hdController string, setBootDev bool) error
- func AddVirtualMachineNetworkAdapter(vmName string, vmSwitch string) error
- func ConnectVirtualMachineNetworkAdapterToSwitch(vmName string, switchName string) error
- func CreateExternalVirtualSwitch(switchName string) error
- func CreateVirtualMachine(vmName string, path string, ram int64, diskSize int64, switchName string, ...) error
- func CreateVirtualMachineWithNoHD(vmName string, ram int64, generation uint) error
- func CreateVirtualSwitch(switchName string, switchType string) (bool, error)
- func DeleteVirtualMachine(vmName string) error
- func DeleteVirtualSwitch(switchName string) error
- func GetExternalOnlineVirtualSwitch() (string, error)
- func GetVirtualMachineByName(vmName string) (string, error)
- func GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error)
- func GetVirtualMachineSwitchName(vmName string) (string, error)
- func GetVirtualMachines() (string, error)
- func IPAddress(mac string) (string, error)
- func IsOff(vmName string) (bool, error)
- func IsPowershellAvailable() (bool, string, error)
- func IsRunning(vmName string) (bool, error)
- func Mac(vmName string) (string, error)
- func RestartVirtualMachine(vmName string) error
- func SetVMComPort(vmName string) error
- func SetVMSecureBoot(vmName string, enable bool) error
- func ShutDown(vmName string) error
- func StartVirtualMachine(vmName string) error
- func StopVirtualMachine(vmName string) error
- func TurnOff(vmName string) error
- func Uptime(vmName string) (uint64, error)
- type PowerShellCmd
- type Provider
- func (p *Provider) AttachVolume(ctx *lepton.Context, image, name string, attachID int) error
- func (p *Provider) BuildImage(ctx *lepton.Context) (string, error)
- func (p *Provider) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)
- func (p *Provider) CreateImage(ctx *lepton.Context, imagePath string) error
- func (p *Provider) CreateInstance(ctx *lepton.Context) error
- func (p *Provider) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
- func (p *Provider) CustomizeImage(ctx *lepton.Context) (string, error)
- func (p *Provider) DeleteImage(ctx *lepton.Context, imagename string) error
- func (p *Provider) DeleteInstance(ctx *lepton.Context, instancename string) error
- func (p *Provider) DeleteVolume(ctx *lepton.Context, name string) error
- func (p *Provider) DetachVolume(ctx *lepton.Context, image, name string) error
- func (p *Provider) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)
- func (p *Provider) GetImages(ctx *lepton.Context, filter string) (images []lepton.CloudImage, err error)
- func (p *Provider) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)
- func (p *Provider) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)
- func (p *Provider) GetInstances(ctx *lepton.Context) (instances []lepton.CloudInstance, err error)
- func (p *Provider) Initialize(c *types.ProviderConfig) error
- func (p *Provider) InstanceStats(ctx *lepton.Context, instancename string, watch bool) error
- func (p *Provider) ListImages(ctx *lepton.Context, filter string) error
- func (p *Provider) ListInstances(ctx *lepton.Context) error
- func (p *Provider) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error
- func (p *Provider) RebootInstance(ctx *lepton.Context, instanceName string) error
- func (p *Provider) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error
- func (p *Provider) StartInstance(ctx *lepton.Context, instancename string) error
- func (p *Provider) StopInstance(ctx *lepton.Context, instancename string) error
- func (p *Provider) SyncImage(config *types.Config, target lepton.Provider, imagename string) error
Constants ¶
const ProviderName = "hyper-v"
ProviderName of the cloud platform provider
Variables ¶
This section is empty.
Functions ¶
func AddVirtualMachineHardDiskDrive ¶
func AddVirtualMachineHardDiskDrive(vmName string, path string, hdController string, setBootDev bool) error
AddVirtualMachineHardDiskDrive adds virtual hard disk (vhdx) in path to virtual machine Due to issues on using vhdx files located inside WSL it copies the image to a user directory located at `~/vhdx-images` before attaching to the virtual machine. See more details on https://github.com/MicrosoftDocs/windows-powershell-docs/issues/2286
func AddVirtualMachineNetworkAdapter ¶
AddVirtualMachineNetworkAdapter creates a virtual machine network adapter that connects to a switch
func ConnectVirtualMachineNetworkAdapterToSwitch ¶
ConnectVirtualMachineNetworkAdapterToSwitch connects current virtual machine network adapter to switch
func CreateExternalVirtualSwitch ¶
CreateExternalVirtualSwitch creates an external virtual switch connected to a physical network adapter
func CreateVirtualMachine ¶
func CreateVirtualMachine(vmName string, path string, ram int64, diskSize int64, switchName string, generation uint) error
CreateVirtualMachine creates a virtual machine
func CreateVirtualMachineWithNoHD ¶
CreateVirtualMachineWithNoHD creates a virtual machine without disks attached. The image disk is attached after using 'AddVirtualMachineHardDiskDrive'
func CreateVirtualSwitch ¶
CreateVirtualSwitch creates a virtual switch
func DeleteVirtualMachine ¶
DeleteVirtualMachine deletes a virtual machine
func DeleteVirtualSwitch ¶
DeleteVirtualSwitch deletes a virtual switch
func GetExternalOnlineVirtualSwitch ¶
GetExternalOnlineVirtualSwitch returns an online external virtual switch name
func GetVirtualMachineByName ¶
GetVirtualMachineByName returns a virtual machine details
func GetVirtualMachineNetworkAdapterAddress ¶
GetVirtualMachineNetworkAdapterAddress returns a virtual machine ip address
func GetVirtualMachineSwitchName ¶
GetVirtualMachineSwitchName returns the name of the switch connected to a virtual machine
func GetVirtualMachines ¶
GetVirtualMachines returns the list of virtual machines
func IsPowershellAvailable ¶
IsPowershellAvailable checks whether powershell executable exists in os
func RestartVirtualMachine ¶
RestartVirtualMachine restarts a virtual machine
func SetVMComPort ¶
SetVMComPort sets com port with a named pipe with the same name of the vm
func SetVMSecureBoot ¶
SetVMSecureBoot enables or disables secure boot on a VM
func StartVirtualMachine ¶
StartVirtualMachine starts a virtual machine
func StopVirtualMachine ¶
StopVirtualMachine stops a virtual machine
Types ¶
type PowerShellCmd ¶
PowerShellCmd executes powershell commands
type Provider ¶
type Provider struct{}
Provider to interact with Hyper-V cloud infrastructure
func (*Provider) AttachVolume ¶
AttachVolume is a stub
func (*Provider) BuildImage ¶
BuildImage creates and converts a raw image to vhdx
func (*Provider) BuildImageWithPackage ¶
BuildImageWithPackage creates and converts a raw image to vhdx using package image
func (*Provider) CreateImage ¶
CreateImage is a stub
func (*Provider) CreateInstance ¶
CreateInstance uses a vhdx image to launch a virtual machine in hyper-v
func (*Provider) CreateVolume ¶
func (p *Provider) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
CreateVolume is a stub
func (*Provider) CustomizeImage ¶
CustomizeImage is a stub
func (*Provider) DeleteImage ¶
DeleteImage removes hyper-v image
func (*Provider) DeleteInstance ¶
DeleteInstance removes virtual machine
func (*Provider) DeleteVolume ¶
DeleteVolume is a stub
func (*Provider) DetachVolume ¶
DetachVolume is a stub
func (*Provider) GetAllVolumes ¶
GetAllVolumes is a stub
func (*Provider) GetImages ¶
func (p *Provider) GetImages(ctx *lepton.Context, filter string) (images []lepton.CloudImage, err error)
GetImages returns the list of images available to run hyper-v virtual machines
func (*Provider) GetInstanceByName ¶
func (p *Provider) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)
GetInstanceByName returns hyper-v virtual machine with given name
func (*Provider) GetInstanceLogs ¶
GetInstanceLogs reads content from named pipe file
func (*Provider) GetInstances ¶
GetInstances returns the list of virtual machines managed by hyper-v
func (*Provider) Initialize ¶
func (p *Provider) Initialize(c *types.ProviderConfig) error
Initialize checks conditions to use hyper-v
func (*Provider) InstanceStats ¶
InstanceStats show metrics for instances on hyperv
func (*Provider) ListImages ¶
ListImages prints hyper-v images in table format
func (*Provider) ListInstances ¶
ListInstances prints virtual machines list managed by hyper-v in table
func (*Provider) PrintInstanceLogs ¶
PrintInstanceLogs prints vm logs content on console
func (*Provider) RebootInstance ¶
RebootInstance reboots the instance.
func (*Provider) ResizeImage ¶
ResizeImage is a stub
func (*Provider) StartInstance ¶
StartInstance initiates virtual machine in hyper-v
func (*Provider) StopInstance ¶
StopInstance stops virtual machine in hyper-v