-
Notifications
You must be signed in to change notification settings - Fork 1.3k
flasharray: fall back to array capacity when pod has no quota #13050
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
base: 4.22
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -453,18 +453,46 @@ public void disconnect() { | |||||||
| @Override | ||||||||
| public ProviderVolumeStorageStats getManagedStorageStats() { | ||||||||
| FlashArrayPod pod = getVolumeNamespace(this.pod); | ||||||||
| // just in case | ||||||||
| if (pod == null || pod.getFootprint() == 0) { | ||||||||
| if (pod == null) { | ||||||||
| return null; | ||||||||
| } | ||||||||
| Long capacityBytes = pod.getQuotaLimit(); | ||||||||
| Long usedBytes = pod.getQuotaLimit() - (pod.getQuotaLimit() - pod.getFootprint()); | ||||||||
| if (capacityBytes == null || capacityBytes == 0) { | ||||||||
| // Pod has no explicit quota set; report the array total physical | ||||||||
| // capacity so the CloudStack allocator has a real ceiling to plan | ||||||||
| // against rather than bailing out with a zero-capacity pool. | ||||||||
| capacityBytes = getArrayTotalCapacity(); | ||||||||
| } | ||||||||
| if (capacityBytes == null || capacityBytes == 0) { | ||||||||
| return null; | ||||||||
| } | ||||||||
| Long usedBytes = pod.getFootprint(); | ||||||||
| if (usedBytes == null) { | ||||||||
| usedBytes = 0L; | ||||||||
| } | ||||||||
| ProviderVolumeStorageStats stats = new ProviderVolumeStorageStats(); | ||||||||
| stats.setCapacityInBytes(capacityBytes); | ||||||||
| stats.setActualUsedInBytes(usedBytes); | ||||||||
| return stats; | ||||||||
| } | ||||||||
|
|
||||||||
| private Long getArrayTotalCapacity() { | ||||||||
| try { | ||||||||
| FlashArrayList<Map<String, Object>> list = GET("/arrays?space=true", | ||||||||
| new TypeReference<FlashArrayList<Map<String, Object>>>() { | ||||||||
| }); | ||||||||
| if (list != null && list.getItems() != null && !list.getItems().isEmpty()) { | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Object cap = list.getItems().get(0).get("capacity"); | ||||||||
| if (cap instanceof Number) { | ||||||||
| return ((Number) cap).longValue(); | ||||||||
| } | ||||||||
| } | ||||||||
| } catch (Exception e) { | ||||||||
| logger.warn("Could not retrieve array total capacity", e); | ||||||||
|
||||||||
| logger.warn("Could not retrieve array total capacity", e); | |
| logger.warn("Could not retrieve array total capacity for configured pod [{}]: {}", this.pod, e.getMessage()); | |
| logger.debug("Error retrieving array total capacity for configured pod [{}]", this.pod, e); |
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.
Calling
GET("/arrays?space=true")insidegetManagedStorageStats()can add a second REST request on every storage-stats refresh whenever a pod has no quota. SinceFlashArrayAdapterFactoryconstructs a new adapter per call, this likely won’t be amortized/cached and could create avoidable API load. Consider memoizing the array capacity (e.g., static cache keyed by URL with a TTL) or persisting the discovered capacity into CloudStack pool details so subsequent stats calls don’t need to re-query/arrayseach time.