qga

package
v0.0.0-...-7d65031 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package qga - common functions for qemu-ga

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version string (git descrive --long)
	Version string
	// BuildTime build time
	BuildTime string
)

Functions

func GetVersion

func GetVersion() string

GetVersion display current qemu-ga version

func RegisterCommand

func RegisterCommand(cmd *Command)

RegisterCommand registers command to process inside worker

func StoreDel

func StoreDel(ns string, k interface{})

func StoreGet

func StoreGet(ns string, k interface{}) (interface{}, bool)

func StoreSet

func StoreSet(ns string, k interface{}, v interface{})

Types

type Channel

type Channel interface {
	DialTimeout(string, time.Duration) error
	Close() error
	Poll() error
}

Channel interface provide communication channel with qemu-ga

type Command

type Command struct {
	Enabled   bool                     `json:"enabled"`          // flag to enable command
	Name      string                   `json:"name"`             // command name
	Func      func(*Request) *Response `json:"-"`                // command execution function
	Returns   bool                     `json:"success-response"` // flag for command returned value on success
	Arguments bool                     `json:"-"`                // flag for comand that it needs arguments
}

Command struct contains supported commands

func ListCommands

func ListCommands() []*Command

ListCommands returns commands

type Error

type Error struct {
	Class  string `json:"class,omitempty"`
	Desc   string `json:"desc,omitempty"`
	Bufb64 string `json:"bufb64,omitempty"`
	Code   int    `json:"code,omitempty"`
}

Error struct used to indicate error when processing command

type ExecStatus

type ExecStatus struct {
	Exited   bool   `json:"exited"`
	ExitCode *int   `json:"exitcode,omitempty"`
	Signal   int    `json:"signal,omitempty"`
	OutData  string `json:"out-data,omitempty"`
	ErrData  string `json:"err-data,omitempty"`
	OutTrunc bool   `json:"out-truncated,omitempty"`
	ErrTrunc bool   `json:"err-truncated,omitempty"`
}

type FileSystem

type FileSystem struct {
	Device  string
	Path    string
	Type    string
	Options []string
}

FileSystem struct

func ListMountedFileSystems

func ListMountedFileSystems() ([]FileSystem, error)

type Logger

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

func NewLogger

func NewLogger(c *http.Client) (*Logger, error)

func (*Logger) Alert

func (l *Logger) Alert(msg string) error

func (*Logger) Alertf

func (l *Logger) Alertf(f string, msg string) error

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Crit

func (l *Logger) Crit(msg string) error

func (*Logger) Critf

func (l *Logger) Critf(f string, msg string) error

func (*Logger) Debug

func (l *Logger) Debug(msg string) error

func (*Logger) Debugf

func (l *Logger) Debugf(f string, msg string) error

func (*Logger) Emerg

func (l *Logger) Emerg(msg string) error

func (*Logger) Emergf

func (l *Logger) Emergf(f string, msg string) error

func (*Logger) Error

func (l *Logger) Error(msg string) error

func (*Logger) Errorf

func (l *Logger) Errorf(f string, msg string) error

func (*Logger) Info

func (l *Logger) Info(msg string) error

func (*Logger) Infof

func (l *Logger) Infof(f string, msg string) error

func (*Logger) Notice

func (l *Logger) Notice(msg string) error

func (*Logger) Noticef

func (l *Logger) Noticef(f string, msg string) error

func (*Logger) Warn

func (l *Logger) Warn(msg string) error

func (*Logger) Warnf

func (l *Logger) Warnf(f string, msg string) error

type Request

type Request struct {
	Execute string          `json:"execute"`
	RawArgs json.RawMessage `json:"arguments,omitempty"`
	Id      string          `json:"id,omitempty"`
}

Request struct used to parse incoming request

type Response

type Response struct {
	Return interface{} `json:"return,omitempty"`
	Error  *Error      `json:"error,omitempty"`
	Id     string      `json:"id,omitempty"`
}

Response struct used to encode response from command

func CmdRun

func CmdRun(req *Request) *Response

CmdRun executes command

Jump to

Keyboard shortcuts

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