scsi

package
v0.10.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 ControllerLunToName

func ControllerLunToName(ctx context.Context, controller, lun uint8) (_ string, err error)

ControllerLunToName finds the `/dev/sd*` path to the SCSI device on `controller` index `lun`.

func Mount

func Mount(
	ctx context.Context,
	controller,
	lun uint8,
	target string,
	readonly bool,
	encrypted bool,
	options []string,
	verityInfo *guestresource.DeviceVerityInfo) (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 `encrypted` is set to true, the SCSI device will be encrypted using dm-crypt.

func Unmount

func Unmount(
	ctx context.Context,
	controller,
	lun uint8,
	target string,
	encrypted bool,
	verityInfo *guestresource.DeviceVerityInfo,
) (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

This section is empty.

Jump to

Keyboard shortcuts

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