Skip to content

<chore>[sdk]: Update sdk for TagPatternInventory resourceType#3385

Open
MatheMatrix wants to merge 11 commits into5.5.6from
sync/zstackio/fix/ZSTAC-74908@@2
Open

<chore>[sdk]: Update sdk for TagPatternInventory resourceType#3385
MatheMatrix wants to merge 11 commits into5.5.6from
sync/zstackio/fix/ZSTAC-74908@@2

Conversation

@MatheMatrix
Copy link
Owner

add resourceType field to TagPatternInventory SDK

Resolves: ZSTAC-74908

sync from gitlab !9231

AlanJager and others added 11 commits February 12, 2026 12:02
…isk offering

Resolves: ZSTAC-74683

Change-Id: Id0339ed0221e92e506f60745cde972cc3ee6d9ae
When anti-split-brain check selects a disconnected MDS node, the HTTP
call now times out after 30s instead of 5+ minutes, and automatically
retries the next available MDS via tryNext mechanism.

Resolves: ZSTAC-80595

Change-Id: I1be80f1b70cad1606eb38d1f0078c8f2781e6941
When MN restarts during a destroy operation, the hypervisor may report
the VM as Stopped. Without this transition, the state machine throws
an exception and the VM stays stuck in Destroying state forever.

Resolves: ZSTAC-80620

Change-Id: I037edba70d145a44a88ce0d3573089182fedb162
Resolves: ZSTAC-82153

Change-Id: Ib51c2e21553277416d1a9444be55aca2aa4b2fc4
<fix>[vm]: add Destroying->Stopped state transition

See merge request zstackio/zstack!9156
<fix>[i18n]: improve snapshot error message for unattached volume

See merge request zstackio/zstack!9192
<fix>[zbs]: reduce mds connect timeout and enable tryNext for volume clients

See merge request zstackio/zstack!9153
<fix>[vm]: use max of virtual and actual size for root disk allocation

See merge request zstackio/zstack!9155
Resolves: ZSTAC-74908

Change-Id: I48054139babb1e8092ab81e4367743ae3fd8aefb
- Add Javadoc: NULL resourceType = universal (backward compatible)
- Add resourceType to TagPatternVO_ metamodel and TagPatternInventory
- Add groovy integration test (3 scenarios: universal/scoped/combined filter)

Resolves: ZSTAC-74908

Change-Id: I6fc05535ae688e50290759f1e129501f0240696c
add resourceType field to TagPatternInventory

Resolves: ZSTAC-74908

Change-Id: I34f60a714fa6f6be302d3e15cb8149321a1badc4
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

概览

本PR向标签模式功能添加资源类型过滤支持,包括数据库模式升级、模型层扩展,同时对虚机规格、状态转换和存储控制器进行了调整和测试覆盖。

变更

功能模块 / 文件 变更摘要
标签模式资源类型支持
conf/db/upgrade/V5.5.6__schema.sql, header/src/main/java/org/zstack/header/tag/TagPatternVO.java, header/src/main/java/org/zstack/header/tag/TagPatternVO_.java, header/src/main/java/org/zstack/header/tag/TagPatternInventory.java
为TagPatternVO添加resourceType列,包含数据库迁移、持久化字段、JPA元模型属性及库存对象映射。支持按资源类型范围过滤标签模式。
虚机规格优化
header/src/main/java/org/zstack/header/vm/VmInstanceSpec.java
修改getRootDiskAllocateSize方法,在rootDiskOffering为空时,返回镜像虚拟大小和实际大小的最大值。
虚机状态转换
header/src/main/java/org/zstack/header/vm/VmInstanceState.java
向Destroying状态添加新的转换:stopped事件触发转换至Stopped状态。
存储控制器重试机制
plugin/zbs/src/main/java/org/zstack/storage/zbs/ZbsStorageController.java
将卷客户端获取操作改为使用HttpCaller链式调用,支持跨多个MDS实例的重试机制。新增setTryNext()方法启用故障转移。
资源类型过滤测试
test/src/test/groovy/org/zstack/test/integration/configuration/systemTag/TagPatternResourceTypeCase.groovy
新增测试用例验证标签模式resourceType作用域,覆盖通用标签、范围限定标签及组合查询过滤场景。

评估代码审查工作量

🎯 3 (中等) | ⏱️ ~25 分钟

标签有了新衣裳,resourceType来帮忙,🐰
虚机状态更流畅,存储重试保安康,
测试用例把关把,质量堡垒永难攻!

🚥 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 PR title follows the required format '[scope]: ' with 61 characters, which meets the 72-character limit. Title clearly describes adding resourceType field to TagPatternInventory SDK.
Description check ✅ Passed PR description is related to the changeset, mentioning the resourceType field addition to TagPatternInventory SDK and referencing the JIRA issue and GitLab merge request it resolves.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sync/zstackio/fix/ZSTAC-74908@@2

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/src/test/groovy/org/zstack/test/integration/configuration/systemTag/TagPatternResourceTypeCase.groovy (1)

13-23: 类级 Javadoc 中第 3 点提到了 prepareDbInitialValue() 回填行为,但测试中未覆盖该场景。

注释中提到"Upgraded old AI tags get backfilled with resourceType = 'ModelVO' on next prepareDbInitialValue() run",但当前测试用例中并没有针对此回填逻辑的验证。建议后续考虑补充该场景的测试,或移除该注释以避免误导。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@test/src/test/groovy/org/zstack/test/integration/configuration/systemTag/TagPatternResourceTypeCase.groovy`
around lines 13 - 23, The class-level Javadoc claims backfill occurs on the next
prepareDbInitialValue() run but the test TagPatternResourceTypeCase does not
exercise that; either add a focused test in TagPatternResourceTypeCase that
creates legacy TagPatternVO rows with resourceType == null, invokes the code
path that triggers prepareDbInitialValue(), then asserts those records receive
resourceType == "ModelVO", or remove/clarify the Javadoc line about
prepareDbInitialValue() to avoid misleading consumers; reference TagPatternVO,
prepareDbInitialValue(), and the TagPatternResourceTypeCase test when making the
change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@test/src/test/groovy/org/zstack/test/integration/configuration/systemTag/TagPatternResourceTypeCase.groovy`:
- Around line 13-23: The class-level Javadoc claims backfill occurs on the next
prepareDbInitialValue() run but the test TagPatternResourceTypeCase does not
exercise that; either add a focused test in TagPatternResourceTypeCase that
creates legacy TagPatternVO rows with resourceType == null, invokes the code
path that triggers prepareDbInitialValue(), then asserts those records receive
resourceType == "ModelVO", or remove/clarify the Javadoc line about
prepareDbInitialValue() to avoid misleading consumers; reference TagPatternVO,
prepareDbInitialValue(), and the TagPatternResourceTypeCase test when making the
change.

ℹ️ Review info

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

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf48ab8 and 7e34564.

⛔ Files ignored due to path filters (3)
  • conf/i18n/globalErrorCodeMapping/global-error-en_US.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-zh_CN.json is excluded by !**/*.json
  • sdk/src/main/java/org/zstack/sdk/TagPatternInventory.java is excluded by !sdk/**
📒 Files selected for processing (8)
  • conf/db/upgrade/V5.5.6__schema.sql
  • header/src/main/java/org/zstack/header/tag/TagPatternInventory.java
  • header/src/main/java/org/zstack/header/tag/TagPatternVO.java
  • header/src/main/java/org/zstack/header/tag/TagPatternVO_.java
  • header/src/main/java/org/zstack/header/vm/VmInstanceSpec.java
  • header/src/main/java/org/zstack/header/vm/VmInstanceState.java
  • plugin/zbs/src/main/java/org/zstack/storage/zbs/ZbsStorageController.java
  • test/src/test/groovy/org/zstack/test/integration/configuration/systemTag/TagPatternResourceTypeCase.groovy

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