fix(sdnController): validate L2 network detach before SDN controller delete#3346
fix(sdnController): validate L2 network detach before SDN controller delete#3346ZStack-Robot wants to merge 1 commit into5.5.6from
Conversation
…r delete Resolves: ZSTAC-80186 Change-Id: I8dcb689b022ad907c12bc1b481fb9d0db1e98d06
概览在SDN控制器API拦截器中添加了移除操作的验证逻辑,确保移除前检查是否存在关联的硬件L2 Vxlan网络池;同时在错误码常量库中增加对应的新错误码。 变更
代码审查估计工作量🎯 2 (简单) | ⏱️ ~10 分钟 庆祝诗
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.5)utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.javaComment |
Problem
ZSTAC-80186: Deleting an SDN controller without first detaching its L2 vxlan network pools leaves orphaned L2 networks with broken SDN references.
Root Cause
APIRemoveSdnControllerMsghas no validation in the interceptor. The cascade extensionhandleDeletionCheck()also immediately returns success without checking for attached resources.Fix
Add validation in
SdnControllerApiInterceptorforAPIRemoveSdnControllerMsg: check if anyHardwareL2VxlanNetworkPoolVOstill references this SDN controller UUID. If so, reject the delete with a clear error message asking to detach first.Changes
SdnControllerApiInterceptor.java: Add validate method for APIRemoveSdnControllerMsgCloudOperationsErrorCode.java: Add error code ORG_ZSTACK_SDNCONTROLLER_10031Testing
sync from gitlab !9175