agentpoller

package
v0.59.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

* This file is part of the KubeVirt project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright 2018 Red Hat, Inc. *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFSFreezeStatus added in v0.44.1

func ParseFSFreezeStatus(agentReply string) (api.FSFreeze, error)

parseFSFreezeStatus from the agent response

Types

type AgentCommand added in v0.26.0

type AgentCommand string

AgentCommand is a command executable on guest agent

const (
	GET_OSINFO          AgentCommand = "guest-get-osinfo"
	GET_HOSTNAME        AgentCommand = "guest-get-host-name"
	GET_INTERFACES      AgentCommand = "guest-network-get-interfaces"
	GET_TIMEZONE        AgentCommand = "guest-get-timezone"
	GET_USERS           AgentCommand = "guest-get-users"
	GET_FILESYSTEM      AgentCommand = "guest-get-fsinfo"
	GET_AGENT           AgentCommand = "guest-info"
	GET_FSFREEZE_STATUS AgentCommand = "guest-fsfreeze-status"
)

Aliases for commands executed on guest agent TODO: when updated to libvirt 5.6.0 this can change to libvirt types Aliases are also used as keys to the store, it does not matter how the keys are named, only whether it relates to the right data

type AgentInfo added in v0.27.0

type AgentInfo struct {
	Version           string                     `json:"version"`
	SupportedCommands []v1.GuestAgentCommandInfo `json:"supported_commands,omitempty"`
}

AgentInfo from the guest VM serves the purpose of checking the GA presence and version compatibility

type AgentPoller

type AgentPoller struct {
	Connection cli.Connection
	VmiUID     types.UID
	// contains filtered or unexported fields
}

func CreatePoller

func CreatePoller(
	connecton cli.Connection,
	vmiUID types.UID,
	domainName string,
	store *AsyncAgentStore,
	qemuAgentSysInterval time.Duration,
	qemuAgentFileInterval time.Duration,
	qemuAgentUserInterval time.Duration,
	qemuAgentVersionInterval time.Duration,
	qemuAgentFSFreezeStatusInterval time.Duration,
) *AgentPoller

CreatePoller creates the new structure that holds guest agent pollers

func (*AgentPoller) Start

func (p *AgentPoller) Start()

Start the poller workers

func (*AgentPoller) Stop

func (p *AgentPoller) Stop()

Stop all poller workers

type AgentUpdatedEvent added in v0.26.0

type AgentUpdatedEvent struct {
	Type       AgentCommand
	DomainInfo api.DomainGuestInfo
}

AgentUpdatedEvent fire up when data is changes in the store

type AsyncAgentStore added in v0.26.0

type AsyncAgentStore struct {
	AgentUpdated chan AgentUpdatedEvent
	// contains filtered or unexported fields
}

AsyncAgentStore stores the agent data converted to api domain objects it offers methods to get the data and fire up an event when there is a change of the data

func NewAsyncAgentStore added in v0.26.0

func NewAsyncAgentStore() AsyncAgentStore

NewAsyncAgentStore creates new agent store

func (*AsyncAgentStore) GetFS added in v0.27.0

func (s *AsyncAgentStore) GetFS(limit int) []api.Filesystem

GetFS returns the filesystem list limited to the limit set set limit to -1 to return the whole list

func (*AsyncAgentStore) GetFSFreezeStatus added in v0.43.0

func (s *AsyncAgentStore) GetFSFreezeStatus() api.FSFreeze

GetFSFreezeStatus returns the Guest fsfreeze status

func (*AsyncAgentStore) GetGA added in v0.27.0

func (s *AsyncAgentStore) GetGA() AgentInfo

GetGA returns guest agent record with its version if present

func (*AsyncAgentStore) GetGuestOSInfo added in v0.36.4

func (s *AsyncAgentStore) GetGuestOSInfo() *api.GuestOSInfo

GetGuestOSInfo returns the Guest OS version and architecture

func (*AsyncAgentStore) GetInterfaceStatus added in v0.36.4

func (s *AsyncAgentStore) GetInterfaceStatus() []api.InterfaceStatus

GetInterfaceStatus returns the interfaces Guest Agent reported

func (*AsyncAgentStore) GetSysInfo added in v0.27.0

func (s *AsyncAgentStore) GetSysInfo() api.DomainSysInfo

GetSysInfo returns the sysInfo information packed together. Sysinfo comprises of:

  • Guest Hostname
  • Guest OS version and architecture
  • Guest Timezone

func (*AsyncAgentStore) GetUsers added in v0.27.0

func (s *AsyncAgentStore) GetUsers(limit int) []api.User

GetUsers return the use list limited to the limit set set limit to -1 to return all users

func (*AsyncAgentStore) Store added in v0.26.0

func (s *AsyncAgentStore) Store(key AgentCommand, value interface{})

Store saves the value with a key to the storage, when there is a change in data it fires up updated event

type Filesystem added in v0.27.0

type Filesystem struct {
	Name       string `json:"name"`
	Mountpoint string `json:"mountpoint"`
	Type       string `json:"type"`
	UsedBytes  int    `json:"used-bytes,omitempty"`
	TotalBytes int    `json:"total-bytes,omitempty"`
}

Filesystem of the host

type GuestOsInfo added in v0.26.0

type GuestOsInfo struct {
	Name          string `json:"name"`
	KernelRelease string `json:"kernel-release"`
	Version       string `json:"version"`
	PrettyName    string `json:"pretty-name"`
	VersionId     string `json:"version-id"`
	KernelVersion string `json:"kernel-version"`
	Machine       string `json:"machine"`
	Id            string `json:"id"`
}

GuestOsInfo is the response from 'guest-get-osinfo'

type Hostname added in v0.27.0

type Hostname struct {
	Hostname string `json:"host-name"`
}

Hostname of the guest vm

type IP

type IP struct {
	IP     string `json:"ip-address"`
	Type   string `json:"ip-address-type"`
	Prefix int    `json:"prefix"`
}

IP for json unmarshalling

type Interface

type Interface struct {
	MAC  string `json:"hardware-address"`
	IPs  []IP   `json:"ip-addresses"`
	Name string `json:"name"`
}

Interface for json unmarshalling

type PollerWorker added in v0.26.0

type PollerWorker struct {
	// AgentCommands is a list of commands executed on the guestAgent
	AgentCommands []AgentCommand
	// CallTick is how often to call this set of commands
	CallTick time.Duration
}

PollerWorker collects the data from the guest agent only unique items are stored as configuration

func (*PollerWorker) Poll added in v0.26.0

func (p *PollerWorker) Poll(execAgentCommands agentCommandsExecutor, closeChan chan struct{}, initialInterval time.Duration)

Poll is the call to the guestagent.

type Timezone added in v0.27.0

type Timezone struct {
	Zone   string `json:"zone,omitempty"`
	Offset int    `json:"offset"`
}

Timezone of the host

type User added in v0.27.0

type User struct {
	Name      string  `json:"user"`
	Domain    string  `json:"domain"`
	LoginTime float64 `json:"login-time"`
}

User on the guest host

Jump to

Keyboard shortcuts

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