Skip to content

Draft: <feature>[platformservice]: Add platform service SDK metadata#4394

Open
ZStack-Robot wants to merge 2 commits into
zsv_5.1.0from
sync/taiyue.chen/ZSV-12505@@2
Open

Draft: <feature>[platformservice]: Add platform service SDK metadata#4394
ZStack-Robot wants to merge 2 commits into
zsv_5.1.0from
sync/taiyue.chen/ZSV-12505@@2

Conversation

@ZStack-Robot

Copy link
Copy Markdown
Collaborator

Add generated SDK actions, source mappings, testlib helper updates, and zsv schema metadata for platform service APIs.

DBImpact

Test: mvn -P premium -pl premium/plugin-premium/platform-service-plugin -am -DskipTests -Djacoco.skip=true install

Resolves: ZSV-12505

Change-Id: I706c6174666f726d736572766963653132353035

sync from gitlab !10354

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

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: 56 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: 0c6d6d2c-f94d-4377-b2fb-83c22e9cd372

📥 Commits

Reviewing files that changed from the base of the PR and between c99826b and 88d897e.

📒 Files selected for processing (21)
  • conf/db/zsv/V5.1.0__schema.sql
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServiceInstanceInventory.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServicePackageInventory.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageResult.java
  • testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy

Walkthrough

本次变更为平台服务(PlatformService)引入完整 SDK 支持:新增数据库表 PlatformServicePackageVO 与 PlatformServiceInstanceVO,新增一系列 SDK Action/Result/Inventory 类(健康检查、部署/卸载、包上传/查询/删除、实例/VM实例查询),补充类型映射,并扩展测试辅助方法。

Changes

平台服务功能新增

Layer / File(s) Summary
数据库表结构
conf/db/zsv/V5.1.0__schema.sql
新增 PlatformServicePackageVO 与 PlatformServiceInstanceVO 表,含服务类型、状态/阶段/进度字段及多条索引。
SDK 类型映射
sdk/.../SourceClassMap.java
新增平台服务实例/包库存类的正反向类型映射条目。
库存数据模型
sdk/.../PlatformServiceInstanceInventory.java, PlatformServicePackageInventory.java
新增两个 Inventory POJO 类及其全部字段的 getter/setter。
健康检查动作
sdk/.../CheckPlatformServiceHealthAction.java, CheckPlatformServiceHealthResult.java
新增健康检查 Action 及 Result,通过 PUT 请求触发实例健康检查。
部署/卸载动作
sdk/.../DeployPlatformServiceAction.java, DeployPlatformServiceResult.java, UndeployPlatformServiceAction.java, UndeployPlatformServiceResult.java
新增部署与卸载平台服务实例的 Action/Result 类。
包上传/查询/删除动作
sdk/.../UploadPlatformServicePackageAction.java, .../QueryPlatformServicePackageAction.java, .../DeletePlatformServicePackageAction.java 及对应 Result 类
新增上传、查询与删除平台服务包的 Action/Result 类。
实例/VM实例查询动作
sdk/.../GetPlatformServiceInstancesAction.java, GetPlatformServiceVmInstancesAction.java 及对应 Result 类
新增查询平台服务实例及关联 VM 实例列表的 Action/Result 类。
测试辅助方法
testlib/.../ApiHelper.groovy
新增/对齐平台服务相关测试辅助方法,含 apipath 路径追踪与查询条件字符串化处理。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DeployPlatformServiceAction
    participant ZSClient
    participant PlatformServiceAPI
    participant PlatformServiceInstanceVO

    Client->>DeployPlatformServiceAction: call(packageUuid, cpuNum, memorySize, ...)
    DeployPlatformServiceAction->>ZSClient: call(this)
    ZSClient->>PlatformServiceAPI: PUT /platform-services/packages/{packageUuid}/actions
    PlatformServiceAPI->>PlatformServiceInstanceVO: 创建/更新部署状态与进度
    PlatformServiceAPI-->>ZSClient: ApiResult
    ZSClient-->>DeployPlatformServiceAction: makeResult(ApiResult)
    DeployPlatformServiceAction-->>Client: Result(DeployPlatformServiceResult.inventory)
Loading

Poem

小兔子敲代码到深夜,
平台服务表格摆整齐,
部署卸载一键搞定,
健康检查不迷路,
🐰📦 上传下载都欢喜,
尾巴一甩,PR 合并去!

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题明确概括了平台服务 SDK 元数据相关的主要变更,虽然带有 Draft 和占位符但仍具体相关。
Description check ✅ Passed 描述与实际变更一致,概括了 SDK 动作、源码映射、testlib 和 schema 元数据更新。
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/taiyue.chen/ZSV-12505@@2

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@conf/db/zsv/V5.1.0__schema.sql`:
- Around line 199-200: The `createDate` default in the schema uses a fixed
sentinel timestamp instead of the actual creation time. Update the `createDate`
column definitions in the affected table DDLs within `V5.1.0__schema.sql` to use
`DEFAULT CURRENT_TIMESTAMP` (consistent with the `lastOpDate` pattern) rather
than the hardcoded 1999-12-31 value, and apply the same change to both
occurrences referenced in the review.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 649baf39-0b64-41b3-b934-4a09a131e38b

📥 Commits

Reviewing files that changed from the base of the PR and between 8a80419 and c99826b.

📒 Files selected for processing (21)
  • conf/db/zsv/V5.1.0__schema.sql
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/CheckPlatformServiceHealthResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeletePlatformServicePackageResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/DeployPlatformServiceResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceInstancesResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/GetPlatformServiceVmInstancesResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServiceInstanceInventory.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/PlatformServicePackageInventory.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/QueryPlatformServicePackageResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UndeployPlatformServiceResult.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageAction.java
  • sdk/src/main/java/org/zstack/sdk/platformservice/UploadPlatformServicePackageResult.java
  • testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy

Comment on lines +199 to +200
`lastOpDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`createDate` timestamp NOT NULL DEFAULT '1999-12-31 23:59:59',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

createDate 建议使用 CURRENT_TIMESTAMP 而非固定哨兵值

两张新表的 createDate 均设置为 DEFAULT '1999-12-31 23:59:59',而非 CURRENT_TIMESTAMP。虽然不是 0000-00-00,但同样属于人为哨兵日期,不能准确反映记录创建时间。

💡 建议修改
-    `createDate` timestamp NOT NULL DEFAULT '1999-12-31 23:59:59',
+    `createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

As per path instructions, "Do not use DEFAULT 0000-00-00 00:00:00, use DEFAULT CURRENT_TIMESTAMP instead" — 建议按此原则统一处理 createDate 的默认值。

Also applies to: 224-225

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@conf/db/zsv/V5.1.0__schema.sql` around lines 199 - 200, The `createDate`
default in the schema uses a fixed sentinel timestamp instead of the actual
creation time. Update the `createDate` column definitions in the affected table
DDLs within `V5.1.0__schema.sql` to use `DEFAULT CURRENT_TIMESTAMP` (consistent
with the `lastOpDate` pattern) rather than the hardcoded 1999-12-31 value, and
apply the same change to both occurrences referenced in the review.

Source: Path instructions

@zstack-robot-2

Copy link
Copy Markdown
Collaborator

Comment from yaohua.wu:

Review: MR !10354 — ZSV-12505

Background

  • Jira: ZSV-12505 — 平台服务支持ZLR、ZCenter部署
  • Bug summary: 该需求新增平台服务部署能力,覆盖 ZLR / ZCenter 包上传、部署、健康检查、卸载、删除,以及隐藏平台服务 VM 的管理视图。
  • Intent & scope: zstack 侧新增 platform service 的 DB schema、SDK action/inventory、SourceClassMap 和 testlib helper;premium 侧 companion MR 提供实际 API/VO/Manager/driver 实现。
  • Round 1 initial findings: zstack 侧未发现独立 SDK/DB schema 错配;联动 premium MR 存在 2 × Critical,需要修复后同批合入。
  • Suggested fix direction: premium 修复生命周期竞态并 rebase 后,zstack 侧重新生成 SDK/testlib/schema metadata,确保与 premium API 字段和 REST action 名保持一致。

关联 MR

MR 关系
http://gitlab.zstack.io/zstackio/premium/-/merge_requests/14506 同一 ZSV-12505@@2 变更组;实现 platform-service plugin、API、VO、driver 和 VM 隐藏逻辑。本 MR 的 SDK/schema 依赖该 MR 的 API 契约。

Critical

# File:Line Issue Fix
1 premium: plugin-premium/platform-service-plugin/src/main/java/org/zstack/platformservice/PlatformServiceManager.java:257 Cross-repo blocker: companion premium MR 的 deploy/delete 生命周期存在可达竞态;zstack 本 MR 已发布对应 SDK 和 DB schema,如果先合入会把不一致的 API 契约暴露给 SDK/testlib 使用者。 等 premium MR 修复 deploy/delete 串行化和状态 CAS 后,重新生成本 MR 的 SDK/testlib 产物并同批合入。
2 premium: conf/zstack.xml:200 Cross-repo blocker: companion premium MR 当前 merge_status=cannot_be_merged,且落后 zsv_5.1.0 48 commits;本 MR 虽然 can_be_merged,但两个 MR 是同一 source branch convention 的联动变更,不应拆开合入。 premium 先 rebase/解决冲突;随后本 MR 同步最新生成结果并与 premium 一起 merge。

Warning

# File:Line Issue Fix
1 conf/db/zsv/V5.1.0__schema.sql:181, sdk/src/main/java/org/zstack/sdk/SourceClassMap.java:501, testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy:37780 Upstream freshness: 本地检查显示 target 分支在 MR base 之后也改过 schema、SourceClassMap、ApiHelper 这 3 个文件。当前 GitLab 显示可合并,但这些都是生成/聚合文件,后续 rebase 很容易产生顺序漂移或覆盖最新条目。 premium 修复后,对本 MR 重新基于最新 upstream/zsv_5.1.0 生成 schema/SDK/testlib,确认 SourceClassMap 双向映射和 ApiHelper 新方法仍保留。

本 MR 直接检查结果

Area Result
SDK REST mapping Upload/Deploy/Undeploy/CheckHealth/Delete/Get/Query 的 path 与 premium @RestRequest 对齐,未发现 parameterName 错配。
DB schema PlatformServicePackageVO / PlatformServiceInstanceVO 字段与 premium VO/Inventory 字段对齐,未发现明显字段缺失。
Generated/API helper 产物与 premium API 类名对应,但需要等 premium 修复后重新生成确认。

Coverage

  • Joint review: 已同时检查 zstackio/zstack!10354zstackio/premium!14506
  • Local diff source: 使用本地 MR head diff;zstack MR 21 files,主要为 schema + SDK/testlib generated metadata。
  • Upstream freshness: zstack source 落后目标分支 26 commits;同文件 overlap 3 个,但当前 GitLab merge_status=can_be_merged
  • Testing gaps: 未在本地运行 Maven/SDK 生成测试;建议 premium 修复并 rebase 后跑 SDK generation/metadata impact checker。

Verdict: REVISION_REQUIRED

本 MR 自身未发现独立代码缺陷,但作为联动 MR,必须等待 premium companion MR 的 Critical 修复和 rebase 后再同批合入。


🤖 Robot Reviewer

@MatheMatrix MatheMatrix force-pushed the sync/taiyue.chen/ZSV-12505@@2 branch 2 times, most recently from b7c5b23 to cf5d74e Compare July 1, 2026 08:36
Add generated SDK actions, source mappings, testlib helpers, and
ZSV schema metadata for platform service APIs.

DBImpact

Resolves: ZSV-12505

Change-Id: I706c6174666f726d736572766963653132353035
@MatheMatrix MatheMatrix force-pushed the sync/taiyue.chen/ZSV-12505@@2 branch from cf5d74e to e2c225b Compare July 1, 2026 13:00
Persist activeApiId on platform service packages and instances so progress can be read from existing task progress records instead of duplicating step fields.

DBImpact

Resolves: ZSV-12505

Change-Id: Ie6a75a06a3e7960f46f47fecc72715c2fd3e22a9
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