Skip to content

io.systemd.MachineInstance

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/machineinstance
Available since systemd v262
Methods · types · errors 10 · 0 · 7

Methods

Terminate

Forcefully terminate the machine immediately

func (c *Client) Terminate(ctx context.Context) error

PowerOff

Request a clean shutdown of the machine

func (c *Client) PowerOff(ctx context.Context) error

Reboot

Reboot the machine

func (c *Client) Reboot(ctx context.Context) error

Pause

Pause/freeze the machine

func (c *Client) Pause(ctx context.Context) error

Resume

Resume a paused machine

func (c *Client) Resume(ctx context.Context) error

Describe

Query the current status of the machine

func (c *Client) Describe(ctx context.Context) (*DescribeOut, error)

Reply

Field Type Description
running bool True iff vCPUs are executing
status string Backend-specific state string (e.g. 'running', 'paused', 'shutdown'); 'unknown' if unavailable

SubscribeEvents

streaming (requires more)

Subscribe to machine events. Returns a stream of events as they occur.

func (c *Client) SubscribeEvents(ctx context.Context, in SubscribeEventsIn) iter.Seq2[*SubscribeEventsOut, error]

Parameters

Field Type Description
filter ?[]string If specified, only deliver events whose name matches one of these strings; null means all events

Reply

Field Type Description
event string Name of the event
data ?object Event-specific payload

AddStorage

Attach a storage volume (passed via file descriptor) to the running machine

func (c *Client) AddStorage(ctx context.Context, in AddStorageIn) error

Parameters

Field Type Description
fileDescriptorIndex int Index of the attached file descriptor for the storage volume
name string Caller-supplied identifier for this binding (any non-empty string; machinectl uses ':' from the StorageProvider, but the form is not required)
config ?string Backend-specific configuration

RemoveStorage

Detach a previously-attached storage volume from the running machine

func (c *Client) RemoveStorage(ctx context.Context, in RemoveStorageIn) error

Parameters

Field Type Description
name string Identifier of the binding to detach (as supplied to AddStorage)

ReplaceStorage

Replace the backing of a previously-attached storage volume in place

func (c *Client) ReplaceStorage(ctx context.Context, in ReplaceStorageIn) error

Parameters

Field Type Description
fileDescriptorIndex int Index of the attached file descriptor for the new backing storage
name string Identifier of the existing binding whose backing is being replaced (as supplied to AddStorage)

Errors

Error Go type Description
NotConnected NotConnectedError The connection to the machine backend is not available
NotSupported NotSupportedError The requested operation is not supported
NoSuchStorage NoSuchStorageError The named storage binding does not exist
StorageExists StorageExistsError A storage binding with this name already exists
StorageImmutable StorageImmutableError The storage binding cannot be detached at runtime (e.g. attached at boot)
BadConfig BadConfigError The supplied 'config' value is not valid for this backend
ConfigNotSupported ConfigNotSupportedError The supplied 'config' value is recognized but not supported by this backend