alt_qemu

package
v0.0.0-...-577c192 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAbsolutePath

func GetAbsolutePath(bin string) (string, error)

GetAbsolutePath returns the absolute path of the passed binary by resolving it in the path and following symlinks.

func NewAltQemuDriver

func NewAltQemuDriver(logger hclog.Logger) drivers.DriverPlugin

NewAltQemuDriver returns a new example driver plugin

Types

type AltQemuDriverPlugin

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

AltQemuDriverPlugin is an example driver plugin. When provisioned in a job, the taks will output a greet specified by the user.

func (*AltQemuDriverPlugin) Capabilities

func (d *AltQemuDriverPlugin) Capabilities() (*drivers.Capabilities, error)

Capabilities returns the features supported by the driver.

func (*AltQemuDriverPlugin) ConfigSchema

func (d *AltQemuDriverPlugin) ConfigSchema() (*hclspec.Spec, error)

ConfigSchema returns the plugin configuration schema.

func (*AltQemuDriverPlugin) DestroyTask

func (d *AltQemuDriverPlugin) DestroyTask(taskID string, force bool) error

DestroyTask cleans up and removes a task that has terminated.

func (*AltQemuDriverPlugin) ExecTask

func (d *AltQemuDriverPlugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)

ExecTask returns the result of executing the given command inside a task. This is an optional capability.

func (*AltQemuDriverPlugin) Fingerprint

func (d *AltQemuDriverPlugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)

Fingerprint returns a channel that will be used to send health information and other driver specific node attributes.

func (*AltQemuDriverPlugin) InspectTask

func (d *AltQemuDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)

InspectTask returns detailed status information for the referenced taskID.

func (*AltQemuDriverPlugin) PluginInfo

func (d *AltQemuDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)

PluginInfo returns information describing the plugin.

func (*AltQemuDriverPlugin) RecoverTask

func (d *AltQemuDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error

RecoverTask recreates the in-memory state of a task from a TaskHandle.

func (*AltQemuDriverPlugin) SetConfig

func (d *AltQemuDriverPlugin) SetConfig(cfg *base.Config) error

SetConfig is called by the client to pass the configuration for the plugin.

func (*AltQemuDriverPlugin) SignalTask

func (d *AltQemuDriverPlugin) SignalTask(taskID string, signal string) error

SignalTask forwards a signal to a task. This is an optional capability.

func (*AltQemuDriverPlugin) StartTask

StartTask returns a task handle and a driver network if necessary.

func (*AltQemuDriverPlugin) StopTask

func (d *AltQemuDriverPlugin) StopTask(taskID string, timeout time.Duration, signal string) error

StopTask stops a running task with the given signal and within the timeout window.

func (*AltQemuDriverPlugin) TaskConfigSchema

func (d *AltQemuDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)

TaskConfigSchema returns the HCL schema for the configuration of a task.

func (*AltQemuDriverPlugin) TaskEvents

func (d *AltQemuDriverPlugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)

TaskEvents returns a channel that the plugin can use to emit task related events.

func (*AltQemuDriverPlugin) TaskStats

func (d *AltQemuDriverPlugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)

TaskStats returns a channel which the driver should send stats to at the given interval.

func (*AltQemuDriverPlugin) WaitTask

func (d *AltQemuDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)

WaitTask returns a channel used to notify Nomad when a task exits.

type Config

type Config struct {
	// TODO: create decoded plugin configuration struct
	//
	// This struct is the decoded version of the schema defined in the
	// configSpec variable above. It's used to convert the HCL configuration
	// passed by the Nomad agent into Go contructs.
	ImagePaths []string `codec:"image_paths"`
}

Config contains configuration information for the plugin

type TaskConfig

type TaskConfig struct {
	// TODO: create decoded plugin task configuration struct
	//
	// This struct is the decoded version of the schema defined in the
	// taskConfigSpec variable above. It's used to convert the string
	// configuration for the task into Go contructs.
	ImagePath        string             `codec:"image_path"`
	Accelerator      string             `codec:"accelerator"`
	Args             []string           `codec:"args"`     // extra arguments to qemu executable
	PortMap          hclutils.MapStrInt `codec:"port_map"` // A map of host port and the port name defined in the image manifest file
	GracefulShutdown bool               `codec:"graceful_shutdown"`
	QemuSystemBin    string             `codec:"qemu_system_bin"`
	QemuImgBin       string             `codec:"qemu_img_bin"`
	VmName           string             `codec:"vm_name"`
	MachineType      string             `codec:"machine_type"`
}

TaskConfig contains configuration information for a task that runs with this plugin

type TaskState

type TaskState struct {
	ReattachConfig *pstructs.ReattachConfig
	TaskConfig     *drivers.TaskConfig
	StartedAt      time.Time
	Pid            int
}

TaskState is the runtime state which is encoded in the handle returned to Nomad client. This information is needed to rebuild the task state and handler during recovery.

Jump to

Keyboard shortcuts

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