Skip to content

Commit

Permalink
Add efi_format options to efi_config
Browse files Browse the repository at this point in the history
Using this option is possibile to create qcow2 EFI disks,
instead of the default raw backend.
  • Loading branch information
giosh94mhz authored and lbajolet-hashicorp committed Sep 16, 2024
1 parent 3a7b5b6 commit 670e428
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .web-docs/components/builder/clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ Usage example (JSON):
{
"efi_storage_pool": "local",
"pre_enrolled_keys": true,
"efi_format": "raw",
"efi_type": "4m"
}

Expand All @@ -786,6 +787,10 @@ Usage example (JSON):

- `efi_storage_pool` (string) - Name of the Proxmox storage pool to store the EFI disk on.

- `efi_format` (string) - The format of the file backing the disk. Can be
`raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
`raw`.

- `pre_enrolled_keys` (bool) - Whether Microsoft Standard Secure Boot keys should be pre-loaded on
the EFI disk. Defaults to `false`.

Expand Down
5 changes: 5 additions & 0 deletions .web-docs/components/builder/iso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ Usage example (JSON):
{
"efi_storage_pool": "local",
"pre_enrolled_keys": true,
"efi_format": "raw",
"efi_type": "4m"
}

Expand All @@ -700,6 +701,10 @@ Usage example (JSON):

- `efi_storage_pool` (string) - Name of the Proxmox storage pool to store the EFI disk on.

- `efi_format` (string) - The format of the file backing the disk. Can be
`raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
`raw`.

- `pre_enrolled_keys` (bool) - Whether Microsoft Standard Secure Boot keys should be pre-loaded on
the EFI disk. Defaults to `false`.

Expand Down
5 changes: 5 additions & 0 deletions builder/proxmox/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,18 @@ type diskConfig struct {
// {
// "efi_storage_pool": "local",
// "pre_enrolled_keys": true,
// "efi_format": "raw",
// "efi_type": "4m"
// }
//
// ```
type efiConfig struct {
// Name of the Proxmox storage pool to store the EFI disk on.
EFIStoragePool string `mapstructure:"efi_storage_pool"`
// The format of the file backing the disk. Can be
// `raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
// `raw`.
EFIFormat string `mapstructure:"efi_format"`
// Whether Microsoft Standard Secure Boot keys should be pre-loaded on
// the EFI disk. Defaults to `false`.
PreEnrolledKeys bool `mapstructure:"pre_enrolled_keys"`
Expand Down
2 changes: 2 additions & 0 deletions builder/proxmox/common/config.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions builder/proxmox/common/step_start_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ func generateProxmoxEfi(efi efiConfig) proxmox.QemuDevice {
dev := make(proxmox.QemuDevice)
setDeviceParamIfDefined(dev, "storage", efi.EFIStoragePool)
setDeviceParamIfDefined(dev, "efitype", efi.EFIType)
setDeviceParamIfDefined(dev, "format", efi.EFIFormat)
// efi.PreEnrolledKeys can be false, but we only want to set pre-enrolled-keys=0
// when other EFI options are set.
if len(dev) > 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- `efi_storage_pool` (string) - Name of the Proxmox storage pool to store the EFI disk on.

- `efi_format` (string) - The format of the file backing the disk. Can be
`raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
`raw`.

- `pre_enrolled_keys` (bool) - Whether Microsoft Standard Secure Boot keys should be pre-loaded on
the EFI disk. Defaults to `false`.

Expand Down
1 change: 1 addition & 0 deletions docs-partials/builder/proxmox/common/efiConfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Usage example (JSON):
{
"efi_storage_pool": "local",
"pre_enrolled_keys": true,
"efi_format": "raw",
"efi_type": "4m"
}

Expand Down

0 comments on commit 670e428

Please sign in to comment.