plugin

package
v0.0.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExistingTask    = errors.New("task is already running")
	ErrStartingLibvirt = errors.New("unable to start libvirt")
	ErrImageNotFound   = errors.New("disk image not found at path")
	ErrTaskCrashed     = errors.New("task has crashed")
)

Functions

func NewPlugin

func NewPlugin(logger hclog.Logger) drivers.DriverPlugin

NewPlugin returns a new driver plugin

Types

type TaskState

type TaskState struct {
	TaskConfig *drivers.TaskConfig
	StartedAt  time.Time

	// NetTeardown is the specification used to delete all the network
	// configuration associated to a VM.
	NetTeardown *net.TeardownSpec
}

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.

type VirtDriverPlugin

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

func (*VirtDriverPlugin) Capabilities

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

Capabilities returns the features supported by the driver.

func (*VirtDriverPlugin) ConfigSchema

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

ConfigSchema returns the plugin configuration schema.

func (*VirtDriverPlugin) DestroyTask

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

DestroyTask function cleans up and removes a task that has terminated. If force is set to true, the driver must destroy the task even if it is still running.

func (*VirtDriverPlugin) ExecTask

func (d *VirtDriverPlugin) 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, currently not supported by the virt driver.

func (*VirtDriverPlugin) Fingerprint

func (d *VirtDriverPlugin) 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 (*VirtDriverPlugin) InspectTask

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

InspectTask returns detailed status information for the referenced taskID.

func (*VirtDriverPlugin) PluginInfo

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

PluginInfo returns information describing the plugin.

func (*VirtDriverPlugin) RecoverTask

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

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

func (*VirtDriverPlugin) SetConfig

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

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

func (*VirtDriverPlugin) SignalTask

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

SignalTask forwards a signal to a task. This is an optional capability, currently not supported by the virt driver.

func (*VirtDriverPlugin) StartTask

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

func (*VirtDriverPlugin) StopTask

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

StopTask function is expected to stop a running task by sending the given signal to it. If the task does not stop during the given timeout, the driver must forcefully kill the task. StopTask does not clean up resources of the task or remove it from the driver's internal state.

func (*VirtDriverPlugin) TaskConfigSchema

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

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

func (*VirtDriverPlugin) TaskEvents

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

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

func (*VirtDriverPlugin) TaskStats

func (d *VirtDriverPlugin) 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 (*VirtDriverPlugin) WaitTask

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

WaitTask function is expected to return a channel that will send an *ExitResult when the task exits or close the channel when the context is canceled. It is also expected that calling WaitTask on an exited task will immediately send an *ExitResult on the returned channel. A call to WaitTask after StopTask is valid and should be handled. If WaitTask is called after DestroyTask, it should return drivers.ErrTaskNotFound as no task state should exist after DestroyTask is called.

Jump to

Keyboard shortcuts

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