diff --git a/builder/proxmox/common/config.go b/builder/proxmox/common/config.go index 16c9bfbb..64383788 100644 --- a/builder/proxmox/common/config.go +++ b/builder/proxmox/common/config.go @@ -613,11 +613,8 @@ func (c *Config) Prepare(upper interface{}, raws ...interface{}) ([]string, []st } } } - if disk.SSD { - // SSD emulation is not supported on virtio device type - if disk.Type == "virtio" { - errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("SSD emulation is not supported on a virtio disk")) - } + if disk.SSD && disk.Type == "virtio" { + errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("SSD emulation is not supported on virtio disks")) } if disk.StoragePool == "" { errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("disks[%d].storage_pool must be specified", idx)) diff --git a/builder/proxmox/common/step_start_vm.go b/builder/proxmox/common/step_start_vm.go index 0226b219..de5a2daa 100644 --- a/builder/proxmox/common/step_start_vm.go +++ b/builder/proxmox/common/step_start_vm.go @@ -291,9 +291,9 @@ func generateProxmoxDisks(disks []diskConfig) proxmox.QemuDevices { } return "ignore" }()) - // SSD emulation is not supported on virtio device type - if devs[idx]["type"] != "virtio" { - setDeviceParamIfDefined(devs[idx], "ssd", strconv.FormatBool(disks[idx].SSD)) + // Add SSD flag only if true + if disks[idx].SSD { + devs[idx]["ssd"] = "1" } } return devs @@ -369,6 +369,7 @@ func generateProxmoxEfi(efi efiConfig) proxmox.QemuDevice { } func setDeviceParamIfDefined(dev proxmox.QemuDevice, key, value string) { + // Empty string is considered as not defined if value != "" { dev[key] = value }