apache / apache/cloudstack

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

Offen
#12,842 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
component:kvm status:needs-functional-definition
Vorherrschende Sprache
Java
Sterne
3.1k
Forks
1.4k
Ø Merge
6 T. 19 Std.
Gemergte PRs (30 T.)
32

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit RegisterTemplateCmd.java als bestehender Implementierung, untersuchen Sie anschließend CreateTemplateCmd.java und verfolgen Sie den Wert durch TemplateProfile und TemplateManagerImpl.createPrivateTemplate(). Die Arbeit ist abgeschlossen, wenn createTemplate den optionalen KVM-only-Boolean akzeptiert, ihn weitergibt und ihn im resultierenden VMTemplateVO-Datensatz persistiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
api
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.