CLOUDSTACK-9473: storage pool capacity check when volume is resized or migrated#2829
Conversation
…r migrated Storage pool checker is not being called on resize and migrate volume. This may lead to allocated percentage of storage above 100%. Setup: 1 VMware cluster with 2 Hosts. Executed Steps: Applied the following global settings: storage.overprovisioning.factor = 1 pool.storage.allocated.capacity.disablethreshold = 1 pool.storage.capacity.disablethreshold = 1 Restarted management server Executed Resize and migrate pool and Observed that Storage pool checker is not performed on resizeVolume and migrateVolume. Result: Root cause analysis shows storage pool checker is not called when doing migration and resizing. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
4860e33 to
c2a3410
Compare
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2274 |
|
@blueorangutan test matrix |
|
@rhtyd a Trillian-Jenkins matrix job (centos6 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests |
| if (!checkUsagedSpace(pool)) { | ||
| return false; | ||
| } | ||
| if (s_logger.isDebugEnabled()) { |
There was a problem hiding this comment.
Is this if really needed? Can't you just log to debug and let the filter of log4j handle it?
There was a problem hiding this comment.
If log4j does not have debug enabled, then the string concat operation will still be performed by the JVM only when the string is passed to the debug() method it will be ignored. So, it depends if we can afford the CPU/time spent on the operation.
There was a problem hiding this comment.
I think we can afford this tiny bit of extra CPU.
There was a problem hiding this comment.
I think as a matter of principle we should alwas add the check. You never no for what reason someone will alter the message. I like using String.format to construct the message, btw, and then pass the single resulting string to the logger
There was a problem hiding this comment.
What principle?
I also use String.format, and I do not see the problem.
There was a problem hiding this comment.
"bla" + "blob" is a costly operation, basically to memcpy()s. String.format() as well in comparison. We don't want those operations performed if we don't end up using the result in a log statement. so the boolean check potentially saves us a lot of cpu cycles, especially in the debug() and trace() cases.
There was a problem hiding this comment.
Yes, I do know that. However, we should ask ourselves, if the addition of a if conditions (it will clutter the code) is worth the CPU cycles. For me, I would not trade readability for this small CPU cost in a web system (ACS is a at the end of the day a Java web application).
| if (!checkUsagedSpace(pool)) { | ||
| return false; | ||
| } | ||
| if (s_logger.isDebugEnabled()) { |
There was a problem hiding this comment.
I think we can afford this tiny bit of extra CPU.
|
|
||
| s_logger.debug("Checking pool: " + pool.getId() + " for volume allocation " + volumes.toString() + ", maxSize : " + totalOverProvCapacity + ", totalAllocatedSize : " | ||
| + allocatedSizeWithTemplate + ", askingSize : " + totalAskingSize + ", allocated disable threshold: " + storageAllocatedThreshold); | ||
| if (s_logger.isDebugEnabled()) { |
There was a problem hiding this comment.
Why checking before logging?
We are removing this from other places. Let's remove conditionals from our code base.
There was a problem hiding this comment.
please let's always check before logging any lower priority (below error)
There was a problem hiding this comment.
I still see no real benefits of adding this log level checks in our context. On the other hand, I do see problems with readability of the code.
I cannot object though, if you want to proceed with this ;)
| StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); | ||
| boolean isManaged = storagePool.isManaged(); | ||
|
|
||
| List<Volume> volumes = new ArrayList<Volume>(); |
There was a problem hiding this comment.
Are you using this variable?
There was a problem hiding this comment.
don't think so and also these methods here are to huge for my puny brain
There was a problem hiding this comment.
My brain only works with up to 10 lines of code methods. Anything else is just a blur.
I think the code is ok; we just need to check if this variable is used; if it is not, please remove it.
DaanHoogland
left a comment
There was a problem hiding this comment.
I agree with the priciple and also the functional bits of code and the extra log-level checks look good. There are some bits (volumes list) that I don't understand/are not needed and a full integration test awaiting 👍
|
Trillian test result (tid-2975)
|
|
Trillian test result (tid-2970)
|
| StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); | ||
| boolean isManaged = storagePool.isManaged(); | ||
|
|
||
| List<Volume> volumes = new ArrayList<Volume>(); |
There was a problem hiding this comment.
My brain only works with up to 10 lines of code methods. Anything else is just a blur.
I think the code is ok; we just need to check if this variable is used; if it is not, please remove it.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
|
Packaging failed due to backend error, rekicking. |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✖centos7 ✖debian. JID-2284 |
|
Packaging result: ✖centos6 ✖centos7 ✖debian. JID-2285 |
|
Packaging result: ✖centos6 ✔centos7 ✔debian. JID-2286 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2987)
|
|
Test lgtm |
…louds' Normalização dos valores das configurações globais relacionadas à deleção em _batch_ de registros do banco de dados Closes apache#2829 See merge request scclouds/scclouds!1226
This was previously opened as PR but prematurely closed:
#1931
#1932
Issue: https://issues.apache.org/jira/browse/CLOUDSTACK-9473
Storage pool checker is not being called on resize and migrate volume.
This may lead to allocated percentage of storage above 100%.
Setup:
1 VMware cluster with 2 Hosts.
Executed Steps:
Applied the following global settings:
storage.overprovisioning.factor = 1
pool.storage.allocated.capacity.disablethreshold = 1
pool.storage.capacity.disablethreshold = 1
Restarted management server
Executed Resize and migrate pool and Observed that Storage pool checker is not performed on resizeVolume and migrateVolume.
Result:
Root cause analysis shows storage pool checker is not called when doing migration and resizing.
Signed-off-by: Rohit Yadav rohit.yadav@shapeblue.com
Description
Types of changes
GitHub Issue/PRs
Screenshots (if appropriate):
How Has This Been Tested?
Checklist:
Testing