storagedistribution

package
v0.0.0-...-1aa1ecb Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDisk

AddDisk tries to satisfy the StoragePoolUpdateRequest by adding more disks to the existing storage pool. Following is a high level algorithm/steps used to achieve this: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Calculate deltaCapacity = input.RequestedCapacity - input.CurrentCapacity // - Calculate currentDriveSize from the request. // - Calculate the requiredDriveCount for achieving the deltaCapacity. // - Find out if any rows from the decision matrix fit in our new configuration //

  • Filter out the rows which do not have the same input.DriveType //
  • Filter out rows which do not fit input.CurrentDriveSize in row.MinSize and row.MaxSize //
  • Filter out rows which do not fit requiredDriveCount in row.InstanceMinDrives and row.InstanceMaxDrives //

- Pick the 1st row from the decision matrix as your candidate. // - If no row found: //

  • failed to AddDisk //

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func GetMaxDriveSize

func GetMaxDriveSize(
	request *cloudops.MaxDriveSizeRequest,
	decisionMatrix *cloudops.StorageDecisionMatrix,
) (*cloudops.MaxDriveSizeResponse, error)

GetMaxDriveSize returns the max drive size given an input cloud drive type Filter out rows matching input drive type Process the rows to find the max size

func GetStorageDistributionForPool

func GetStorageDistributionForPool(
	decisionMatrix *cloudops.StorageDecisionMatrix,
	request *cloudops.StorageSpec,
	requestedInstancesPerZone uint64,
	zoneCount uint64,
) (*cloudops.StoragePoolSpec, uint64, *cloudops.StorageDecisionMatrixRow, error)

GetStorageDistributionForPool tries to determine a drive configuration to satisfy the input storage pool requirements. Following is a high level algorithm/steps used to achieve this:

//////////////////////////////////////////////////////////////////////////// - Calculate minCapacityPerZone = input.MinCapacity / zoneCount // - Calculate maxCapacityPerZone = input.MaxCapacity / zoneCount // - Filter the decision matrix based of our requirements: //

  • Filter out the rows which do not have the same input.DriveType //
  • Filter out the rows which do not meet input.IOPS //
  • Sort the decision matrix by IOPS //
  • Sort the decision matrix by Priority //

- instancesPerZone = input.RequestedInstancesPerZone // - (row_loop) For each of the filtered row: //

  • (instances_per_zone_loop) For instancesPerZone > 0: //
  • Find capacityPerNode = minCapacityPerZone / instancesPerZone //
  • (drive_count_loop) For driveCount > row.InstanceMinDrives: //
  • driveSize = capacityPerNode / driveCount //
  • If driveSize within row.MinSize and row.MaxSize: // break drive_count_loop (Found candidate) //
  • If (drive_count_loop) fails/exhausts: //
  • reduce instancesPerZone by 1 //
  • goto (instances_per_zone_loop) // Else found candidate //
  • break instances_per_zone_loop (Found candidate) //
  • If (instances_per_zone_loop) fails: //
  • Try the next filtered row //
  • goto (row_loop) //

- If (row_loop) fails: //

  • failed to get a candidate //

////////////////////////////////////////////////////////////////////////////

func GetStorageUpdateConfig

GetStorageUpdateConfig returns the storage configuration for updating an instance's storage based on the requested new capacity. To meet the new capacity requirements this function with either: - Resize existing disks - Add more disks This is based of the ResizeOperationType input argument. If no such input is provided then this function tries Resize first and then an Add. The algorithms for Resize and Add are explained with their respective function definitions.

func ResizeDisk

ResizeDisk tries to satisfy the StoragePoolUpdateRequest by expanding existing disks from the storage pool. Following is a high level algorithm/steps used to achieve this: //////////////////////////////////////////////////////////////////////////////////////////////// - Calculate deltaCapacity = input.RequestedCapacity - input.CurrentCapacity // - Calculate deltaCapacityPerDrive = deltaCapacityPerNode / input.CurrentNumberOfDrivesInPool // - Filter out the rows which do not have the same input.DriveType // - Filter out the rows which do not have the same input.IOPS // - Filter out rows which do not fit input.CurrentDriveSize in row.MinSize and row.MaxSize // - Sort the rows by IOPS // - First row in the filtered decision matrix is our best candidate. // - If input.CurrentDriveSize + deltaCapacityPerDrive > row.MaxSize: //

  • failed to expand // Else //
  • success //

////////////////////////////////////////////////////////////////////////////////////////////////

Types

This section is empty.

Jump to

Keyboard shortcuts

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