ZSTAC-86788: set first created zone default#4579
Conversation
|
Caution Review failedFailed to post review comments. GitHub was unavailable or timed out while CodeRabbit was posting the review. Please request a new review later if the pull request still needs one. This happened while posting 1 inline comment. Use ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (2)**/*.sql⚙️ CodeRabbit configuration file
Files:
**/*.java⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (6)📚 Learning: 2026-03-05T02:13:23.339ZApplied to files:
📚 Learning: 2026-05-07T09:44:01.429ZApplied to files:
📚 Learning: 2026-04-22T04:38:00.864ZApplied to files:
📚 Learning: 2026-04-22T14:27:42.894ZApplied to files:
📚 Learning: 2026-05-09T02:01:09.283ZApplied to files:
📚 Learning: 2026-03-17T02:08:46.892ZApplied to files:
Warning
|
| Layer / File(s) | Summary |
|---|---|
Zone 创建默认值逻辑 compute/src/main/java/org/zstack/compute/zone/ZoneManagerImpl.java |
仅当请求未指定 default 且不存在 Zone 记录时自动设置默认标记;default=null 请求进入链式处理流程。 |
升级脚本回填默认 Zone conf/db/upgrade/V5.4.12__schema.sql |
新增并执行临时存储过程,在缺少默认 Zone 时选择最早创建的 Zone 进行回填,随后删除该过程。 |
首个 Zone 默认行为验证 test/src/test/groovy/org/zstack/test/integration/compute/ZoneCase.groovy |
新增测试并加入执行链,验证首个 Zone 及数据库记录被标记为默认,且默认 Zone 数量为 1。 |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Sequence Diagram(s)
sequenceDiagram
participant Client
participant ZoneManagerImpl
participant Database
participant ZoneCase
Client->>ZoneManagerImpl: 创建首个 Zone
ZoneManagerImpl->>Database: 查询并保存默认标记
Database-->>ZoneManagerImpl: 返回 Zone 记录
ZoneManagerImpl-->>Client: 返回创建结果
ZoneCase->>Database: 查询默认 Zone
Database-->>ZoneCase: 返回唯一默认 Zone
Poem
小兔挥爪改 Zone,
首个区域戴王冠。
数据库里补旧缺,
测试蹦跳数一番。
默认旗帜稳稳安。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | 标题准确概括了首个创建的 zone 被设为默认的核心变更。 |
| Description check | ✅ Passed | 描述与补丁内容一致,说明了回迁来源、目标行为和验证方式。 |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ 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/hanyu.liang/fix-86788
Comment @coderabbitai help to get the list of available commands.
DBImpact Resolves: ZSTAC-86788 Change-Id: I746dc070d672e8191a0bf4bf995584ca5f5b8266
2d6b51e to
dd8dc50
Compare
Backport of ZSTAC-75952 to 5.4.12.
Source: zstack!10404 (5.5.28).
Sets the first zone created on a fresh installation as the default zone.
Validation: static diff and commit checks only; no case was run per backport requirement.
sync from gitlab !10548