Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ public Result throwExceptionIfError() {
}
}

@Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false)
@Param(required = false, nonempty = false, nullElements = false, emptyString = true, noTrim = false)
public java.lang.String volumeUuid;

@Param(required = false)
public java.util.List<String> volumeUuids;
Comment on lines +28 to +32
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

缺少 volumeUuid 与 volumeUuids 的互斥验证逻辑

volumeUuid 改为可选并新增 volumeUuids 后,当前实现无法保证至少提供其中一个参数。如果两个参数都为空,迁移操作将无法执行,可能导致运行时错误或需要在服务端额外验证。

建议:

  • 在 SDK Action 层面添加参数验证逻辑,确保 volumeUuidvolumeUuids 至少提供一个
  • 或者在类级别添加注释说明这两个参数的互斥关系和验证要求
🤖 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 `@sdk/src/main/java/org/zstack/sdk/PrimaryStorageMigrateVolumeAction.java`
around lines 28 - 32, The PrimaryStorageMigrateVolumeAction class now exposes
both volumeUuid and volumeUuids but lacks validation to ensure at least one is
provided; add a validation step in the action (e.g., a validate() method invoked
before request assembly or inside the existing call/execute path) that checks
fields volumeUuid and volumeUuids and throws/returns a clear parameter error if
both are null/empty, or alternatively document their
mutual-exclusion/requirement at class-level if you prefer not to validate in
code; reference the class PrimaryStorageMigrateVolumeAction and the fields
volumeUuid and volumeUuids when implementing this check.


@Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false)
public java.lang.String dstPrimaryStorageUuid;

Expand Down