Skip to content

<fix>[zbs]: refresh snapshot size by timer and manual query#4396

Open
zstack-robot-2 wants to merge 1 commit into
5.5.28from
sync/xiangheng.zhao/5.5.28
Open

<fix>[zbs]: refresh snapshot size by timer and manual query#4396
zstack-robot-2 wants to merge 1 commit into
5.5.28from
sync/xiangheng.zhao/5.5.28

Conversation

@zstack-robot-2

Copy link
Copy Markdown
Collaborator

Add external primary storage snapshot size query support so manual
snapshot size refresh can fetch the latest ZBS snapshot usedSize from
the agent. XInfini and Expon keep returning the stored DB snapshot size.

Refresh related snapshot sizes before updating volume actual size in
single-volume and batch active-volume size sync paths. This lets the
periodic VolumeSizeTracker update ZBS snapshot usedSize when it scans
active volumes, and keeps manual volume size refresh using the same
snapshot refresh flow.

Test: git diff --check
Test: mvn -pl storage,plugin/zbs,plugin/xinfini,plugin/expon -am -DskipTests compile
Test: mvn -pl storage,plugin/zbs,plugin/xinfini,plugin/expon -am -DskipTests package

Verified:

  • New test environment with management node 115.190.186.186 and ZBS
    storage nodes 172.24.193.131 / 172.24.195.92 / 172.24.251.24.
  • zstack-cli SyncVolumeSize uuid=85c6477eaf844df3bf7b989dc46d5ab3
    triggers snapshot size refresh before volume size refresh, and the
    management node calls /zbs/primarystorage/snapshot/getsize on the ZBS
    agent.

Resolves: ZSTAC-67903

sync from gitlab !10356

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 89f8da0e-4cc5-460f-884d-63ea45b7fcb0

📥 Commits

Reviewing files that changed from the base of the PR and between d22b42d and fec68a9.

📒 Files selected for processing (21)
  • header/src/main/java/org/zstack/header/storage/addon/primary/BatchStatsSpec.java
  • header/src/main/java/org/zstack/header/storage/addon/primary/PrimaryStorageControllerSvc.java
  • header/src/main/java/org/zstack/header/storage/primary/StorageResourceStats.java
  • header/src/main/java/org/zstack/header/storage/primary/VolumeSnapshotCapability.java
  • header/src/main/java/org/zstack/header/storage/snapshot/VolumeSnapshotStats.java
  • header/src/main/java/org/zstack/header/volume/BatchSyncVolumeSizeOnPrimaryStorageMsg.java
  • header/src/main/java/org/zstack/header/volume/BatchSyncVolumeSizeOnPrimaryStorageReply.java
  • header/src/main/java/org/zstack/header/volume/VolumeStats.java
  • plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephPrimaryStorageBase.java
  • plugin/expon/src/main/java/org/zstack/expon/ExponStorageController.java
  • plugin/localstorage/src/main/java/org/zstack/storage/primary/local/LocalStorageBase.java
  • plugin/nfsPrimaryStorage/src/main/java/org/zstack/storage/primary/nfs/NfsPrimaryStorage.java
  • plugin/sharedMountPointPrimaryStorage/src/main/java/org/zstack/storage/primary/smp/SMPPrimaryStorageBase.java
  • plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniStorageController.java
  • plugin/zbs/src/main/java/org/zstack/storage/zbs/ZbsStorageController.java
  • simulator/simulatorImpl/src/main/java/org/zstack/simulator/storage/primary/SimulatorPrimaryStorage.java
  • storage/src/main/java/org/zstack/storage/addon/primary/ExternalPrimaryStorage.java
  • storage/src/main/java/org/zstack/storage/snapshot/VolumeSnapshotSizeSyncHelper.java
  • storage/src/main/java/org/zstack/storage/volume/VolumeBase.java
  • storage/src/main/java/org/zstack/storage/volume/VolumeManagerImpl.java
  • test/src/test/groovy/org/zstack/test/integration/storage/primary/addon/zbs/ZbsPrimaryStorageCase.groovy

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/xiangheng.zhao/5.5.28

Comment @coderabbitai help to get the list of available commands.

@MatheMatrix MatheMatrix force-pushed the sync/xiangheng.zhao/5.5.28 branch 3 times, most recently from 04e7a2f to 16071bf Compare July 2, 2026 07:00
During the scheduled active-volume size sync, primary storages whose snapshot mode is COPY_ON_WRITE attach snapshot install paths to BatchSyncVolumeSizeOnPrimaryStorageMsg. The batch volume sync reply then carries snapshot actual sizes so VolumeSnapshotVO.size can be refreshed together with volume actual size.

Use BatchStatsSpec and StorageResourceStats for external primary storage batchStats so one scheduled batch call can return both VolumeStats and VolumeSnapshotStats. REDIRECT_ON_WRITE snapshot storages keep volume-only batch sync. Single-volume stats and SyncVolumeSize remain volume-only flows.

Use VolumeSnapshotSizeSyncHelper as a lightweight helper object with CloudBus and DatabaseFacade dependencies passed by constructor. Snapshot size sync is decided by reported snapshot mode instead of primary storage type.

Route ZBS COPY_ON_WRITE withSnapshot batch stats to the volume-with-snapshot agent API.

Test: git diff --check

Test: mvn -pl storage,plugin/zbs,plugin/xinfini,plugin/expon -am -DskipTests compile

Verified:

- In cloud environment, zstack-cli BatchSyncVolumeSize clusterUuid=<clusterUuid> triggers the same batch volume size sync path as the scheduled task and updates ZBS COPY_ON_WRITE VolumeSnapshotVO.size from backend usedSize.

Resolves: ZSTAC-67903

Change-Id: I66339da9d8cede3dd9fa4e5e262cc01a3784ba6e
@MatheMatrix MatheMatrix force-pushed the sync/xiangheng.zhao/5.5.28 branch from 16071bf to fec68a9 Compare July 2, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant