apache / apache/cloudstack

feature: Add `directdownload` request parameter to `createTemplate` API (KVM)

オープン
#12,842 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
component:kvm status:needs-functional-definition
主要言語
Java
スター
3.1k
フォーク
1.4k
平均マージ
6日 19時間
マージ済み PR(30日)
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-only boolean を受け取り、それを伝播して、結果として生成される VMTemplateVO レコードに永続化すれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。