storagehotplug

package
v0.6.21 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 9 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for darwin/amd64

Overview

Package storagehotplug provides runtime storage device management.

It is intended to wrap the private storage device APIs used to create live devices, swap attachments, resize backing media, and detach or replace disks on a running virtual machine.

The package focuses on:

Listing and inspecting live storage devices on a running VM
Constructing live storage devices from attachments
Swapping attachments with completion handlers
Resizing live disk image attachments

This package complements the static storage configuration helpers in the parent vzkit package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiskImageAttachmentFromObject

func DiskImageAttachmentFromObject(obj objectivec.IObject) (vz.VZDiskImageStorageDeviceAttachment, bool)

DiskImageAttachmentFromObject unwraps obj as a public VZDiskImageStorageDeviceAttachment when its runtime class matches.

func NewDiskImageAttachment

func NewDiskImageAttachment(path string, readOnly bool) (pvz.VZDiskImageStorageDeviceAttachment, error)

NewDiskImageAttachment opens path as a disk image attachment.

func SetAttachment

func SetAttachment(ctx context.Context, queue *vm.Queue, device pvz.VZStorageDevice, attachment pvz.VZStorageDeviceAttachment) error

SetAttachment swaps the device attachment and waits for completion.

func UpdateDiskImageSize

func UpdateDiskImageSize(attachment vz.VZDiskImageStorageDeviceAttachment, size uint64) error

UpdateDiskImageSize updates the size of a public disk image attachment.

func UpdateDiskSize

func UpdateDiskSize(attachment pvz.VZDiskImageStorageDeviceAttachment, size uint64) error

UpdateDiskSize updates the size of a disk image attachment.

Types

type Device

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

Device wraps a live VZStorageDevice.

func FromID

func FromID(id objectivec.IObject) Device

FromID wraps an existing storage device ID.

func NewDevice

func NewDevice(attachment vz.IVZStorageDeviceAttachment) (Device, error)

NewDevice creates a live storage device for attachment.

func NewDiskImageDevice

func NewDiskImageDevice(path string, readOnly bool) (Device, pvz.VZDiskImageStorageDeviceAttachment, error)

NewDiskImageDevice opens path and creates a live storage device.

func (Device) Attachment

func (d Device) Attachment() objectivec.IObject

Attachment returns the current attachment.

func (Device) Description

func (d Device) Description() string

Description returns the trimmed Objective-C description of the device.

func (Device) DiskImageAttachment

func (d Device) DiskImageAttachment() (vz.VZDiskImageStorageDeviceAttachment, bool)

DiskImageAttachment returns the device's backing disk image attachment, if any.

func (Device) Inspect

func (d Device) Inspect(index int) DeviceInfo

Inspect returns metadata describing the live storage device at index.

func (Device) Raw

func (d Device) Raw() pvz.VZStorageDevice

Raw returns the underlying Objective-C wrapper.

func (Device) SetAttachment

func (d Device) SetAttachment(ctx context.Context, queue *vm.Queue, attachment pvz.VZStorageDeviceAttachment) error

SetAttachment swaps the device attachment and waits for completion.

func (Device) SetVirtualMachine

func (d Device) SetVirtualMachine(machine objectivec.IObject)

SetVirtualMachine associates the device with a VM.

func (Device) SwapAttachment

func (d Device) SwapAttachment(ctx context.Context, queue *vm.Queue, attachment vz.IVZStorageDeviceAttachment) error

SwapAttachment swaps the device's attachment using a public VZStorageDeviceAttachment and waits for completion.

func (Device) UpdateDiskSize

func (d Device) UpdateDiskSize(size uint64) error

UpdateDiskSize updates the backing size of the device's disk image attachment.

type DeviceInfo

type DeviceInfo struct {
	Index       int
	Kind        string
	Description string
	Path        string
	ReadOnly    bool
}

DeviceInfo describes a live storage device attached to a virtual machine.

type Entry

type Entry struct {
	Index  int
	Device Device
	Info   DeviceInfo
}

Entry pairs a live storage device with its index and inspected metadata.

func ListDevices

func ListDevices(queue *vm.Queue, machine vz.VZVirtualMachine) ([]Entry, error)

ListDevices enumerates the live storage devices attached to machine on queue. It returns nil without error if the host VM does not expose _storageDevices.

Jump to

Keyboard shortcuts

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