-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add API to update storage config on an instance #27
Conversation
Codecov Report
@@ Coverage Diff @@
## master #27 +/- ##
=========================================
+ Coverage 2.83% 3.31% +0.48%
=========================================
Files 10 11 +1
Lines 2470 2534 +64
=========================================
+ Hits 70 84 +14
- Misses 2396 2446 +50
Partials 4 4
Continue to review full report at Codecov.
|
Can you separate out the vendor changes into a separate commit ? |
Done |
21808e8
to
ab41a3c
Compare
Added support for update storage config on azure and updated the azure UTs. Also made a change so that the expected response will match user requested IOPS more closely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only looked at the storage distribution changes.
Will check the vsphere changes shortly
IOPS: row.IOPS, | ||
} | ||
|
||
if requiredDriveSize > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is just my preference.
We should split this function into two functions.
- getStoragePoolForRequestedDriveSize
- getStoragePool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vsphere changes look good.
I still have some questions on the storage distribution changes.
DesiredCapacity uint64 `json:"new_capacity" yaml:"new_capacity"` | ||
// ResizeOperationType is the operation user wants for the storage resize on the node | ||
ResizeOperationType api.SdkStoragePool_ResizeOperationType | ||
// CurrentDriveCount is the current number of drives in the storage pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is the current number of drives on the node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we need two counts. One for the StoragePool we are updating and one for total no. of drives on the node.
filteredRows = utils.SortByIOPS(filteredRows) | ||
// Filter out rows which have lower IOPS than required | ||
var index int | ||
for index = 0; index < len(filteredRows); index++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this for is not needed as requiredIOPS is 0 in this else condition.
filteredRows = utils.SortByPriority(filteredRows) | ||
} | ||
|
||
if len(requiredDriveType) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this duplicate if.
} | ||
|
||
// additional check so that we are not overprovisioning | ||
for instancesPerZone > 1 && instStorage.DriveCapacityGiB*instancesPerZone > minCapacityPerZone { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
Can we just check if the cluster capacity is less than maxCapacityPerZone otherwise the outer for loop already reduces the instancesPerZone and recalculates.
Also you should consider DriveCount as well instStorage.DriveCapacityGiB*instancesPerZone*instStorage.DriveCount
} | ||
|
||
} else { | ||
logrus.Debugf("required capacity: %d GiB is lower than row's min size: %d GiB", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not try the next candidate row / reduce the instances per zone and retry the same row?
remainingCapacity := int(requiredCapacity) | ||
for remainingCapacity > 0 { | ||
remainingCapacity -= int(requiredDriveSize) | ||
instStorage.DriveCount++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if instStorage.DriveCount < row.InstanceMaxDrives
// check in matrix if this drive can be resized to newMinCapacityPerDrive | ||
newMinCapacityPerDrive := request.CurrentDriveSize + newMinDeltaCapacityPerDrive | ||
logrus.Debugf("need to resize drive to atleast: %d GiB", newMinCapacityPerDrive) | ||
instStorage, err := instanceStorageForRow(row, newMinCapacityPerDrive, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instanceStorageForRow also increments the DriveCount, but this switch case only wants to resize the disk.
Probably we don't need to check the matrix, but just find the row for the current instStorage and check if resizing the drives is within row.MaxSize.
newSizeInKiB := int64(newSizeInGiB) * 1024 * 1024 | ||
if editDisk.CapacityInKB >= newSizeInKiB { | ||
return uint64(editDisk.CapacityInKB / (1024 * 1024)), cloudops.NewStorageError(cloudops.ErrDiskGreaterOrEqualToExpandSize, | ||
fmt.Sprintf("disk is already has a size: %d KiB greater than or equal "+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fix error message.
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
- Change update storage API to storage pool - Simplify logic to calculate update config - misc renames Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Signed-off-by: Harsh Desai <[email protected]>
Currently has openstorage vendored in from libopenstorage/openstorage#1200
will update to master once merged.
Signed-off-by: Harsh Desai [email protected]