Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu_type broken since 1.2.2 #307

Open
cerowain opened this issue Dec 13, 2024 · 1 comment
Open

cpu_type broken since 1.2.2 #307

cerowain opened this issue Dec 13, 2024 · 1 comment
Labels

Comments

@cerowain
Copy link

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

@cerowain cerowain added the bug label Dec 13, 2024
@maksimsamt
Copy link

The same for me, cpu_type parameter does not work in 1.2.2 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants