Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type DeviceManager ¶
type DeviceManager interface { // NewDevice retrieves the device if the device is already assigned. // Otherwise it creates a new device with next available device name // and mark it as unassigned device. NewDevice(instance *ec2.Instance, volumeID string) (device *Device, err error) // GetDevice returns the device already assigned to the volume. GetDevice(instance *ec2.Instance, volumeID string) (device *Device, err error) }
func NewDeviceManager ¶
func NewDeviceManager() DeviceManager
type ExistingNames ¶
ExistingNames is a map of assigned device names. Presence of a key with a device name in the map means that the device is allocated. Value is irrelevant and can be used for anything that NameAllocator user wants. Only the relevant part of device name should be in the map, e.g. "ba" for "/dev/xvdba".
type NameAllocator ¶
type NameAllocator interface { // GetNext returns a free device name or error when there is no free device // name. Only the device name is returned, e.g. "ba" for "/dev/xvdba". // It's up to the called to add appropriate "/dev/sd" or "/dev/xvd" prefix. GetNext(existingNames ExistingNames) (name string, err error) }
On AWS, we should assign new (not yet used) device names to attached volumes. If we reuse a previously used name, we may get the volume "attaching" forever, see https://aws.amazon.com/premiumsupport/knowledge-center/ebs-stuck-attaching/. NameAllocator finds available device name, taking into account already assigned device names from ExistingNames map. It tries to find the next device name to the previously assigned one (from previous NameAllocator call), so all available device names are used eventually and it minimizes device name reuse.