Skip to content

<fix>[storage]: ZSTAC-81222 defer referenced reimage trash - #4675

Open
ZStack-Robot wants to merge 1 commit into
5.5.38from
sync/haidong.pang/fix/ZSTAC-81222-no-trash
Open

<fix>[storage]: ZSTAC-81222 defer referenced reimage trash#4675
ZStack-Robot wants to merge 1 commit into
5.5.38from
sync/haidong.pang/fix/ZSTAC-81222-no-trash

Conversation

@ZStack-Robot

Copy link
Copy Markdown
Collaborator

Summary

Keep the old root volume out of trash while linked-clone children still depend on its snapshot chain. Transfer cleanup ownership to the existing trash/GC path after the last reference is removed.

Changes

  • Skip ReimageVolume trash creation while downstream references exist.
  • Create a delayed zero-size trash marker after the last reference is removed.
  • Reuse existing trash GC to delete the old backing chain and synchronize capacity.

Testing

  • mvn -pl storage -am -Dmaven.test.skip=true compile
  • Groovy regression test
  • Real ZBS lifecycle validation
  • CI pipeline

Resolves: ZSTAC-81222

sync from gitlab !10704

@coderabbitai

coderabbitai Bot commented Aug 14, 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: 39 minutes

Limit details: You’ve used all 1 included review currently available under your plan. You completed 89 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour.

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: fa524309-50ea-47c0-8c84-955ed93a584a

📥 Commits

Reviewing files that changed from the base of the PR and between 79ca089 and f2001fe.

📒 Files selected for processing (5)
  • header/src/main/java/org/zstack/header/storage/snapshot/reference/VolumeSnapshotReferenceTreeVO_.java
  • storage/src/main/java/org/zstack/storage/addon/primary/ExternalPrimaryStorage.java
  • storage/src/main/java/org/zstack/storage/snapshot/reference/VolumeSnapshotReferenceTreeBase.java
  • storage/src/main/java/org/zstack/storage/snapshot/reference/VolumeSnapshotReferenceUtils.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

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

@MatheMatrix
MatheMatrix force-pushed the sync/haidong.pang/fix/ZSTAC-81222-no-trash branch 2 times, most recently from 864b115 to d813918 Compare August 17, 2026 09:47
Keep an old root out of reimage trash while downstream snapshot references still depend on it.

Distinguish the reimage old root by rootInstallUrl during reference cleanup. After the last downstream reference disappears, delete the chain once from leaf to root, sync capacity, and remove matching legacy reimage trash.

Resolves: ZSTAC-81222

Change-Id: I500146d6898405f4df0cc18a1d8a4aaa94fee49d
@MatheMatrix
MatheMatrix force-pushed the sync/haidong.pang/fix/ZSTAC-81222-no-trash branch from d813918 to f2001fe Compare August 18, 2026 05:06
" and tree.uuid = :treeUuid" +
" and vol.primaryStorageUuid = tree.primaryStorageUuid", String.class)
" and vol.primaryStorageUuid = tree.primaryStorageUuid" +
" and vol.installPath = tree.rootInstallUrl", String.class)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Comment from jin.ma:

delete in db ,不是 delete in 数据面

return controller.reportCapabilities().getSnapshotCapability()
.getPlacementType() != VolumeSnapshotCapability.VolumeSnapshotPlacementType.INTERNAL;
.getPlacementType() != VolumeSnapshotCapability.VolumeSnapshotPlacementType.INTERNAL
|| VolumeSnapshotReferenceUtils.isVolumeDirectlyReferenceByOthers(msg.getVolume());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Comment from haidong.pang:

bug现场,没有判断 old-root 在树上是否还有子节点。

flow "delete-origin-root-volume-which-has-no-snapshot"

有别的卷在引用 P_old 上的快照?

┌─────────────────┴─────────────────┐
否 是
│ │
trashVolume(P_old) skip,什么都不做
│ │
trash 回收真删 P_old P_old 原样留在数据面
│ │
✗ 下游 child 卷的 backing 断了 ✓ 下游链完好,等 child 删除时再收

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.

2 participants