You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 336154a
Browse filesBrowse the repository at this point in the historyBrowse files
[CSTACKEX-339] ASUP Upstream review comments (#117)
### Description
Upstream PR : apache#14193
1- This allocates an intermediate list and then traverses it three more
times. Since this runs once per pool per interval, on very large pools
this adds avoidable CPU/GC overhead. Consider computing rootDiskCount,
dataDiskCount, and totalLogicalSizeBytes in a single pass over volumes
(filtering by CS_VOLUME_STATES inline) to reduce allocations and
repeated streaming.
2- This treats a missing/unknown is_all_flash_optimized (null) as false,
which classifies the node as fas and can incorrectly set cluster
platformType when ONTAP doesn’t return these fields (permissions/older
versions/partial responses). Consider returning null (unknown) when the
required flags are absent and only adding non-null classifications to
the rollup set so ASUP doesn’t misreport hardware type.
3- The DAO method is documented as “non-destroyed” volumes, but the SQL
currently includes volumes in transitional/pre-provisioning states
(e.g., Allocated) because it only excludes Destroy/Expunged. That can
incorrectly flip multiPrimaryStoragePoolVm=true for VMs whose data disk
hasn’t actually been created/moved yet. Tighten the state predicates to
align with the intended “physically exists” semantics (e.g., include
only the same stable states you count elsewhere, or explicitly exclude
Allocated/upload-related states).
4- lock.unlock() is executed even when lock.lock(...) returns false
(early return), which can attempt to unlock a lock this thread never
acquired. Additionally, GlobalLock.getInternLock(...) typically requires
releasing the reference (e.g., releaseRef()) to avoid leaking the
interned lock object. Track a boolean locked and only unlock() when
true, and ensure the lock reference is released in finally (even when
not acquired).
fixed the above issues
<!---
*******************************************************************************
-->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*******************************************************************************
-->
### 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)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [x] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->
#### How did you try to break this feature and the system with this
change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->
---------
Co-authored-by: Gupta, Surya <Surya.Gupta@netapp.com>
Copy file name to clipboardExpand all lines: engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -96,14 +96,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
96
96
protectedstaticfinalStringSELECT_HYPERTYPE_FROM_CLUSTER_VOLUME = "SELECT c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?";
97
97
protectedstaticfinalStringSELECT_HYPERTYPE_FROM_ZONE_VOLUME = "SELECT s.hypervisor from volumes v, storage_pool s where v.pool_id = s.id and v.id = ?";
98
98
protectedstaticfinalStringSELECT_POOLSCOPE = "SELECT s.scope from storage_pool s, volumes v where s.id = v.pool_id and v.id = ?";
99
-
// Looks for a VM whose root disk is on this pool and whose data disk is on another pool.
99
+
// Looks for a VM whose Ready root disk is on this pool and whose attached Ready data disk is on another pool.
100
100
// LIMIT 1 stops after the first match so we do not load all volumes.
"SELECT 1 FROM volumes root INNER JOIN volumes data ON data.instance_id = root.instance_id "
103
103
+ "WHERE root.pool_id = ? AND root.volume_type = 'ROOT' AND root.instance_id IS NOT NULL "
104
-
+ "AND root.removed IS NULL AND root.state NOT IN ('Destroy', 'Expunged') "
104
+
+ "AND root.removed IS NULL AND root.state = 'Ready' "
105
105
+ "AND data.volume_type = 'DATADISK' AND data.pool_id IS NOT NULL AND data.pool_id <> ? "
106
-
+ "AND data.removed IS NULL AND data.state NOT IN ('Destroy', 'Expunged') LIMIT 1";
106
+
+ "AND data.removed IS NULL AND data.state = 'Ready' LIMIT 1";
107
107
108
108
privatestaticfinalStringORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT_PART1 = "SELECT pool.id, SUM(IF(vol.state='Ready' AND vol.account_id = ?, 1, 0)) FROM `cloud`.`storage_pool` pool LEFT JOIN `cloud`.`volumes` vol ON pool.id = vol.pool_id WHERE pool.data_center_id = ? ";
109
109
privatestaticfinalStringORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT_PART2 = " GROUP BY pool.id ORDER BY 2 ASC ";
0 commit comments