Skip to content

Linstor: implement volume and storage stats #10850

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

Merged
merged 2 commits into from
May 13, 2025

Conversation

rp-
Copy link
Contributor

@rp- rp- commented May 12, 2025

Description

Using storage stats not every agent has to query the controller
for current used and capacity storage.

Volume stats will show physical used size for thin volume in Cloudstack.
This volume stats are cached to not query the Linstor controller each
time a volume is asked for.
Fixes: #10142

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • 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

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Fresh Linstor cluster, basic operations

How did you try to break this feature and the system with this change?

rp- added 2 commits May 12, 2025 12:11
Using storage stats not every agent has to query the controller
for current used and capacity storage.

Volume stats will show physical used size for thin volume in Cloudstack.
This volume stats are cached to not query the Linstor controller each
time a volume is asked for.
@rp- rp- self-assigned this May 12, 2025
@rp- rp- changed the title Linstor 4.19 implement stats Linstor: implement volume and storage stats May 12, 2025
Copy link

codecov bot commented May 12, 2025

Codecov Report

Attention: Patch coverage is 2.59740% with 75 lines in your changes missing coverage. Please review.

Project coverage is 15.17%. Comparing base (bcd23eb) to head (e7ac613).
Report is 3 commits behind head on 4.19.

Files with missing lines Patch % Lines
...tore/driver/LinstorPrimaryDataStoreDriverImpl.java 4.00% 48 Missing ⚠️
...cloudstack/storage/datastore/util/LinstorUtil.java 0.00% 25 Missing ⚠️
...ge/datastore/util/LinstorConfigurationManager.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              4.19   #10850       +/-   ##
============================================
+ Coverage     4.28%   15.17%   +10.88%     
- Complexity       0    11343    +11343     
============================================
  Files          371     5415     +5044     
  Lines        29700   475407   +445707     
  Branches      5211    58007    +52796     
============================================
+ Hits          1274    72133    +70859     
- Misses       28281   395210   +366929     
- Partials       145     8064     +7919     
Flag Coverage Δ
uitests 4.28% <ø> (ø)
unittests 15.89% <2.59%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland DaanHoogland requested a review from Copilot May 12, 2025 13:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements volume and storage statistics for Linstor to reduce controller queries for storage usage.

  • Updated dependency version for cs.java-linstor in pom.xml
  • Added new utility methods in LinstorUtil to calculate storage stats and check for diskless resources
  • Updated LinstorPrimaryDataStoreDriverImpl to offer storage and volume stats with caching, and introduced a new configuration for cache time

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pom.xml Bumped cs.java-linstor version to 0.6.1 to support enhancements
LinstorUtil.java Added methods for calculating storage stats and determining diskless resources
LinstorConfigurationManager.java Introduced new configuration key for caching volume stats
LinstorPrimaryDataStoreDriverImpl.java Enabled storage stats, implemented volume stats caching and retrieval logic
CHANGELOG.md Updated changelog with new storage/volume stats feature
Comments suppressed due to low confidence (1)

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java:1579

  • Ensure that the cache key constructed with LinstorUtil.RSC_PREFIX matches the keys used when populating the cache in fillVolumeStatsCache. If the resource names stored in the cache already include the expected prefix, the extra concatenation could lead to cache misses.
return volumeStats.get(LinstorUtil.RSC_PREFIX + volumeId);

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@DaanHoogland DaanHoogland added this to the 4.19.3 milestone May 12, 2025
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13346

@rohityadavcloud rohityadavcloud requested a review from Pearl1594 May 12, 2025 16:52
Copy link
Contributor

@Pearl1594 Pearl1594 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM.

@DaanHoogland
Copy link
Contributor

no core code is touched, GHA passes, merging as is.

@DaanHoogland DaanHoogland merged commit 88ce639 into apache:4.19 May 13, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants