Documentation
¶
Index ¶
- type Controller
- func (c *Controller) MapToGuest(ctx context.Context, reservation uuid.UUID) (string, error)
- func (c *Controller) Reserve(ctx context.Context, diskConfig disk.DiskConfig, mountConfig mount.MountConfig) (uuid.UUID, error)
- func (c *Controller) ReserveForRootfs(ctx context.Context, controller, lun uint) error
- func (c *Controller) UnmapFromGuest(ctx context.Context, reservation uuid.UUID) error
- type LinuxGuestSCSIOps
- type VMSCSIOps
- type WindowsGuestSCSIOps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
The controller manages all SCSI attached devices and guest mounted directories.
It is required that all callers:
1. Obtain a reservation using Reserve().
2. Use the reservation to MapToGuest() to ensure resource availability.
3. Call UnmapFromGuest() to release the reservation and all resources.
If MapToGuest() fails, the caller must call UnmapFromGuest() to release the reservation and all resources.
If UnmapFromGuest() fails, the caller must call UnmapFromGuest() again until it succeeds to release the reservation and all resources.
func New ¶
func New(numControllers int, vm VMSCSIOps, lGuest LinuxGuestSCSIOps, wGuest WindowsGuestSCSIOps) *Controller
func (*Controller) MapToGuest ¶
func (*Controller) Reserve ¶
func (c *Controller) Reserve(ctx context.Context, diskConfig disk.DiskConfig, mountConfig mount.MountConfig) (uuid.UUID, error)
Reserves a referenced counted mapping entry for a SCSI attachment based on the SCSI disk path, and partition number.
If an error is returned from this function, it is guaranteed that no reservation mapping was made and no UnmapFromGuest() call is necessary to clean up.
func (*Controller) ReserveForRootfs ¶
func (c *Controller) ReserveForRootfs(ctx context.Context, controller, lun uint) error
ReserveForRootfs reserves a specific controller and lun location for the rootfs. This is required to ensure the rootfs is always at a known location and that location is not used for any other disk. This should only be called once per controller and lun location, and must be called before any calls to Reserve() to ensure the rootfs reservation is not evicted by a dynamic reservation.
func (*Controller) UnmapFromGuest ¶
type LinuxGuestSCSIOps ¶
type LinuxGuestSCSIOps interface {
mount.LinuxGuestSCSIMounter
mount.LinuxGuestSCSIUnmounter
disk.LinuxGuestSCSIEjector
}
type VMSCSIOps ¶
type VMSCSIOps interface {
disk.VMSCSIAdder
disk.VMSCSIRemover
}
type WindowsGuestSCSIOps ¶
type WindowsGuestSCSIOps interface {
mount.WindowsGuestSCSIMounter
mount.WindowsGuestSCSIUnmounter
}