scsi

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownFilesystem = errors.New("could not get device filesystem type")

Functions

func ActualControllerNumber added in v0.10.0

func ActualControllerNumber(_ context.Context, passedController uint8) (uint8, error)

ActualControllerNumber retrieves the actual controller number assigned to a SCSI controller with number `passedController`. When HCS creates the UVM it adds 4 SCSI controllers to the UVM but the 1st SCSI controller according to HCS can actually show up as 2nd, 3rd or 4th controller inside the UVM. So the i'th controller from HCS' perspective could actually be j'th controller inside the UVM. However, we can refer to the SCSI controllers with their GUIDs (that are hardcoded) and then using that GUID find out the SCSI controller number inside the guest. This function does exactly that.

func GetDevicePath added in v0.10.0

func GetDevicePath(ctx context.Context, controller, lun uint8, partition uint64) (_ string, err error)

GetDevicePath finds the `/dev/sd*` path to the SCSI device on `controller` index `lun` with partition index `partition` and also ensures that the device is available under that path or context is canceled.

func Mount

func Mount(
	ctx context.Context,
	controller,
	lun uint8,
	partition uint64,
	target string,
	readonly bool,
	options []string,
	config *Config) (err error)

Mount creates a mount from the SCSI device on `controller` index `lun` to `target`

`target` will be created. On mount failure the created `target` will be automatically cleaned up.

If the config has `encrypted` is set to true, the SCSI device will be encrypted using dm-crypt.

func Unmount

func Unmount(
	ctx context.Context,
	controller,
	lun uint8,
	partition uint64,
	target string,
	config *Config,
) (err error)

Unmount SCSI device mounted at `target`. Cleanup associated dm-verity and dm-crypt devices when necessary.

func UnplugDevice

func UnplugDevice(ctx context.Context, controller, lun uint8) (err error)

UnplugDevice finds the SCSI device on `controller` index `lun` and issues a guest initiated unplug.

If the device is not attached returns no error.

Types

type Config added in v0.10.0

type Config struct {
	Encrypted        bool
	VerityInfo       *guestresource.DeviceVerityInfo
	EnsureFilesystem bool
	Filesystem       string
}

Config represents options that are used as part of setup/cleanup before mounting or after unmounting a device. This does not include options that are sent to the mount or unmount calls.

Jump to

Keyboard shortcuts

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