apache / apache/cloudstack

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

Abierto
#12,842 2 comentarios 1 reacción 0 asignados Ver en GitHub
component:kvm status:needs-functional-definition
Lenguaje dominante
Java
Estrellas
3.1k
Forks
1.4k
Merge medio
6 d 19 h
PR fusionados (30 d)
32

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comience con RegisterTemplateCmd.java como implementación existente, después inspeccione CreateTemplateCmd.java y siga el valor a través de TemplateProfile y TemplateManagerImpl.createPrivateTemplate(). El trabajo estará terminado cuando createTemplate acepte el booleano opcional exclusivo de KVM, lo propague y lo persista en el registro VMTemplateVO resultante.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
68/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.