kvp

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 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
	HvEFail                   = 0x80004005
	HvKvpExchangeMaxValueSize = 2048
	HvKvpExchangeMaxKeySize   = 512
	OpSet                     = 1
	// KernelDevice is the hyperv kernel device used for communicating key-value 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"
	DefaultKVPFileWritePermissions = 0644
)

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) EncodePoolFile added in v0.0.5

func (kv KeyValuePair) EncodePoolFile(poolID PoolID) (poolFile []byte)

func (KeyValuePair) GetSplitKeyValues added in v0.0.2

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

GetSplitKeyValues reassembles split KVPs from a key prefix and pool_id and returns the assembled split value.

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

func (ValuePairs) GetValueByKey added in v0.2.0

func (vp ValuePairs) GetValueByKey(key string) (ValuePair, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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