disk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskController

type DiskController struct {
	Log *slog.Logger
	EAC *entityserver_v1alpha.EntityAccessClient

	// NodeId is the ID of this node, used for creating lsvd_volume entities
	NodeId string
	// contains filtered or unexported fields
}

DiskController manages disk entities and their lifecycle. It uses lsvd_volume entities to coordinate with lsvd-server for volume operations.

func NewDiskController

func NewDiskController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, nodeId string) *DiskController

NewDiskController creates a disk controller that uses lsvd_volume entities. The lsvd-server process watches these entities and performs the actual volume operations.

func (*DiskController) Close

func (d *DiskController) Close() error

Close gracefully shuts down the disk controller

func (*DiskController) Create

func (d *DiskController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error

Create handles creation of a new disk entity

func (*DiskController) Delete

func (d *DiskController) Delete(ctx context.Context, id entity.Id) error

Delete handles deletion of a disk entity

func (*DiskController) ForceLSVDMode added in v0.4.0

func (d *DiskController) ForceLSVDMode()

ForceLSVDMode forces the controller to use lsvd_volume entities instead of directory mode, regardless of NBD availability. This is used by integration tests where the LSVD volume/mount ops are mocked.

func (*DiskController) Init

func (d *DiskController) Init(ctx context.Context) error

Init initializes the disk controller

func (*DiskController) Start

func (d *DiskController) Start(ctx context.Context) error

Start starts the disk controller

func (*DiskController) Update

func (d *DiskController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error

Update handles updates to an existing disk entity

type DiskLeaseController

type DiskLeaseController struct {
	Log *slog.Logger
	EAC *entityserver_v1alpha.EntityAccessClient

	// NodeId is the ID of this node, used for creating lsvd_mount entities
	NodeId string
	// contains filtered or unexported fields
}

DiskLeaseController manages disk lease entities and exclusive access. It uses lsvd_mount entities to coordinate with lsvd-server for mount operations.

Operational flow: 1. Disks are created via lsvd_volume entities when provisioned 2. When a lease is bound, an lsvd_mount entity is created for lsvd-server to mount 3. Leases control exclusive access to these mounted volumes 4. The lease.Mount.Path specifies where to mount within the sandbox's filesystem

func NewDiskLeaseController

func NewDiskLeaseController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, nodeId string) *DiskLeaseController

NewDiskLeaseController creates a disk lease controller that uses lsvd_mount entities. The lsvd-server process watches these entities and performs the actual mount/unmount operations.

func (*DiskLeaseController) CleanupOldReleasedLeases

func (d *DiskLeaseController) CleanupOldReleasedLeases(ctx context.Context) error

CleanupOldReleasedLeases deletes released leases that haven't been updated for over 1 hour

func (*DiskLeaseController) Create

Create handles creation of a new disk lease entity

func (*DiskLeaseController) Delete

func (d *DiskLeaseController) Delete(ctx context.Context, id entity.Id) error

Delete handles deletion of a disk lease entity

func (*DiskLeaseController) ForceLSVDMode added in v0.4.0

func (d *DiskLeaseController) ForceLSVDMode()

ForceLSVDMode forces the controller to use lsvd_mount entities instead of directory mode, regardless of NBD availability. This is used by integration tests where the LSVD volume/mount ops are mocked.

func (*DiskLeaseController) GetTestDisk

func (d *DiskLeaseController) GetTestDisk(diskId entity.Id) *storage_v1alpha.Disk

GetTestDisk is a test helper to retrieve disk information from test cache

func (*DiskLeaseController) Init

Init initializes the disk lease controller

func (*DiskLeaseController) SetTestDisk

func (d *DiskLeaseController) SetTestDisk(disk *storage_v1alpha.Disk)

SetTestDisk is a test helper to set disk information when EAC is not available

func (*DiskLeaseController) Update

Update handles updates to an existing disk lease entity

type DiskWatchController

type DiskWatchController struct {
	Log *slog.Logger
	EAC *entityserver_v1alpha.EntityAccessClient

	// Reference to the disk lease controller to enqueue lease reconciliations
	LeaseController *controller.ReconcileController
}

DiskWatchController watches for disk state changes and triggers reconciliation of dependent leases

func NewDiskWatchController

func NewDiskWatchController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, leaseController *controller.ReconcileController) *DiskWatchController

NewDiskWatchController creates a new disk watch controller

func (*DiskWatchController) Create

func (d *DiskWatchController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error

Create handles creation of a disk entity (triggers lease reconciliation)

func (*DiskWatchController) Delete

func (d *DiskWatchController) Delete(ctx context.Context, id entity.Id) error

Delete handles deletion of a disk entity

func (*DiskWatchController) Init

Init initializes the disk watch controller

func (*DiskWatchController) Update

func (d *DiskWatchController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error

Update handles updates to a disk entity (triggers lease reconciliation)

type MountWatchController added in v0.4.0

type MountWatchController struct {
	Log *slog.Logger
	EAC *entityserver_v1alpha.EntityAccessClient

	LeaseController *controller.ReconcileController
}

MountWatchController watches for lsvd_mount state changes and triggers re-reconciliation of the parent disk_lease entity. This bridges the gap where the disk lease controller creates an lsvd_mount and needs to know when the mount controller finishes mounting it.

func NewMountWatchController added in v0.4.0

func NewMountWatchController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, leaseController *controller.ReconcileController) *MountWatchController

NewMountWatchController creates a new mount watch controller.

func (*MountWatchController) Create added in v0.4.0

func (*MountWatchController) Delete added in v0.4.0

func (m *MountWatchController) Delete(ctx context.Context, id entity.Id) error

func (*MountWatchController) Init added in v0.4.0

func (*MountWatchController) Update added in v0.4.0

type VolumeWatchController added in v0.3.1

type VolumeWatchController struct {
	Log *slog.Logger
	EAC *entityserver_v1alpha.EntityAccessClient

	DiskController *controller.ReconcileController
}

VolumeWatchController watches for lsvd_volume state changes and triggers re-reconciliation of the parent disk entity. This bridges the gap where the disk controller creates an lsvd_volume and needs to know when lsvd-server finishes provisioning it.

func NewVolumeWatchController added in v0.3.1

func NewVolumeWatchController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, diskController *controller.ReconcileController) *VolumeWatchController

NewVolumeWatchController creates a new volume watch controller.

func (*VolumeWatchController) Create added in v0.3.1

func (*VolumeWatchController) Delete added in v0.3.1

func (v *VolumeWatchController) Delete(ctx context.Context, id entity.Id) error

func (*VolumeWatchController) Init added in v0.3.1

func (*VolumeWatchController) Update added in v0.3.1

Jump to

Keyboard shortcuts

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