Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple disk with capacity based scheduling(Phase3) #121

Merged
merged 5 commits into from Jul 28, 2018

Conversation

JacieChao
Copy link
Contributor

@JacieChao JacieChao commented Jul 26, 2018

Phase 3(longhorn/longhorn#47):

  • Add State to DiskStatus
  • Add StorageOverProvisioningPercentage and StorageMinimalAvailablePercentage to settings
  • Update Node Controller to watch StorageOverProvisioningPercentage and StorageMinimalAvailablePercentage settings and update DiskState
  • Update Replica Scheduler logic, using StorageOverProvisioningPercentage and StorageMinimalAvailablePercentage from settings
  • Update replica scheduler tests
  • Add integration tests for DiskState and over-provisioning and minimal available storage settings

integration test for Phase3(longhorn/longhorn-tests#81)

Copy link
Member

@yasker yasker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good for the first round of review!

types/setting.go Outdated

SettingDefinitionStorageOverProvisioningPercentage = SettingDefinition{
DisplayName: "Storage Over Provisioning Percentage",
Description: "The setting used for multiple disk scheduling, set the upper bound of disks",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The over-provisioning percentage defines how much storage can be allocated relative to the hard drive's capacity

types/setting.go Outdated

SettingDefinitionStorageMinimalAvailablePercentage = SettingDefinition{
DisplayName: "Storage Minimal Available Percentage",
Description: "The setting used for multiple disk scheduling, set the bottom bound of disks",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one disk's available capacity to it's maximum capacity in % is less than the minimal available percentage, the disk would become unschedulable until more space freed up.

@@ -240,6 +288,12 @@ func (nc *NodeController) syncDiskStatus(node *longhorn.Node) error {
return err
}

// get settings of StorageOverProvisioningPercentage and StorageMinimalAvailablePercentage
overProvisioningPercentage, minimalAvailablePercentage, err := nc.ds.GetSettingsForDisk()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too easy to mess up with returning two identical types of variables. It's better to either pass in as a typed struct or separate them into two functions. I think two functions are better here.

We can replace the datastore function with GetSettingAsInt(). It can check if the type is indeed int before return.

@@ -266,6 +320,16 @@ func (nc *NodeController) syncDiskStatus(node *longhorn.Node) error {
diskStatus.StorageAvailable = diskInfo.StorageAvailable
}

// check disk pressure
if overProvisioningPercentage == 0 ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calculation for overProvisioningPercentage and minimalAvailablePercentage should be already covered by the formula. Shouldn't need special case handling for them (except dividing zero if that happens).

if overProvisioningPercentage == 0 ||
minimalAvailablePercentage == 100 ||
diskInfo == nil ||
diskInfo.StorageAvailable < disk.StorageMaximum*minimalAvailablePercentage/100 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use <= instead of < so you can cover minimalAvailablePercentage == 100.

@@ -692,3 +693,26 @@ func tagNodeLabel(replica *longhorn.Replica) error {
metadata.SetLabels(labels)
return nil
}

func (s *DataStore) GetSettingsForDisk() (int64, int64, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said, replace with GetSettingAsInt() (int64, error)

@JacieChao
Copy link
Contributor Author

@yasker Fixed manager

@yasker
Copy link
Member

yasker commented Jul 27, 2018

LGTM. Will merge when test is ready.

Add StorageOverProvisioningPercentage and StorageMinimalAvailable to
update disk state
Add StorageOverProvisioningPercentage and
StorageMinimalAvailablePercentage and disk state to scheduling.
@JacieChao
Copy link
Contributor Author

@yasker Rebased master and add scheduling category to settings

@yasker yasker merged commit 9e2bd3e into longhorn:master Jul 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants