kvp

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Timeout amount of time in ms to poll the hyperv kernel device
	Timeout                   = 1000
	OpRegister1               = 100
	HvSOk                     = 0
	HvKvpExchangeMaxValueSize = 2048
	HvKvpExchangeMaxKeySize   = 512
	OpSet                     = 1
	// KernelDevice s the hyperv kernel device used for communicating key-values pairs
	// on hyperv between the host and guest
	KernelDevice = "/dev/vmbus/hv_kvp"
	// DefaultKVPPoolID is where Windows host write to for Linux VMs
	DefaultKVPPoolID   = 0
	DefaultKVPBaseName = ".kvp_pool_"
	DefaultKVPFilePath = "/var/lib/hyperv"
)

Variables

View Source
var (
	// ErrUnableToWriteToKVP is used when we are unable to write to the kernel
	// device for hyperv
	ErrUnableToWriteToKVP = errors.New("failed to write to hv_kvp")
	// ErrUnableToReadFromKVP is used when we are unable to read from the kernel
	// device for hyperv
	ErrUnableToReadFromKVP = errors.New("failed to read from hv_kvp")
	// ErrNoKeyValuePairsFound means we were unable to find key-value pairs as passed
	// from the hyperv host to this guest.
	ErrNoKeyValuePairsFound = errors.New("unable to find kvp keys")
	// ErrKeyNotFound means we could not find the key in information read
	ErrKeyNotFound = errors.New("unable to find key")
)

Functions

This section is empty.

Types

type KeyValuePair added in v0.0.2

type KeyValuePair map[PoolID]ValuePairs

func GetKeyValuePairs

func GetKeyValuePairs() (KeyValuePair, error)

GetKeyValuePairs reads the key value pairs from the wmi hyperv kernel device and returns them in map form. the map value is a ValuePair which contains the value string and the poolid

func (KeyValuePair) GetSplitKeyValues added in v0.0.2

func (kv KeyValuePair) GetSplitKeyValues(key string, pool PoolID) (string, KeyValuePair, error)

GetSplitKeyValues "filters" KVPs looking for split values using a key and pool_id. Returns the assembled split values as a key as well as a new KVP that no longer has the split keys in question

func (KeyValuePair) WriteToFS added in v0.0.2

func (kv KeyValuePair) WriteToFS(path string) error

type PoolID

type PoolID uint8

type ValuePair

type ValuePair struct {
	Key   string
	Value string
}

type ValuePairs added in v0.0.2

type ValuePairs []ValuePair

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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