Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Auto distribute count based on Max brick size #1386

Merged
merged 4 commits into from
Dec 13, 2018
Merged

Auto distribute count based on Max brick size #1386

merged 4 commits into from
Dec 13, 2018

Conversation

aravindavk
Copy link
Member

While creating auto provisioned volume, support added to automatically
calculate the distribute count based on max brick size specified in
the request.

For example, below command creates 2x3(Distributed replicate) volume

glustercli volume create gv1 --replica 3 --size 1G \
        --max-brick-size 512M

Fixes: #999
Signed-off-by: Aravinda VK avishwan@redhat.com

@ghost ghost assigned aravindavk Dec 12, 2018
@ghost ghost added the in progress label Dec 12, 2018
@@ -102,10 +104,16 @@ func smartVolumeCreate(cmd *cobra.Command, args []string) {
failure("Invalid File Size specified", nil, 1)
}

maxBrickSize, err := sizeToBytes(flagCreateMaxBrickSize)
Copy link
Member

Choose a reason for hiding this comment

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

if flagCreateMaxBrickSize has changed then do size calculation?

Copy link
Member Author

Choose a reason for hiding this comment

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

sizeToBytes returns zero when input is empty, no conversion/calculation done

@@ -407,6 +407,54 @@ func testSmartVolumeDistributeDisperse(t *testing.T) {
checkZeroLvs(r)
}

func testSmartVolumeAutoDistributeReplicate(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

can you add some negative test cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

what kind of negative tests I can add? negative max-brick-size or max-brick-size is greater than request size?

Copy link
Member

Choose a reason for hiding this comment

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

kind of invalid minimum and maximum values for max-brick-size

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

While creating auto provisioned volume, support added to automatically
calculate the distribute count based on max brick size specified in
the request.

For example, below command creates 2x3(Distributed replicate) volume

```
glustercli volume create gv1 --replica 3 --size 1G \
        --max-brick-size 512M
```

Fixes: #999
Signed-off-by: Aravinda VK <avishwan@redhat.com>
@aravindavk
Copy link
Member Author

@Madhu-1 please review

@aravindavk
Copy link
Member Author

Found one more issue in Volume create flow, opened issue #1389

@@ -345,3 +341,12 @@ func ExtendThinpool(expansionTpSizePerBrick uint64, vgName string, tpName string
err := utils.ExecuteCommandRun("lvextend", fmt.Sprintf("-L+%dB", expansionTpSizePerBrick), fmt.Sprintf("/dev/%s/%s", vgName, tpName))
return err
}

// NormalizeSize converts the value to multiples of 512
Copy link
Member

Choose a reason for hiding this comment

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

can we make it unexported function?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is used in glusterd2/bricksplanner as well


// If max Brick size is specified then decide distribute
// count and Volume Size based on Volume Type
if req.MaxBrickSize > 0 && req.Size > req.MaxBrickSize {
Copy link
Member

Choose a reason for hiding this comment

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

what happens if req.MaxBrickSize if greater than req.Size?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will be same as not passing that option

Copy link
Member

Choose a reason for hiding this comment

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

as this is an input request we need to return an error to the user.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that is an error. It is satisfying the user's condition of max-brick-size.

SubvolZonesOverlap: true,
}
volinfo, err = client.VolumeCreate(createReq)
r.Nil(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be r.NotNil (err) , how is this going to succeed if the MaxBrickSize is greater than Size ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ignore this now, basically this will allocate only 1 sub vol of 20 MiB.

Copy link
Member Author

Choose a reason for hiding this comment

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

MaxBrickSize > VolumeSize condition will always satisfy. So this satisfies user's condition.

SubvolZonesOverlap: true,
}
volinfo, err = client.VolumeCreate(createReq)
r.Nil(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need a similar test for arbiter volume as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

max subvol size is derived based on volume type and req.MaxBrickSize. This calculation is same for Arbiter/Replica. Special handling only for Disperse volume.

Copy link
Contributor

@atinmu atinmu left a comment

Choose a reason for hiding this comment

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

How would this max brick size be leveraged in PVC request? I see that if this isn't passed then we don't decide on the distribute count.

@aravindavk
Copy link
Member Author

How would this max brick size be leveraged in PVC request? I see that if this isn't passed then we don't decide on the distribute count.

Two ways we can distribute now,

  • Specify distribute count in the Volume create request
  • Specify max-brick-size and calculate the distribute count automatically.

Max brick size can be added in Storage class definition irrespective of Volume sizes. That will be passed with every volume create request. (For example, max-brick-size=10GiB). If Volume requested of size less than that value will be created without distribute.

Currently max-brick-size takes precedence over the distribute-count parameter in Volume create request. That means if request contains distribute=3, max-brick-size=512M and size=1G then it will create volume with distribute count 2(Distribute count specified in request is ignored). Let me know if you feel this precedence needs to be reversed.(If distribute count is specified then do not consider max-brick-size)

@atinmu
Copy link
Contributor

atinmu commented Dec 13, 2018

@aravindavk I'm not sure if distributeCount and maxBricksSize parameters input value should co-exist but if they do then I agree that maxBrickSize should take precedence as distribute count should be more internal and should be managed intelligently by GD2.

@atinmu
Copy link
Contributor

atinmu commented Dec 13, 2018

@aravindavk @Madhu-1 don't we need a respective change in the gluster-csi-driver once this gets in? If so, I think we need an issue tracking this.

@Madhu-1
Copy link
Member

Madhu-1 commented Dec 13, 2018

@atinmu currently we are just making use of size and volume type in volume create,we will make required changes in CSI driver.

@rishubhjain
Copy link
Contributor

Fixes: #1398

@aravindavk
Copy link
Member Author

Opened issue to support these options in CSI driver gluster/gluster-csi-driver#120

@aravindavk
Copy link
Member Author

retest this please

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants