Skip to content

<fix>[vm_local_volume_cache]: Set CacheTO in extension point#3578

Open
zstack-robot-1 wants to merge 1 commit intofeature-5.5.6-local-cachefrom
sync/haidong.pang/ZSTAC-83649@@2
Open

<fix>[vm_local_volume_cache]: Set CacheTO in extension point#3578
zstack-robot-1 wants to merge 1 commit intofeature-5.5.6-local-cachefrom
sync/haidong.pang/ZSTAC-83649@@2

Conversation

@zstack-robot-1
Copy link
Collaborator

Enable cache for an in-use volume omits some command fields
sent to the agent.

VmLocalVolumeCacheManagerImpl implements the convertVolumeIfNeed
method of KVMConvertVolumeExtensionPoint. CacheTO should be set
in the implementation of this extension point.

Resolves: ZSTAC-83649

Change-Id: I69757864676978787767736a6f777a7562636b75

sync from gitlab !9437

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: 6578c0b6-3198-423e-bed5-e2d839c312b0

📥 Commits

Reviewing files that changed from the base of the PR and between d081198 and cc755f5.

📒 Files selected for processing (1)
  • plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java

Walkthrough

VolumeTO.valueOf() 中移除了对 VmLocalVolumeCacheVO 的数据库查询与缓存构建逻辑;方法在(可选)应用 KVMConvertVolumeExtensionPoint 后直接返回,不再为返回对象填充本地卷缓存信息。

Changes

Cohort / File(s) Summary
缓存解析移除
plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java
删除了通过 VmLocalVolumeCacheVO 查询本地卷缓存并转换为 VmLocalVolumeCacheInventory/CacheTO 的代码路径;在应用 KVMConvertVolumeExtensionPoint 转换后直接返回 VolumeTO,不再调用 to.setCache(...)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

我是田野里的一只小兔子,🐇
跳过了缓存那段小路,
VolumeTO 轻快地往前走,
扩展点旁摇曳新绿,
代码简短,心情舒畅。

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows the required [scope]: format and is 60 characters, within the 72-character limit. It accurately describes the main change of setting CacheTO in the extension point.
Description check ✅ Passed The PR description is related to the changeset, explaining the issue with cache omission and the solution of setting CacheTO in the extension point implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/haidong.pang/ZSTAC-83649@@2

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

@zstack-robot-2
Copy link
Collaborator

Comment from yaohua.wu:

Review: MR !9437 — ZSTAC-83649

将 cache 注入逻辑从 core VolumeTO.valueOf() 迁移到 premium 扩展点

变更概要:删除 VolumeTO.valueOf() 中直接引用 VmLocalVolumeCacheVO 的 cache 设置代码,该逻辑已迁移到 premium 模块的 VmLocalVolumeCacheManagerImpl.convertVolumeIfNeed() 扩展点实现中(见 premium !13298)。

架构评价:正确。core 模块不应直接依赖 premium 类型。通过 KVMConvertVolumeExtensionPoint 扩展点解耦,符合 ZStack 插件化架构。

Warning

  1. [VolumeTO.java] 删除 cache 逻辑后遗留未使用的 import

    以下 import 在删除 cache 代码后不再被使用,应一并清理:

    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheInventory;  // line 8
    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheVO;         // line 9
    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheVO_;        // line 10

Suggestion

  1. [VolumeTO.java:161] 多余空格return to; 有双空格,建议修为 return to;(此为原有问题,可顺手修复)

Verdict: APPROVED

详细 review 见 premium MR !13298 评论


🤖 Robot Reviewer

@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/ZSTAC-83649@@2 branch from d081198 to bb20efa Compare March 24, 2026 08:48
Enable cache for an in-use volume omits some command fields
sent to the agent.

VmLocalVolumeCacheManagerImpl implements the convertVolumeIfNeed
method of KVMConvertVolumeExtensionPoint. CacheTO should be set
in the implementation of this extension point.

Resolves: ZSTAC-83649

Change-Id: I69757864676978787767736a6f777a7562636b75
@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/ZSTAC-83649@@2 branch from bb20efa to cc755f5 Compare March 24, 2026 08: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.

2 participants