controller get capacity method added#483
controller get capacity method added#483basit9958 wants to merge 2 commits intodigitalocean:masterfrom
Conversation
Signed-off-by: Basit Hasan <hasanbasit13@gmail.com>
timoreimann
left a comment
There was a problem hiding this comment.
Hey @basit9958 , thanks for your contribution.
I mentioned one relevant point; there are a few others worth calling out, but I'd like to get alignment first on what GetCapacity should do in order to make sure we're on the same page.
driver/controller.go
Outdated
|
|
||
| // Create a new response object | ||
| resp := &csi.GetCapacityResponse{ | ||
| AvailableCapacity: totalCapacity, |
There was a problem hiding this comment.
AFAIU the spec for GetCapacity, the availability capacity is not how much storage capacity is currently in use but how much capacity is available to the user.
I believe this is essentially the volume limit (which we still reference to some extent in the checkLimit method that is otherwise unused and was missed for removal in #481) minus the currently used capacity.
There was a problem hiding this comment.
Yes you are correct, we can use limitdetails.limit and minus it with used capacity. Used capacity can be calculated by checking volumes whose droplet id are not nil and adding their size.
@timoreimann It should return the total amount of storage capacity that can be allocated for volumes, minus the capacity already in use by existing volumes. I'll update the code tomorrow |
Signed-off-by: Basit Hasan <hasanbasit13@gmail.com>
cc @fatih