Skip to content

<fix>[conf]: Fix V5.4.6__schema.sql when upgrade templates#3555

Open
ZStack-Robot wants to merge 4 commits intofeature-zcf-v0.1from
sync/shixin.ruan/shixin-ZCF-1365@@2
Open

<fix>[conf]: Fix V5.4.6__schema.sql when upgrade templates#3555
ZStack-Robot wants to merge 4 commits intofeature-zcf-v0.1from
sync/shixin.ruan/shixin-ZCF-1365@@2

Conversation

@ZStack-Robot
Copy link
Collaborator

  • Fix default value of cpuArch when upgrade existing records
  • Set date to valid value to avoid zero date failed to start
    mn

DBImpact

Resolves: ZSTAC-80776

Change-Id: I6873776363706d6b76726679666d6c6663676d6e
(cherry picked from commit fbb2eae)

sync from gitlab !9409

Resolves: ZCF-1365

Change-Id: I73687962636e7871626e687761626d6661716668
Resolves: ZCF-1365

Change-Id: I626968656f6c6966796a616b6e736d696e647966
Resolves: ZCF-1365

Change-Id: I716b787976776e7979736e617864726d786b756b
DBImpact

Resolves: ZCF-1365

Change-Id: I6c746e6a777a6a62726b7a687070736b65766b6a
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

高层概览

本PR添加了ZNS SDN控制器集成支持,包括新增三个数据库表、L2Geneve网络类型、L3网络MTU扩展点、KVM DPDK支持,以及相关文档和测试基础设施。

变更详情

文件组/文件 摘要
数据库架构
conf/db/upgrade/V5.5.18__schema.sql
创建三个新表支持ZNS SDN控制器:ZnsControllerVO(关联到SdnControllerVO),L2GeneveNetworkVO(新网络类型),ZnsTransportZoneVO(包含元数据、时间戳和级联删除约束)。
文档
docs/modules/network/nav.adoc, docs/modules/network/pages/networkResource/ZnsIntegration.adoc, docs/modules/network/pages/networkResource/networkResource.adoc
添加完整的ZNS集成文档,涵盖控制器创建流程、资源映射规则、重连行为和网络资源处理细节;更新导航引用。
网络常量与类型
header/src/main/java/org/zstack/header/network/l2/L2NetworkConstant.java, header/src/main/java/org/zstack/header/network/l3/L3NetworkType.java, header/src/main/java/org/zstack/header/network/l3/L3NetworkInventory.java, header/src/main/java/org/zstack/header/network/l3/L3NetworkVO.java
新增L2_GENEVE_NETWORK_TYPEVSWITCH_TYPE_ZNS常量;为L3NetworkType添加ipAddressAllocationEnabled配置;更新L3网络库存查询支持类型驱动的IP分配决策。
L3网络MTU扩展
header/src/main/java/org/zstack/header/network/l3/AfterSetL3NetworkMtuExtensionPoint.java, network/src/main/java/org/zstack/network/l3/L3NetworkManagerImpl.java
创建新的AfterSetL3NetworkMtuExtensionPoint扩展点接口;在MTU设置流程后添加插件调用机制,支持异步完成和错误聚合。
KVM DPDK支持
plugin/kvm/src/main/java/org/zstack/kvm/KVMRealizeL2NoVlanNetworkBackend.java, plugin/kvm/src/main/java/org/zstack/kvm/KVMRealizeL2VlanNetworkBackend.java
更新KVM后端以支持ZNS vSwitch类型,为ZNS网络分配OVN DPDK虚拟网卡源路径。
SDN控制器工厂
plugin/sdnController/src/main/java/org/zstack/sdnController/SdnControllerFactory.java, plugin/sdnController/src/main/java/org/zstack/sdnController/h3cVcfc/H3cVcfcSdnControllerFactory.java, plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/SugonSdnControllerFactory.java
从工厂接口和实现中移除persistSdnController方法,统一持久化行为。
测试支持
testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy, testlib/src/main/java/org/zstack/testlib/SdnControllerSpec.groovy
添加createL2GeneveNetwork助手方法;实现ZNS模拟器,包括fabric/segment/port API端点和webhook回调触发机制。

序列图

sequenceDiagram
    participant Client as Cloud管理端
    participant Controller as L3NetworkManager
    participant ExtPoint as AfterSetL3NetworkMtu<br/>扩展点
    participant Plugin as SDN插件实现

    Client->>Controller: APISetL3NetworkMtu
    Note over Controller: 执行DHCP/SDN设置流程
    Controller->>Controller: 完成基础MTU设置
    Controller->>ExtPoint: 查询已注册的扩展实现
    
    alt 存在扩展实现
        Controller->>Plugin: afterSetL3NetworkMtu(l3Inv, mtu)
        Plugin->>Plugin: 执行MTU后处理逻辑
        Plugin-->>Controller: 完成信号
        Note over Controller: 聚合所有扩展完成状态
    else 无扩展实现
        Controller->>Controller: 继续流程
    end
    
    Controller-->>Client: 设置成功响应
Loading
sequenceDiagram
    participant Client as Cloud客户端
    participant ZnsAPI as ZNS SDN控制器
    participant CloudDB as Cloud数据库
    participant CloudRes as Cloud资源管理

    Client->>CloudRes: 创建ZNS控制器
    CloudRes->>ZnsAPI: 发现Fabric节点
    ZnsAPI-->>CloudRes: 返回节点/集群/传输数据
    
    CloudRes->>CloudRes: 映射到Host/Cluster UUID<br/>导出vSwitchType
    CloudRes->>ZnsAPI: 获取传输区域及元数据
    ZnsAPI-->>CloudRes: 返回TransportZone列表
    
    CloudRes->>CloudRes: 创建反向索引<br/>transportZoneUuid→clusterUuid
    CloudRes->>CloudDB: 保存ZnsControllerVO
    CloudRes->>CloudDB: 保存TransportZoneVO
    
    CloudRes->>CloudDB: 创建L2/L3Network<br/>关联L2NetworkClusterRef
    CloudDB-->>CloudRes: 资源创建完成
    CloudRes-->>Client: 控制器集成完成
Loading

代码审查工作量估算

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

庆祝诗

🐰 新的ZNS之路已铺就,
Geneve网络闪闪发光,
MTU扩展点优雅降临,
DPDK支持齐声欢唱,
Cloud与SDN握手言和!✨


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings)

Check name Status Explanation Resolution
Title check ❌ Error PR标题"[conf]: Fix V5.4.6__schema.sql when upgrade templates"与实际变更内容不符。实际变更包括ZNS SDN控制器集成、新增数据库表、文档、常量定义和多个Java文件修改,而标题仅提及V5.4.6__schema.sql的修复。 更新PR标题以准确反映主要变更内容,例如"[network]: Add ZNS SDN controller integration support"或类似能够涵盖所有关键变更的标题。
Description check ⚠️ Warning PR描述与实际变更内容不相关。描述仅涉及修复cpuArch默认值和日期问题,而实际变更主要包括ZNS SDN控制器集成、新增L2GeneveNetwork网络类型和大量功能性代码变更。 更新PR描述以准确反映实际变更,包括ZNS集成、新增数据模型、扩展点和相关功能实现的详细说明。
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.
✨ 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/shixin.ruan/shixin-ZCF-1365@@2

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

Tip

You can generate walkthrough in a markdown collapsible section to save space.

Enable the reviews.collapse_walkthrough setting to generate walkthrough in a markdown collapsible section.

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/modules/network/pages/networkResource/ZnsIntegration.adoc`:
- Around line 301-302: The VSwitchType.types list in the docs is inconsistent
with earlier references and missing entries (notably OvsKernel and ZNS); update
the VSwitchType.types enumeration text (the lines describing VSwitchType.types
and any repeated lists) to include OvsKernel and ZNS and make the wording
consistent with earlier uses of VSwitchType and all other occurrences in this
file so readers see the same canonical enum everywhere.

ℹ️ 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: 4afa3e99-3199-4002-9acc-200289b76f91

📥 Commits

Reviewing files that changed from the base of the PR and between 3b39d5b and 6f59e4a.

⛔ Files ignored due to path filters (3)
  • sdk/src/main/java/SourceClassMap.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/CreateL2GeneveNetworkAction.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/L2GeneveNetworkInventory.java is excluded by !sdk/**
📒 Files selected for processing (17)
  • conf/db/upgrade/V5.5.18__schema.sql
  • docs/modules/network/nav.adoc
  • docs/modules/network/pages/networkResource/ZnsIntegration.adoc
  • docs/modules/network/pages/networkResource/networkResource.adoc
  • header/src/main/java/org/zstack/header/network/l2/L2NetworkConstant.java
  • header/src/main/java/org/zstack/header/network/l3/AfterSetL3NetworkMtuExtensionPoint.java
  • header/src/main/java/org/zstack/header/network/l3/L3NetworkInventory.java
  • header/src/main/java/org/zstack/header/network/l3/L3NetworkType.java
  • header/src/main/java/org/zstack/header/network/l3/L3NetworkVO.java
  • network/src/main/java/org/zstack/network/l3/L3NetworkManagerImpl.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMRealizeL2NoVlanNetworkBackend.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMRealizeL2VlanNetworkBackend.java
  • plugin/sdnController/src/main/java/org/zstack/sdnController/SdnControllerFactory.java
  • plugin/sdnController/src/main/java/org/zstack/sdnController/h3cVcfc/H3cVcfcSdnControllerFactory.java
  • plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/SugonSdnControllerFactory.java
  • testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy
  • testlib/src/main/java/org/zstack/testlib/SdnControllerSpec.groovy
💤 Files with no reviewable changes (3)
  • plugin/sdnController/src/main/java/org/zstack/sdnController/SdnControllerFactory.java
  • plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/SugonSdnControllerFactory.java
  • plugin/sdnController/src/main/java/org/zstack/sdnController/h3cVcfc/H3cVcfcSdnControllerFactory.java

Comment on lines +301 to +302
* `vSwitchType`:VSwitchType.types,有:LinuxBridge、TfL2Network、MacVlan、OvnDpdk、OvsDpdk
* `virtualNetworkId`:vlanId 或 vxlanID
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

VSwitchType 枚举描述与前后文不一致

这里的 VSwitchType.types 列表缺少前文已使用的 OvsKernel,也缺少本页多处声明的 ZNS。建议统一枚举口径,避免读者按该列表实现时产生偏差。

建议修正文案
-* `vSwitchType`:VSwitchType.types,有:LinuxBridge、TfL2Network、MacVlan、OvnDpdk、OvsDpdk
+* `vSwitchType`:VSwitchType.types,有:LinuxBridge、TfL2Network、MacVlan、OvnDpdk、OvsDpdk、OvsKernel、ZNS

Also applies to: 132-146, 315-315

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

In `@docs/modules/network/pages/networkResource/ZnsIntegration.adoc` around lines
301 - 302, The VSwitchType.types list in the docs is inconsistent with earlier
references and missing entries (notably OvsKernel and ZNS); update the
VSwitchType.types enumeration text (the lines describing VSwitchType.types and
any repeated lists) to include OvsKernel and ZNS and make the wording consistent
with earlier uses of VSwitchType and all other occurrences in this file so
readers see the same canonical enum everywhere.

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