Skip to content

cpu_type broken since 1.2.2 #307

Open
@cerowain

Description

@cerowain

Overview of the Issue

When provisioning the VM from packer cpu_type is not being passed to proxmox resulting in all hosts taking the default value regardless of cpu_type setting. This works in 1.2.1

Suspected Cause

proxmox-api-go defines QemuCPU as

type QemuCPU struct {
	Affinity     *[]uint          `json:"affinity,omitempty"`
	Cores        *QemuCpuCores    `json:"cores,omitempty"` // Required during creation
	Flags        *CpuFlags        `json:"flags,omitempty"`
	Limit        *CpuLimit        `json:"limit,omitempty"`
	Numa         *bool            `json:"numa,omitempty"`
	Sockets      *QemuCpuSockets  `json:"sockets,omitempty"`
	Type         *CpuType         `json:"type,omitempty"`
	Units        *CpuUnits        `json:"units,omitempty"`
	VirtualCores *CpuVirtualCores `json:"vcores,omitempty"`
}

In change 75dded5, in step_start_vm.go CpuType is not passed through in the config.

While I can spot the issue, my skills at committing are lacking. Don't blame me, I'm just a sysadmin. :)

Reproduction Steps

Set cpu_type = "x86-64-v3" within proxmox-iso source section. The resulting VM will have type kvm64

Plugin and Packer version

Packer v1.11.2
packer-plugin-proxmox_v1.2.2

Simplified Packer Buildfile

Very simple testing

packer {
  required_plugins {
    name = {
      version = "~> 1"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

variable "proxmox_username" {
  default = env("PROXMOX_USER")
}

variable "proxmox_token" {
  default = env("PROXMOX_TOKEN")
}

source "proxmox-iso" "oraclelinux-9_5" {
  proxmox_url               = "https://192.168.1.181:8006/api2/json"
  insecure_skip_tls_verify  = true
  username                  = "${var.proxmox_username}"
  token                     = "${var.proxmox_token}"

  node                  = "pm1"
  vm_name               = "oraclelinux-9.5"
  template_description  = "Oracle Linux 9.5 Image"

  cores   = "1"
  cpu_type = "x86-64-v3"

  memory  = "2048"

  os = "l26"
  qemu_agent = true
  
  boot_iso {
    type = "sata"
    iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u5/x86_64/OracleLinux-R9-U5-x86_64-dvd.iso"
    iso_storage_pool = "fractal"
    unmount = true
    iso_checksum = "sha256:c2fa76c502cf1d93dfbd084d494d963ab7ea0a6f5535a083b8547b34037e88e1"
    iso_download_pve = true
  }

  disks {
    disk_size         = "20G"
    storage_pool      = "fractal"
    type              = "sata"
    format            = "qcow2"
  }

  network_adapters {
    model = "virtio"
    bridge = "vmbr0"
    firewall = "false"
  }

  cloud_init = true
  cloud_init_storage_pool = "fractal"

  boot_command = [
    "<up>",
    "<tab><wait>",
    " text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg",
    "<wait><wait><wait><wait><wait><wait><wait><wait><wait><wait><enter>"
  ]

  http_directory          = "http" 

  ssh_username            = "packer"
  ssh_private_key_file    = "../id_ed25519"

  ssh_timeout             = "30m"
  ssh_pty                 = true

  task_timeout            = "10m"
}

build {
  name = "oraclelinux-9.5"
  sources = ["source.proxmox-iso.oraclelinux-9_5"]

  provisioner "shell" {
    script          = "scripts/cleanup.sh"
  }
}

Operating system and Environment details

Running packer on M1 silicon, MacOS 15.1.1

Log Fragments and crash.log files

No relevant logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions