Skip to content

feat(spc): add feature to limit overprovisioning of cstor volumes#1577

Merged
vishnuitta merged 6 commits intoopenebs-archive:masterfrom
sonasingh46:overprovisioning
Jan 22, 2020
Merged

feat(spc): add feature to limit overprovisioning of cstor volumes#1577
vishnuitta merged 6 commits intoopenebs-archive:masterfrom
sonasingh46:overprovisioning

Conversation

@sonasingh46
Copy link
Copy Markdown
Contributor

@sonasingh46 sonasingh46 commented Jan 7, 2020

This PR adds a feature to limit the over-provisioning of a CStor volume on SPC pools and hence fixes the issue openebs/openebs#2855 for cStor volume provisioned on SPC.
A similar feature for CSPC would be introduced in upcoming PRs.

Refer to following doc for solution approach:
https://docs.google.com/document/d/1JFsrZsOiV9GLG4IJ6mDrbNf5flvS1BKExCzI8J3hX2I/edit
Example :

apiVersion: openebs.io/v1alpha1
kind: StoragePoolClaim
metadata:
  name: disk-claim-auto
spec:
  name: disk-claim-auto
  type: disk
  maxPools: 3
  minPools: 3
  poolSpec:
    poolType: striped
    cacheFile: /tmp/disk-claim-auto.cache
    # Over provisioning is disabled.
    overProvisioning: false

All the pools created under above SPC YAML will obey the over provisioning policy ( i.e. disabled).
Consider an example, if a CStor volume is created with 7G of capacity with n replicas then n pools should be available with availableSpaceOnPool>incomingVolumeCapacity(7G in this case) according to below formula:
availableSpaceOnPool:= (PoolCapacity*threshold/100 - Sum of all existing Volumes Capacities on the pool)
(Here threshold is by default 70% and can be overridden with OpenEBS annotations. A separate PR needs to be raised for this threshold overriding ability.)
If n such pools are not found -- the provisioning will fail.

One more point to note is that, if overprovisioning is disabled on SPC then all the pools(CSP) of that SPC will have overprovisioning disabled. There is no such case where one pool of SPC will have overprovisioning disabled and another one enabled.
In short, the overprovisioning policy specified on SPC applies homogenously to all the CSPs(pools) of the SPC.
Signed-off-by: Ashutosh Kumar ashutosh.kumar@openebs.io

Special notes for your reviewer:
Needs an e2e verification of the current feature.
Needs an e2e verification to check for regression(if any) of other existing policies of CVR placement.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

Signed-off-by: Ashutosh Kumar <ashutosh.kumar@openebs.io>
@sonasingh46 sonasingh46 self-assigned this Jan 7, 2020
@sonasingh46 sonasingh46 changed the title [WIP]feat(spc): add feature to limit overprovisioning of cstor volumes feat(spc): add feature to limit overprovisioning of cstor volumes Jan 7, 2020
@sonasingh46 sonasingh46 added needs-review pr/release-note PR should be included in release notes labels Jan 7, 2020
@kmova kmova added this to the 1.7.0 milestone Jan 8, 2020
Copy link
Copy Markdown

@AmitKumarDas AmitKumarDas left a comment

Choose a reason for hiding this comment

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

/lgtm

Ashutosh Kumar added 2 commits January 17, 2020 13:01
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Ashutosh Kumar added 2 commits January 17, 2020 14:43
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Copy link
Copy Markdown

@mittachaitu mittachaitu left a comment

Choose a reason for hiding this comment

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

changes are good

var totalcapcity resource.Quantity
cstorVolumeMap := make(map[string]bool)
label := string(apis.CStorPoolKey) + "=" + csp.Name
cstorVolumeReplicaObjList, err := cstorvolumereplica.NewKubeclient().WithNamespace(p.openebsNamespace).List(metav1.ListOptions{LabelSelector: label})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does CVRs always stay in openebsNamespace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

openebsNamespace is the namespace where openebs is installed. And CVRs always stay in a namespace where openebs is installed.


// getCStorVolumeCapacity returns the capacity present on a CStorVolume CR.
func (p *scheduleWithOverProvisioningAwareness) getCStorVolumeCapacity(name string) (resource.Quantity, error) {
cv, err := cstorvolume.NewKubeclient().WithNamespace(p.openebsNamespace).Get(name, metav1.GetOptions{})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does cv stays in openebsNamespace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above

Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
func getVolumeCapacity(values ...string) (resource.Quantity, error) {
var capacity string
for _, val := range values {
if strings.Contains(val, string(volumeCapacityLabel)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where are we filling this label with total capacity?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok.. got it.. this is the capacity of the volume to be provisioned

Copy link
Copy Markdown
Contributor

@vishnuitta vishnuitta left a comment

Choose a reason for hiding this comment

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

changes are good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review pr/release-note PR should be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants