You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/04/13 12:09:35 UTC

[GitHub] [cloudstack] rhtyd opened a new pull request #4918: Stat collector solidfire capacity fix

rhtyd opened a new pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918


      
       Fixes regression introduced in 71c5dbcf492a023dbea5f8c34f8fd883c3ad653f
       which would cause capacity bytes of certain pools to be update which
       shouldn't get updated by StatsCollector such as solidfire.
       
   Fixes #4911
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [x] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [x] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820373985


   @rhtyd a Trillian-Jenkins matrix job (centos7 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613097354



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {

Review comment:
       @rhtyd may be you can update the capacity bytes (from the 'GetStorageStatsCommand' answer) when it is > 0. Otherwise, better to log a WARN message indicating that answer holds the capacity bytes <= 0.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r614022068



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {
+                                    pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
+                                    poolNeedsUpdating = true;
+                                } else {
+                                    s_logger.warn("Received 0 capacity for pool ID " + poolId);
                                 }
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) && !pool.isManaged()) {

Review comment:
       @rhtyd I think managed pool(s) doesn't use DefaultPrimary as its provider, in that case managed pool check is not required.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820347319


   @blueorangutan package
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818698881


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818704362


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820756561


   <b>Trillian test result (tid-451)</b>
   Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 33430 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t451-xenserver-71.zip
   Intermittent failure detected: /marvin/tests/smoke/test_scale_vm.py
   Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
   Smoke tests completed. 86 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_scale_vm | `Failure` | 9.23 | test_scale_vm.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818685354


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818685236


   cc @ravening - pl review the regression was introduced in 71c5dbcf492a023dbea5f8c34f8fd883c3ad653f
   With the fix, anyone upgrading to 4.15 will be unable to use solidfire storage where the capacity bytes is `0`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r612992973



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
                                 pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
-                                }
+                                poolNeedsUpdating = true;
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) && ((StorageStats)answer).getByteUsed() > 0) {

Review comment:
       This restricts updating, when no bytes used in the pool. Suppose, there are few volumes in the pool which are removed later and the answer for 'GetStorageStatsCommand' returns 0 bytes used for that pool. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613829368



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {

Review comment:
       The code is reverted to how it was structured in 4.11.3; I suppose at least the solidfire storage pool capacity wouldn't reset to 0. But good idea to add some guarding (either for the 0 check or if the pool is solidfire).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820781942


   <b>Trillian test result (tid-452)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 36397 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t452-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
   Smoke tests completed. 87 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820944127


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818703739


   @blueorangutan test centos7 vmware-67u3


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820347662


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820944311


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820373700


   @blueorangutan test matrix 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r614591733



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {
+                                    pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
+                                    poolNeedsUpdating = true;
+                                } else {
+                                    s_logger.warn("Not setting capacity bytes, received " + ((StorageStats)answer).getCapacityBytes()  + " capacity for pool ID " + poolId);
                                 }
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {

Review comment:
       Thanks @sureshanaparti @mike-tutkowski - I've addressed the comment, removed the check for managed storage.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820361430


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 421


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
nvazquez commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r614201836



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {
+                                    pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
+                                    poolNeedsUpdating = true;
+                                } else {
+                                    s_logger.warn("Received 0 capacity for pool ID " + poolId);

Review comment:
       ```suggestion
                                       s_logger.warn("Not setting capacity bytes, received " + ((StorageStats)answer).getCapacityBytes()  + " capacity for pool ID " + poolId);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820244159


   @blueorangutan package
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-819099763


   <b>Trillian test result (tid-433)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 35021 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t433-vmware-67u3.zip
   Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
   Smoke tests completed. 86 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_10_traceroute_in_vr | `Failure` | 61.32 | test_diagnostics.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613097354



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {

Review comment:
       @rhtyd may be you can update the capacity bytes (from the 'GetStorageStatsCommand' answer) when it is > 0. Otherwise, better to log a WARN message indicating that answer holds the capacity bytes <= 0.
   
   Also, updateStoragePool API shouldn't update the capacity bytes of the pool whenever the value passed in the API param "capacitybytes" is <= 0 and < used bytes. (haven't tested this, not sure if it is already working this way).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820957539


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 423


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818698673


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 405


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820989261


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613877895



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {

Review comment:
       @sureshanaparti cc @DaanHoogland added check to log warning when capacity is reported 0; it's updated only when the value is > 0.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818729103


   <b>Trillian Build Failed (tid-432)<b/>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd merged pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613877597



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {
+                                    pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
+                                    poolNeedsUpdating = true;
+                                } else {
+                                    s_logger.warn("Received 0 capacity for pool ID " + poolId);
                                 }
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) && !pool.isManaged()) {

Review comment:
       @sureshanaparti I've added a check to not update when pool is managed, cc @skattoju4 @mike-tutkowski 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818685483


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-821321636


   <b>Trillian test result (tid-465)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 32515 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t465-kvm-centos7.zip
   Smoke tests completed. 87 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613823326



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
                                 pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
-                                }
+                                poolNeedsUpdating = true;
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) && ((StorageStats)answer).getByteUsed() > 0) {

Review comment:
       When pool is added to cloudstack or cloudstack is restarted, if the pool is empty the usage will be set to 0. I see that case, let me see what/how can we handle that. This change was recently added in 4.15 only.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] mike-tutkowski commented on a change in pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
mike-tutkowski commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r614575637



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,22 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), (StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != ((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != ((StorageStats)answer).getByteUsed()) {
-                                pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
-                                if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
-                                    pool.setUsedBytes(((StorageStats) answer).getByteUsed());
-                                    pool.setUpdateTime(new Date());
+                            if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
+                                if (((StorageStats)answer).getCapacityBytes() > 0) {
+                                    pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
+                                    poolNeedsUpdating = true;
+                                } else {
+                                    s_logger.warn("Received 0 capacity for pool ID " + poolId);
                                 }
+                            }
+                            if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) && !pool.isManaged()) {

Review comment:
       That's a good point about managed-storage providers not using DefaultPrimary. Each of these storage providers probably provides its own plug-in.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820989489


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-820831316


   <b>Trillian test result (tid-457)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 33848 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t457-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
   Smoke tests completed. 86 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_03_ssvm_internals | `Failure` | 3.12 | test_ssvm.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-818699028


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4918: Stat collector solidfire capacity fix

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#issuecomment-821444943


   <b>Trillian test result (tid-468)</b>
   Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 35088 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4918-t468-vmware-65u2.zip
   Smoke tests completed. 87 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org