hypervctl

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	ErrShutdownFailed           = 32768
	ErrShutdownAccessDenied     = 32769
	ErrShutdownNotSupported     = 32770
	ErrShutdownStatusUnkown     = 32771
	ErrShutdownTimeout          = 32772
	ErrShutdownInvalidParameter = 32773
	ErrShutdownSystemInUse      = 32774
	ErrShutdownInvalidState     = 32775
	ErrShutdownIncorrectData    = 32776
	ErrShutdownNotAvailable     = 32777
	ErrShutdownOutOfMemory      = 32778
	ErrShutdownFileNotFound     = 32779
	ErrShutdownNotReady         = 32780
	ErrShutdownMachineLocked    = 32781
	ErrShutdownInProgress       = 32782
)

Shutdown operation error codes

View Source
const (
	ErrModifyResourceNotSupported     = 1
	ErrModifyResourceFailed           = 2
	ErrModifyResourceTimeout          = 3
	ErrModifyResourceInvalidParameter = 4
	ErrModifyResourceInvalidState     = 5
	ErrModifyResourceIncompatParam    = 6
)

Modify resource errors

View Source
const (
	KvpOperationFailed    = 32768
	KvpAccessDenied       = 32769
	KvpNotSupported       = 32770
	KvpStatusUnknown      = 32771
	KvpTimeoutOccurred    = 32772
	KvpIllegalArgument    = 32773
	KvpSystemInUse        = 32774
	KvpInvalidState       = 32775
	KvpIncorrectDataType  = 32776
	KvpSystemNotAvailable = 32777
	KvpOutOfMemory        = 32778
	KvpNotFound           = 32779

	KvpExchangeDataItemName = "Msvm_KvpExchangeDataItem"
	MemorySettingDataName   = "Msvm_MemorySettingData"
)
View Source
const (
	SummaryRequestName                             = 0
	SummaryRequestElementName                      = 1
	SummaryRequestCreationTime                     = 2
	SummaryRequestNotes                            = 3
	SummaryRequestProcessors                       = 4
	SummaryRequestSmallThumbnail                   = 5
	SummaryRequestMediumThumbnail                  = 6
	SummaryRequestLargeThumbnail                   = 7
	SummaryRequestAllocatedGPU                     = 8
	SummaryRequestVirtualSwitchNames               = 9
	SummaryRequestVersion                          = 10
	SummaryRequestShielded                         = 11
	SummaryRequestEnabledState                     = 100
	SummaryRequestProcessorLoad                    = 101
	SummaryRequestProcessorLoadHistory             = 102
	SummaryRequestMemoryUsage                      = 103
	SummaryRequestHeartbeat                        = 104
	SummaryRequestUptime                           = 105
	SummaryRequestGuestOperatingSystem             = 106
	SummaryRequestSnapshots                        = 107
	SummaryRequestAsynchronousTasks                = 108
	SummaryRequestHealthState                      = 109
	SummaryRequestOperationalStatus                = 110
	SummaryRequestStatusDescriptions               = 111
	SummaryRequestMemoryAvailable                  = 112
	SummaryRequestMemoryBuffer                     = 113
	SummaryRequestReplicationMode                  = 114
	SummaryRequestReplicationState                 = 115
	SummaryRequestReplicationHealth                = 116
	SummaryRequestApplicationHealth                = 117
	SummaryRequestReplicationStateEx               = 118
	SummaryRequestReplicationHealthEx              = 119
	SummaryRequestSwapFilesInUse                   = 120
	SummaryRequestIntegrationServicesVersionState  = 121
	SummaryRequestReplicationProvider              = 122
	SummaryRequestMemorySpansPhysicalNumaNodes     = 123
	SummaryRequestIntegrationServicesVersionState2 = 132
	SummaryRequestOtherEnabledState                = 132
)
View Source
const (
	HyperVNamespace                = "root\\virtualization\\v2"
	VirtualSystemManagementService = "Msvm_VirtualSystemManagementService"
)
View Source
const DefaultSwitchId = "C08CB7B8-9B3C-408E-8E30-5E16A3AEB444"
View Source
const EthernetPortAllocationResourceType = "Microsoft:Hyper-V:Ethernet Connection"
View Source
const MemoryResourceType = "Microsoft:Hyper-V:Memory"
View Source
const ProcessorResourceType = "Microsoft:Hyper-V:Processor"
View Source
const SyntheticDiskDriveType = "Microsoft:Hyper-V:Synthetic Disk Drive"
View Source
const SyntheticDvdDriveType = "Microsoft:Hyper-V:Synthetic DVD Drive"
View Source
const SyntheticEthernetPortResourceType = "Microsoft:Hyper-V:Synthetic Ethernet Port"
View Source
const VirtualDvdDiskType = "Microsoft:Hyper-V:Virtual CD/DVD Disk"
View Source
const VirtualHardDiskType = "Microsoft:Hyper-V:Virtual Hard Disk"

Variables

View Source
var (
	ErrMachineAlreadyRunning = errors.New("machine already running")
	ErrMachineNotRunning     = errors.New("machine not running")
	ErrMachineStateInvalid   = errors.New("machine in invalid state for action")
	ErrMachineStarting       = errors.New("machine is currently starting")
)

VM State errors

View Source
var (

	// SummaryRequestCommon includes a smaller subset of commonly used fields
	SummaryRequestCommon = SummaryRequestSet{
		SummaryRequestName,
		SummaryRequestElementName,
		SummaryRequestCreationTime,
		SummaryRequestNotes,
		SummaryRequestProcessors,
		SummaryRequestEnabledState,
		SummaryRequestProcessorLoad,
		SummaryRequestMemoryUsage,
		SummaryRequestHeartbeat,
		SummaryRequestUptime,
		SummaryRequestGuestOperatingSystem,
		SummaryRequestHealthState,
		SummaryRequestOperationalStatus,
		SummaryRequestStatusDescriptions,
		SummaryRequestMemoryAvailable,
		SummaryRequestMemoryBuffer,
		SummaryRequestSwapFilesInUse,
	}

	// SummaryRequestNearAll includes everything but load history and thumbnails
	SummaryRequestNearAll = SummaryRequestSet{
		SummaryRequestName,
		SummaryRequestElementName,
		SummaryRequestCreationTime,
		SummaryRequestNotes,
		SummaryRequestProcessors,
		SummaryRequestAllocatedGPU,
		SummaryRequestVirtualSwitchNames,
		SummaryRequestVersion,
		SummaryRequestShielded,
		SummaryRequestEnabledState,
		SummaryRequestProcessorLoad,
		SummaryRequestMemoryUsage,
		SummaryRequestHeartbeat,
		SummaryRequestUptime,
		SummaryRequestGuestOperatingSystem,
		SummaryRequestSnapshots,
		SummaryRequestAsynchronousTasks,
		SummaryRequestHealthState,
		SummaryRequestOperationalStatus,
		SummaryRequestStatusDescriptions,
		SummaryRequestMemoryAvailable,
		SummaryRequestMemoryBuffer,
		SummaryRequestReplicationMode,
		SummaryRequestReplicationState,
		SummaryRequestReplicationHealth,
		SummaryRequestApplicationHealth,
		SummaryRequestReplicationStateEx,
		SummaryRequestReplicationHealthEx,
		SummaryRequestSwapFilesInUse,
		SummaryRequestIntegrationServicesVersionState,
		SummaryRequestReplicationProvider,
		SummaryRequestMemorySpansPhysicalNumaNodes,
		SummaryRequestIntegrationServicesVersionState2,
		SummaryRequestOtherEnabledState,
	}
)
View Source
var (
	ErrMachineAlreadyExists = errors.New("machine already exists")
)

VM Creation errors

View Source
var (
	ErrNotImplemented = errors.New("function not implemented")
)

delete this when close to being done

Functions

This section is empty.

Types

type CimKvpItem

type CimKvpItem struct {
	Properties []CimKvpItemProperty `xml:"PROPERTY"`
}

type CimKvpItemProperty

type CimKvpItemProperty struct {
	Name  string `xml:"NAME,attr"`
	Value string `xml:"VALUE"`
}

type CimKvpItems

type CimKvpItems struct {
	Instances []CimKvpItem `xml:"INSTANCE"`
}

type ConcreteJob

type ConcreteJob struct {
	InstanceID              string
	Caption                 string
	Description             string
	ElementName             string
	InstallDate             time.Time
	Name                    string
	OperationalStatus       []uint16 // = { 2 }
	StatusDescriptions      []string // = { "OK" }
	Status                  string
	HealthState             uint16 // = 5
	CommunicationStatus     uint16
	DetailedStatus          uint16
	OperatingStatus         uint16
	PrimaryStatus           uint16
	JobStatus               string
	TimeSubmitted           time.Time
	ScheduledStartTime      time.Time
	StartTime               time.Time
	ElapsedTime             time.Duration
	JobRunTimes             uint32
	RunMonth                uint8
	RunDay                  int8
	RunDayOfWeek            int8
	RunStartInterval        time.Time
	LocalOrUtcTime          uint16
	UntilTime               time.Time
	Notify                  string
	Owner                   string
	Priority                uint32
	PercentComplete         uint16
	DeleteOnCompletion      bool
	ErrorCode               uint16
	ErrorDescription        string
	ErrorSummaryDescription string
	RecoveryAction          uint16
	OtherRecoveryAction     string
	JobState                uint16
	TimeOfLastStateChange   time.Time
	TimeBeforeRemoval       time.Duration // =
	Cancellable             bool
	JobType                 uint16
}

CIM_ConcreteJob https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/msvm-concretejob

type ControllerSettingsBuilder

type ControllerSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*ControllerSettingsBuilder) AddSyntheticDiskDrive

func (builder *ControllerSettingsBuilder) AddSyntheticDiskDrive(slot uint) *SyntheticDiskDriveSettingsBuilder

func (*ControllerSettingsBuilder) AddSyntheticDvdDrive

func (builder *ControllerSettingsBuilder) AddSyntheticDvdDrive(slot uint) *SyntheticDvdDriveSettingsBuilder

func (*ControllerSettingsBuilder) Finish

func (*ControllerSettingsBuilder) Get

type DestroySystemResult

type DestroySystemResult int32
const (
	VMDestroyCompletedwithNoError DestroySystemResult = 0
	VMDestroyNotSupported         DestroySystemResult = 1
	VMDestroyFailed               DestroySystemResult = 2
	VMDestroyTimeout              DestroySystemResult = 3
	VMDestroyInvalidParameter     DestroySystemResult = 4
	VMDestroyInvalidState         DestroySystemResult = 5
)

VM Destroy Exit Codes

func (DestroySystemResult) Reason

func (e DestroySystemResult) Reason() string

type DriveSettingsBuilder

type DriveSettingsBuilder struct {
	// contains filtered or unexported fields
}

func NewDriveSettingsBuilder

func NewDriveSettingsBuilder(systemSettings *SystemSettings) *DriveSettingsBuilder

func (*DriveSettingsBuilder) AddScsiController

func (builder *DriveSettingsBuilder) AddScsiController() *ControllerSettingsBuilder

func (*DriveSettingsBuilder) Complete

func (builder *DriveSettingsBuilder) Complete() error

type EnabledState

type EnabledState uint16
const (
	// Unknown The state of the element could not be determined.
	Unknown EnabledState = 0
	// Other No description
	Other EnabledState = 1
	// Enabled The element is running.
	Enabled EnabledState = 2
	// Disabled The element is turned off.
	Disabled EnabledState = 3
	// ShuttingDown Shutting_Down The element is in the process of going to a Disabled state.
	ShuttingDown EnabledState = 4
	// NotApplicable The element does not support being enabled or disabled.
	NotApplicable EnabledState = 5
	// EnabledButOffline The element might be completing commands, and it will drop any new requests.
	EnabledButOffline EnabledState = 6
	// InTest The element is in a test state.
	InTest EnabledState = 7
	// Deferred The element might be completing commands, but it will queue any new requests.
	Deferred EnabledState = 8
	// Quiesce The element is enabled but in a restricted mode. The behavior of the element is similar to the Enabled state
	//(2), but it processes only a restricted set of commands. All other requests are queued.
	Quiesce EnabledState = 9
	// Starting The element is in the process of going to an Enabled state (2). New requests are queued.
	Starting EnabledState = 10
)

func (EnabledState) String

func (es EnabledState) String() string

type EthernetPortAllocationSettings

type EthernetPortAllocationSettings struct {
	InstanceID              string // = "Microsoft:GUID\DeviceSpecificData"
	Caption                 string // = "Ethernet Switch Port Settings"
	Description             string // = "Ethernet Switch Port Settings"
	ElementName             string
	ResourceType            uint16 // = 33
	OtherResourceType       string
	ResourceSubType         string
	PoolID                  string
	ConsumerVisibility      uint16 // = 3
	HostResource            []string
	AllocationUnits         string
	VirtualQuantity         uint64
	Reservation             uint64
	Limit                   uint64
	Weight                  uint32 // = 0
	AutomaticAllocation     bool
	AutomaticDeallocation   bool
	Parent                  string
	Connection              []string
	Address                 string
	MappingBehavior         uint16
	AddressOnParent         string
	VirtualQuantityUnits    string // = "count"
	DesiredVLANEndpointMode uint16
	OtherEndpointMode       string
	EnabledState            uint16
	LastKnownSwitchName     string
	RequiredFeatures        []string
	RequiredFeatureHints    []string
	TestReplicaPoolID       string
	TestReplicaSwitchName   string
	CompartmentGuid         string
}

type EthernetPortAllocationSettingsBuilder

type EthernetPortAllocationSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*EthernetPortAllocationSettingsBuilder) Finish

func (*EthernetPortAllocationSettingsBuilder) Get

type HardwareConfig

type HardwareConfig struct {
	// CPUs to be assigned to the VM
	CPUs uint16
	// Diskpath is fully qualified location of the
	// bootable disk image
	DiskPath string
	// Disk size in gigabytes assigned to the vm
	DiskSize uint64
	// Memory in megabytes assigned to the vm
	Memory int32
	// Network is bool to add a Network Connection to the
	// default network switch in Microsoft HyperV
	Network bool
}

type HyperVConfig

type HyperVConfig struct {
	// Hardware configuration for HyperV
	Hardware HardwareConfig
	// state and descriptive info
	Status Statuses
}

HyperVConfig describes physical attributes of the machine

type KvpError

type KvpError struct {
	ErrorCode int
	// contains filtered or unexported fields
}

func (*KvpError) Error

func (k *KvpError) Error() string

type MemorySettings

type MemorySettings struct {
	S__PATH                    string
	InstanceID                 string
	Caption                    string // = "Memory Default Settings"
	Description                string // = "Describes the default settings for the memory resources."
	ElementName                string
	ResourceType               uint16 // = 4
	OtherResourceType          string
	ResourceSubType            string // = "Microsoft:Hyper-V:Memory"
	PoolID                     string
	ConsumerVisibility         uint16
	HostResource               []string
	HugePagesEnabled           bool
	AllocationUnits            string // = "byte * 2^20"
	VirtualQuantity            uint64
	Reservation                uint64
	Limit                      uint64
	Weight                     uint32
	AutomaticAllocation        bool // = True
	AutomaticDeallocation      bool // = True
	Parent                     string
	Connection                 []string
	Address                    string
	MappingBehavior            uint16
	AddressOnParent            string
	VirtualQuantityUnits       string // = "byte * 2^20"
	DynamicMemoryEnabled       bool
	TargetMemoryBuffer         uint32
	IsVirtualized              bool // = True
	SwapFilesInUse             bool
	MaxMemoryBlocksPerNumaNode uint64
	SgxSize                    uint64
	SgxEnabled                 bool
}

type NetworkSettingsBuilder

type NetworkSettingsBuilder struct {
	// contains filtered or unexported fields
}

func NewNetworkSettingsBuilder

func NewNetworkSettingsBuilder(systemSettings *SystemSettings) *NetworkSettingsBuilder

func (*NetworkSettingsBuilder) AddSyntheticEthernetPort

func (builder *NetworkSettingsBuilder) AddSyntheticEthernetPort(beforeAdd func(*SyntheticEthernetPortSettings)) *SyntheticEthernetPortSettingsBuilder

func (*NetworkSettingsBuilder) Complete

func (builder *NetworkSettingsBuilder) Complete() error

type ProcessorSettings

type ProcessorSettings struct {
	S__PATH                        string
	InstanceID                     string
	Caption                        string // = "Processor"
	Description                    string // = "A logical processor of the hypervisor running on the host computer system."
	ElementName                    string
	ResourceType                   uint16 // = 3
	OtherResourceType              string
	ResourceSubType                string // = "Microsoft:Hyper-V:Processor"
	PoolID                         string
	ConsumerVisibility             uint16
	HostResource                   []string
	AllocationUnits                string // = "percent / 1000"
	VirtualQuantity                uint64 // = "count"
	Reservation                    uint64 // = 0
	Limit                          uint64 // = 100000
	Weight                         uint32 // = 100
	AutomaticAllocation            bool   // = True
	AutomaticDeallocation          bool   // = True
	Parent                         string
	Connection                     []string
	Address                        string
	MappingBehavior                uint16
	AddressOnParent                string
	VirtualQuantityUnits           string // = "count"
	LimitCPUID                     bool
	HwThreadsPerCore               uint64
	LimitProcessorFeatures         bool
	MaxProcessorsPerNumaNode       uint64
	MaxNumaNodesPerSocket          uint64
	EnableHostResourceProtection   bool
	CpuGroupId                     string
	HideHypervisorPresent          bool
	ExposeVirtualizationExtensions bool
}

type ResourceSettings

type ResourceSettings struct {
	S__PATH                  string
	InstanceID               string // = "Microsoft:GUID\DeviceSpecificData"
	Caption                  string
	Description              string
	ElementName              string
	ResourceType             uint16
	OtherResourceType        string
	ResourceSubType          string
	PoolID                   string
	ConsumerVisibility       uint16
	HostResource             []string
	AllocationUnits          string
	VirtualQuantity          uint64
	Reservation              uint64
	Limit                    uint64
	Weight                   uint32
	AutomaticAllocation      bool
	AutomaticDeallocation    bool
	Parent                   string
	Connection               []string
	Address                  string
	MappingBehavior          uint16
	AddressOnParent          string
	VirtualQuantityUnits     string   // = "count"
	VirtualSystemIdentifiers []string // = { "GUID" }
}

func (*ResourceSettings) Path

func (s *ResourceSettings) Path() string

type ScsiControllerSettings

type ScsiControllerSettings struct {
	ResourceSettings
	// contains filtered or unexported fields
}

func (*ScsiControllerSettings) AddSyntheticDiskDrive

func (c *ScsiControllerSettings) AddSyntheticDiskDrive(slot uint) (*SyntheticDiskDriveSettings, error)

func (*ScsiControllerSettings) AddSyntheticDvdDrive

func (c *ScsiControllerSettings) AddSyntheticDvdDrive(slot uint) (*SyntheticDvdDriveSettings, error)

type Statuses

type Statuses struct {
	// time vm created
	Created time.Time
	// last time vm ran
	LastUp time.Time
	// is vm running
	Running bool
	// is vm starting up
	Starting bool
	// vm state
	State EnabledState
}

type StorageAllocationSettings

type StorageAllocationSettings struct {
	S__PATH                         string
	InstanceID                      string
	Caption                         string // = "Hard Disk Image Default Settings"
	Description                     string // = "Describes the default settings for the hard disk image resources"
	ElementName                     string
	ResourceType                    uint16
	OtherResourceType               string
	ResourceSubType                 string
	PoolID                          string
	ConsumerVisibility              uint16
	HostResource                    []string
	AllocationUnits                 string
	VirtualQuantity                 uint64
	Limit                           uint64 // = 1
	Weight                          uint32
	StorageQoSPolicyID              string
	AutomaticAllocation             bool
	AutomaticDeallocation           bool
	Parent                          string
	Connection                      []string
	Address                         string
	MappingBehavior                 uint16
	AddressOnParent                 string
	VirtualResourceBlockSize        uint64
	VirtualQuantityUnits            string // = "count(fixed size block)"
	Access                          uint16
	HostResourceBlockSize           uint64
	Reservation                     uint64
	HostExtentStartingAddress       uint64
	HostExtentName                  string
	HostExtentNameFormat            uint16
	OtherHostExtentNameFormat       string
	HostExtentNameNamespace         uint16
	OtherHostExtentNameNamespace    string
	IOPSLimit                       uint64
	IOPSReservation                 uint64
	IOPSAllocationUnits             string
	PersistentReservationsSupported bool
	CachingMode                     uint16
	SnapshotId                      string // = ""
	IgnoreFlushes                   bool
	WriteHardeningMethod            uint16
}

func (*StorageAllocationSettings) Path

type SummaryInformation

type SummaryInformation struct {
	InstanceID                      string
	AllocatedGPU                    string
	Shielded                        bool
	AsynchronousTasks               []ConcreteJob
	CreationTime                    time.Time
	ElementName                     string
	EnabledState                    uint16
	OtherEnabledState               string
	GuestOperatingSystem            string
	HealthState                     uint16
	Heartbeat                       uint16
	MemoryUsage                     uint64
	MemoryAvailable                 int32
	AvailableMemoryBuffer           int32
	SwapFilesInUse                  bool
	Name                            string
	Notes                           string
	Version                         string
	NumberOfProcessors              uint16
	OperationalStatus               []uint16
	ProcessorLoad                   uint16
	ProcessorLoadHistory            []uint16
	Snapshots                       []SystemSettings
	StatusDescriptions              []string
	ThumbnailImage                  []uint8
	ThumbnailImageHeight            uint16
	ThumbnailImageWidth             uint16
	UpTime                          uint64
	ReplicationState                uint16
	ReplicationStateEx              []uint16
	ReplicationHealth               uint16
	ReplicationHealthEx             []uint16
	ReplicationMode                 uint16
	TestReplicaSystem               string // REF to CIM_ComputerSystem
	ApplicationHealth               uint16
	IntegrationServicesVersionState uint16
	MemorySpansPhysicalNumaNodes    bool
	ReplicationProviderId           []string
	EnhancedSessionModeState        uint16
	VirtualSwitchNames              []string
	VirtualSystemSubType            string
	HostComputerSystemName          string
}

SummaryInformation https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/msvm-summaryinformation

type SummaryRequestSet

type SummaryRequestSet []uint

type SyntheticDiskDriveSettings

type SyntheticDiskDriveSettings struct {
	ResourceSettings
	// contains filtered or unexported fields
}

func (*SyntheticDiskDriveSettings) DefineVirtualHardDisk

func (d *SyntheticDiskDriveSettings) DefineVirtualHardDisk(vhdxFile string, beforeAdd func(*VirtualHardDiskStorageSettings)) (*VirtualHardDiskStorageSettings, error)

type SyntheticDiskDriveSettingsBuilder

type SyntheticDiskDriveSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*SyntheticDiskDriveSettingsBuilder) DefineVirtualHardDisk

func (builder *SyntheticDiskDriveSettingsBuilder) DefineVirtualHardDisk(vhdxFile string, beforeAdd func(*VirtualHardDiskStorageSettings)) *VirtualHardDiskStorageSettingsBuilder

func (*SyntheticDiskDriveSettingsBuilder) Finish

func (*SyntheticDiskDriveSettingsBuilder) Get

type SyntheticDvdDriveSettings

type SyntheticDvdDriveSettings struct {
	ResourceSettings
	// contains filtered or unexported fields
}

func (*SyntheticDvdDriveSettings) DefineVirtualDvdDisk

func (d *SyntheticDvdDriveSettings) DefineVirtualDvdDisk(imageFile string) (*VirtualDvdDiskStorageSettings, error)

type SyntheticDvdDriveSettingsBuilder

type SyntheticDvdDriveSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*SyntheticDvdDriveSettingsBuilder) DefineVirtualDvdDisk

func (builder *SyntheticDvdDriveSettingsBuilder) DefineVirtualDvdDisk(imageFile string) *VirtualDvdDiskStorageSettingsBuilder

func (*SyntheticDvdDriveSettingsBuilder) Finish

func (*SyntheticDvdDriveSettingsBuilder) Get

type SyntheticEthernetPortSettings

type SyntheticEthernetPortSettings struct {
	S__PATH                  string
	InstanceID               string
	Caption                  string // = "Virtual Ethernet Port Default Settings"
	Description              string // = "Describes the default settings for the virtual Ethernet port resources."
	ElementName              string
	ResourceType             uint16 // = 10
	OtherResourceType        string
	ResourceSubType          string // = "Microsoft:Hyper-V:Synthetic Ethernet Port"
	PoolID                   string
	ConsumerVisibility       uint16 // = 3
	HostResource             []string
	AllocationUnits          string // = "count"
	VirtualQuantity          uint64 // = 1
	Reservation              uint64 // = 1
	Limit                    uint64 // = 1
	Weight                   uint32 // = 0
	AutomaticAllocation      bool   // = True
	AutomaticDeallocation    bool   // = True
	Parent                   string
	Connection               []string
	Address                  string
	MappingBehavior          uint16
	AddressOnParent          string
	VirtualQuantityUnits     string // = "count"
	DesiredVLANEndpointMode  uint16
	OtherEndpointMode        string
	VirtualSystemIdentifiers []string
	DeviceNamingEnabled      bool // = FALSE
	AllowPacketDirect        bool // = FALSE
	StaticMacAddress         bool // = False
	ClusterMonitored         bool // = TRUE
	// contains filtered or unexported fields
}

func (*SyntheticEthernetPortSettings) DefineEthernetPortConnection

func (p *SyntheticEthernetPortSettings) DefineEthernetPortConnection(switchName string) (*EthernetPortAllocationSettings, error)

func (*SyntheticEthernetPortSettings) Path

type SyntheticEthernetPortSettingsBuilder

type SyntheticEthernetPortSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*SyntheticEthernetPortSettingsBuilder) AddEthernetPortAllocation

func (builder *SyntheticEthernetPortSettingsBuilder) AddEthernetPortAllocation(switchName string) *EthernetPortAllocationSettingsBuilder

func (*SyntheticEthernetPortSettingsBuilder) Finish

func (*SyntheticEthernetPortSettingsBuilder) Get

type SystemSettings

type SystemSettings struct {
	S__PATH                              string
	InstanceID                           string
	Caption                              string // = "Virtual Machine Settings"
	Description                          string
	ElementName                          string
	VirtualSystemIdentifier              string
	VirtualSystemType                    string
	Notes                                []string
	CreationTime                         time.Time
	ConfigurationID                      string
	ConfigurationDataRoot                string
	ConfigurationFile                    string
	SnapshotDataRoot                     string
	SuspendDataRoot                      string
	SwapFileDataRoot                     string
	LogDataRoot                          string
	AutomaticStartupAction               uint16 // non-zero
	AutomaticStartupActionDelay          time.Duration
	AutomaticStartupActionSequenceNumber uint16
	AutomaticShutdownAction              uint16 // non-zero
	AutomaticRecoveryAction              uint16 // non-zero
	RecoveryFile                         string
	BIOSGUID                             string
	BIOSSerialNumber                     string
	BaseBoardSerialNumber                string
	ChassisSerialNumber                  string
	Architecture                         string
	ChassisAssetTag                      string
	BIOSNumLock                          bool
	BootOrder                            []uint16
	Parent                               string
	UserSnapshotType                     uint16 // non-zero
	IsSaved                              bool
	AdditionalRecoveryInformation        string
	AllowFullSCSICommandSet              bool
	DebugChannelId                       uint32
	DebugPortEnabled                     uint16
	DebugPort                            uint32
	Version                              string
	IncrementalBackupEnabled             bool
	VirtualNumaEnabled                   bool
	AllowReducedFcRedundancy             bool // = False
	VirtualSystemSubType                 string
	BootSourceOrder                      []string
	PauseAfterBootFailure                bool
	NetworkBootPreferredProtocol         uint16 // non-zero
	GuestControlledCacheTypes            bool
	AutomaticSnapshotsEnabled            bool
	IsAutomaticSnapshot                  bool
	GuestStateFile                       string
	GuestStateDataRoot                   string
	LockOnDisconnect                     bool
	ParentPackage                        string
	AutomaticCriticalErrorActionTimeout  time.Duration
	AutomaticCriticalErrorAction         uint16
	ConsoleMode                          uint16
	SecureBootEnabled                    bool
	SecureBootTemplateId                 string
	LowMmioGapSize                       uint64
	HighMmioGapSize                      uint64
	EnhancedSessionTransportType         uint16
}

func DefaultSystemSettings

func DefaultSystemSettings() *SystemSettings

func (*SystemSettings) AddScsiController

func (s *SystemSettings) AddScsiController() (*ScsiControllerSettings, error)

func (*SystemSettings) AddSyntheticEthernetPort

func (s *SystemSettings) AddSyntheticEthernetPort(beforeAdd func(*SyntheticEthernetPortSettings)) (*SyntheticEthernetPortSettings, error)

func (*SystemSettings) GetVM

func (s *SystemSettings) GetVM() (*VirtualMachine, error)

func (*SystemSettings) Path

func (s *SystemSettings) Path() string

type SystemSettingsBuilder

type SystemSettingsBuilder struct {
	// contains filtered or unexported fields
}

func NewSystemSettingsBuilder

func NewSystemSettingsBuilder() *SystemSettingsBuilder

func (*SystemSettingsBuilder) Build

func (builder *SystemSettingsBuilder) Build() (*SystemSettings, error)

func (*SystemSettingsBuilder) PrepareMemorySettings

func (builder *SystemSettingsBuilder) PrepareMemorySettings(beforeAdd func(*MemorySettings)) *SystemSettingsBuilder

func (*SystemSettingsBuilder) PrepareProcessorSettings

func (builder *SystemSettingsBuilder) PrepareProcessorSettings(beforeAdd func(*ProcessorSettings)) *SystemSettingsBuilder

func (*SystemSettingsBuilder) PrepareSystemSettings

func (builder *SystemSettingsBuilder) PrepareSystemSettings(name string, beforeAdd func(*SystemSettings)) *SystemSettingsBuilder

type VirtualDvdDiskStorageSettings

type VirtualDvdDiskStorageSettings struct {
	StorageAllocationSettings
	// contains filtered or unexported fields
}

type VirtualDvdDiskStorageSettingsBuilder

type VirtualDvdDiskStorageSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*VirtualDvdDiskStorageSettingsBuilder) Finish

func (*VirtualDvdDiskStorageSettingsBuilder) Get

type VirtualHardDiskSettings

type VirtualHardDiskSettings struct {
	S__PATH                    string
	InstanceID                 string
	Caption                    string // = "Virtual Hard Disk Setting Data"
	Description                string // = "Setting Data for a Virtual Hard Disk"
	ElementName                string
	Type                       uint16
	Format                     uint16
	Path                       string
	ParentPath                 string
	ParentTimestamp            time.Time
	ParentIdentifier           string
	MaxInternalSize            uint64
	BlockSize                  uint32
	LogicalSectorSize          uint32
	PhysicalSectorSize         uint32
	VirtualDiskId              string
	DataAlignment              uint64
	PmemAddressAbstractionType uint16
	IsPmemCompatible           bool
}

type VirtualHardDiskStorageSettings

type VirtualHardDiskStorageSettings struct {
	StorageAllocationSettings
	// contains filtered or unexported fields
}

type VirtualHardDiskStorageSettingsBuilder

type VirtualHardDiskStorageSettingsBuilder struct {
	// contains filtered or unexported fields
}

func (*VirtualHardDiskStorageSettingsBuilder) Finish

func (*VirtualHardDiskStorageSettingsBuilder) Get

type VirtualMachine

type VirtualMachine struct {
	S__PATH                                  string `json:"-"`
	S__CLASS                                 string `json:"-"`
	InstanceID                               string
	Caption                                  string
	Description                              string
	ElementName                              string
	InstallDate                              time.Time
	OperationalStatus                        []uint16
	StatusDescriptions                       []string
	Status                                   string
	HealthState                              uint16
	CommunicationStatus                      uint16
	DetailedStatus                           uint16
	OperatingStatus                          uint16
	PrimaryStatus                            uint16
	EnabledState                             uint16
	OtherEnabledState                        string
	RequestedState                           uint16
	EnabledDefault                           uint16
	TimeOfLastStateChange                    string
	AvailableRequestedStates                 []uint16
	TransitioningToState                     uint16
	CreationClassName                        string
	Name                                     string
	PrimaryOwnerName                         string
	PrimaryOwnerContact                      string
	Roles                                    []string
	NameFormat                               string
	OtherIdentifyingInfo                     []string
	IdentifyingDescriptions                  []string
	Dedicated                                []uint16
	OtherDedicatedDescriptions               []string
	ResetCapability                          uint16
	PowerManagementCapabilities              []uint16
	OnTimeInMilliseconds                     uint64
	ProcessID                                uint32
	TimeOfLastConfigurationChange            string
	NumberOfNumaNodes                        uint16
	ReplicationState                         uint16
	ReplicationHealth                        uint16
	ReplicationMode                          uint16
	FailedOverReplicationType                uint16
	LastReplicationType                      uint16
	LastApplicationConsistentReplicationTime string
	LastReplicationTime                      time.Time
	LastSuccessfulBackupTime                 string
	EnhancedSessionModeState                 uint16
	// contains filtered or unexported fields
}

func (*VirtualMachine) AddKeyValuePair

func (vm *VirtualMachine) AddKeyValuePair(key string, value string) error

func (*VirtualMachine) GetConfig

func (vm *VirtualMachine) GetConfig(diskPath string) (*HyperVConfig, error)

func (*VirtualMachine) GetKeyValuePairs

func (vm *VirtualMachine) GetKeyValuePairs() (map[string]string, error)

func (*VirtualMachine) GetSummaryInformation

func (vm *VirtualMachine) GetSummaryInformation(requestedFields SummaryRequestSet) (*SummaryInformation, error)

GetSummaryInformation returns the live VM summary information for this virtual machine. The requestedFields parameter controls which fields of summary information are populated. SummaryRequestCommon and SummaryRequestNearAll provide predefined combinations for this parameter

func (*VirtualMachine) IsStarting

func (vm *VirtualMachine) IsStarting() bool

func (*VirtualMachine) ModifyKeyValuePair

func (vm *VirtualMachine) ModifyKeyValuePair(key string, value string) error

func (*VirtualMachine) Path

func (vm *VirtualMachine) Path() string

func (*VirtualMachine) PutKeyValuePair

func (vm *VirtualMachine) PutKeyValuePair(key string, value string) error

func (*VirtualMachine) Remove

func (vm *VirtualMachine) Remove(diskPath string) error

func (*VirtualMachine) RemoveKeyValuePair

func (vm *VirtualMachine) RemoveKeyValuePair(key string) error

func (*VirtualMachine) SplitAndAddIgnition

func (vm *VirtualMachine) SplitAndAddIgnition(keyPrefix string, ignRdr *bytes.Reader) error

func (*VirtualMachine) Start

func (vm *VirtualMachine) Start() error

func (*VirtualMachine) State

func (vm *VirtualMachine) State() EnabledState

func (*VirtualMachine) Stop

func (vm *VirtualMachine) Stop() error

func (*VirtualMachine) UpdateProcessorMemSettings added in v0.0.2

func (vm *VirtualMachine) UpdateProcessorMemSettings(updateProcessor func(*ProcessorSettings), updateMemory func(*MemorySettings)) error

Update processor and/or mem

type VirtualMachineManager

type VirtualMachineManager struct {
}

func NewVirtualMachineManager

func NewVirtualMachineManager() *VirtualMachineManager

func (*VirtualMachineManager) CreateVhdxFile

func (*VirtualMachineManager) CreateVhdxFile(path string, maxSize uint64) error

func (*VirtualMachineManager) Exists

func (vmm *VirtualMachineManager) Exists(name string) (bool, error)

func (*VirtualMachineManager) GetAll

func (vmm *VirtualMachineManager) GetAll() ([]*VirtualMachine, error)

func (*VirtualMachineManager) GetMachine

func (*VirtualMachineManager) GetMachine(name string) (*VirtualMachine, error)

func (*VirtualMachineManager) GetSummaryInformation

func (vmm *VirtualMachineManager) GetSummaryInformation(requestedFields SummaryRequestSet) ([]SummaryInformation, error)

GetSummaryInformation returns the live VM summary information for all virtual machines. The requestedFields parameter controls which fields of summary information are populated. SummaryRequestCommon and SummaryRequestNearAll provide predefined combinations for this parameter.

func (*VirtualMachineManager) NewVirtualMachine

func (vmm *VirtualMachineManager) NewVirtualMachine(name string, config *HardwareConfig) error

NewVirtualMachine creates a new vm in hyperv decided to not return a *VirtualMachine here because of how Podman is likely to use this. this could be easily added if desirable

Jump to

Keyboard shortcuts

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