feature: Add `directdownload` request parameter to `createTemplate` API (KVM)
- 主要语言
- Java
- 星标
- 3.1k
- 派生
- 1.4k
- 平均合并
- 6 天 19 小时
- 30 天内合并 PR
- 32
描述
### The required feature described as a wish
### Summary
The `createTemplate` API does not accept `directdownload` as a request parameter. This makes it impossible for tools that create templates from a stopped VM's volume (such as HashiCorp Packer) to produce a template with the `directdownload` flag set.
### Current Behaviour
`directdownload` is only accepted as a request parameter by `registerTemplate`. `createTemplate` and `updateTemplate` both omit it from their accepted parameters, though both include it in their response payloads (reflecting the value stored on the `vm_template` record).
There is no supported API path to set `directdownload = true` on a template created via `createTemplate`.
### Expected Behavior
`createTemplate` should accept an optional boolean `directdownload` parameter (KVM only), consistent with how `registerTemplate` handles it, and persist it on the resulting VMTemplateVO record.
### Proposed Change
In CreateTemplateCmd.java, add:
```java
@Parameter(name = ApiConstants.DIRECT_DOWNLOAD, type = CommandType.BOOLEAN,
description = "KVM Only: true if template should be directly downloaded "
+ "to Primary Storage, bypassing Secondary Storage. Default is false.")
private Boolean directDownload;
public Boolean isDirectDownload() {
return directDownload;
}
```
Propagate through `TemplateProfile` and `TemplateManagerImpl.createPrivateTemplate()` - following the identical pattern already used in `RegisterTemplateCmd` and its handling.
References
- `RegisterTemplateCmd.java` - existing implementation to follow
- `CreateTemplateCmd.java` - file to modify
- Downstream: apache/cloudstack-go SDK will need SetDirectdownload() added to CreateTemplateParams once this is merged
- Downstream: hashicorp/packer-plugin-cloudstack#95 - the packer plugin feature request blocked on this change
贡献指南
调研方向
从现有实现 RegisterTemplateCmd.java 开始,然后检查 CreateTemplateCmd.java,并通过 TemplateProfile 和 TemplateManagerImpl.createPrivateTemplate() 跟踪该值。当 createTemplate 接受可选的仅限 KVM 的布尔值、传递该值并将其持久化到生成的 VMTemplateVO 记录中时,工作就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 68/100