Documentation
¶
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 ¶
- func DiskImageAttachmentFromObject(obj objectivec.IObject) (vz.VZDiskImageStorageDeviceAttachment, bool)
- func NewDiskImageAttachment(path string, readOnly bool) (pvz.VZDiskImageStorageDeviceAttachment, error)
- func SetAttachment(ctx context.Context, queue *vm.Queue, device pvz.VZStorageDevice, ...) error
- func UpdateDiskImageSize(attachment vz.VZDiskImageStorageDeviceAttachment, size uint64) error
- func UpdateDiskSize(attachment pvz.VZDiskImageStorageDeviceAttachment, size uint64) error
- type Device
- func (d Device) Attachment() objectivec.IObject
- func (d Device) Description() string
- func (d Device) DiskImageAttachment() (vz.VZDiskImageStorageDeviceAttachment, bool)
- func (d Device) Inspect(index int) DeviceInfo
- func (d Device) Raw() pvz.VZStorageDevice
- func (d Device) SetAttachment(ctx context.Context, queue *vm.Queue, attachment pvz.VZStorageDeviceAttachment) error
- func (d Device) SetVirtualMachine(machine objectivec.IObject)
- func (d Device) SwapAttachment(ctx context.Context, queue *vm.Queue, attachment vz.IVZStorageDeviceAttachment) error
- func (d Device) UpdateDiskSize(size uint64) error
- type DeviceInfo
- type Entry
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 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 ¶
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 ¶
UpdateDiskSize updates the backing size of the device's disk image attachment.
type DeviceInfo ¶
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 ¶
ListDevices enumerates the live storage devices attached to machine on queue. It returns nil without error if the host VM does not expose _storageDevices.