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

Regression: Pool parameter is not respected in v1.2.0 #281

Closed
kernel-sanders opened this issue Sep 28, 2024 · 4 comments · Fixed by #282
Closed

Regression: Pool parameter is not respected in v1.2.0 #281

kernel-sanders opened this issue Sep 28, 2024 · 4 comments · Fixed by #282
Labels

Comments

@kernel-sanders
Copy link

Overview of the Issue

In v1.8.1, an .hcl file that specified a pool for the VM worked. In v1.2.0, the pool parameter is no longer sent to Proxmox, which results in a permission error if the building user does not have permissions on /.

Reproduction Steps

packer plugins install github.com/hashicorp/proxmox v1.1.8
packer build
# Builds with no errors
packer plugins remove github.com/hashicorp/proxmox v1.1.8
packer plugins install github.com/hashicorp/proxmox v1.2.0
packer build 
# Throws error at the bottom of this issue

Plugin and Packer version

Packer: v1.11.2
Plugin v1.2.0

Simplified Packer Buildfile

# Variables defined here, omitted for brevity

locals {
  template_description = "Windows Server 2022 64-bit template built ${legacy_isotime("2006-01-02 03:04:05")} username:password => localuser:password"
}

source "proxmox-iso" "win2022-server-x64" {
  additional_iso_files {
    device           = "sata3"
    iso_storage_pool = "${var.iso_storage_pool}"
    unmount          = true
    cd_label         = "PROVISION"
    cd_files = [
      "../common/setup-for-ansible.ps1",
      "../common//win-updates.ps1",
      "../common//windows-common-setup.ps1",
      "Autounattend.xml",
    ]
  }
  additional_iso_files {
    device           = "sata4"
    iso_checksum     = "sha256:c88a0dde34605eaee6cf889f3e2a0c2af3caeb91b5df45a125ca4f701acbbbe0"
    iso_url          = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.229-1/virtio-win-0.1.229.iso"
    iso_storage_pool = "${var.iso_storage_pool}"
    unmount          = true
  }
  communicator    = "winrm"
  cores           = "${var.vm_cpu_cores}"
  cpu_type        = "host"
  scsi_controller = "virtio-scsi-single"
  disks {
    disk_size         = "${var.vm_disk_size}"
    format            = "${var.proxmox_storage_format}"
    storage_pool      = "${var.proxmox_storage_pool}"
    type              = "scsi"
    ssd               = true
    discard           = true
    io_thread         = true
  }
  pool                     = "SHARED"
  insecure_skip_tls_verify = "${var.proxmox_skip_tls_verify}"
  iso_checksum             = "${var.iso_checksum}"
  iso_url                  = "${var.iso_url}"
  iso_storage_pool         = "${var.iso_storage_pool}"
  memory                   = "${var.vm_memory}"
  network_adapters {
    bridge = "${var.ludus_nat_interface}"
    model  = "virtio"
  }
  node                 = "${var.proxmox_host}"
  os                   = "${var.os}"
  password             = "${var.proxmox_password}"
  proxmox_url          = "${var.proxmox_url}"
  template_description = "${local.template_description}"
  username             = "${var.proxmox_username}"
  vm_name              = "${var.vm_name}"
  winrm_insecure       = true
  winrm_password       = "${var.winrm_password}"
  winrm_use_ssl        = true
  winrm_username       = "${var.winrm_username}"
  unmount_iso          = true
  winrm_timeout        = "6h" // Sometimes the boot and/or updates can be really really slow
  task_timeout         = "20m" // On slow disks the imgcopy operation takes > 1m
}

build {
  sources = ["source.proxmox-iso.win2022-server-x64"]
}

Operating system and Environment details

Proxmox 8.2.7

Log Fragments and crash.log files

==> proxmox-iso.win2022-server-x64: No VM ID given, getting next free from Proxmox
==> proxmox-iso.win2022-server-x64: Error creating VM: error creating VM: 403 Permission check failed, error status: {"data":null} (params: map[agent:1 cores:4 cpu:host description:Packer ephemeral build VM ide2:local:iso/f1379c61c4705c2d66f46d271609fc75e967a5fe.iso,media=cdrom kvm:true memory:8192 name:win2022-server-x64-template net0:virtio=46:DB:43:9D:56:1F,bridge=vmbr1000 numa:false onboot:false ostype:win11 sata3:local:iso/packer1464551870.iso,media=cdrom sata4:local:iso/24817c8a02c774447d69d791707b032727eab977.iso,media=cdrom scsi0:local:250,cache=none,discard=on,format=qcow2,iothread=1,replicate=0,ssd=1 scsihw:virtio-scsi-single sockets:1 vmid:103])

I've tried to locate the issue, but pool handling hasn't changed from what I can tell between 1.1.8 and 1.2.0. Perhaps this is actually an issue with the upstream proxmox-api-go project which was updated from v0.0.0-20230524203107-41e6ffadedb1 to v0.0.0-20240409105641-32c480fe008e for 1.2.0.

@maksimsamt
Copy link

maksimsamt commented Oct 7, 2024

packer-plugin-proxmox 1.2.1 version: using defined pool (not /) issue Error creating VM: error creating VM: 403 Permission check failed still persists ...
Meanwhile 1.1.8 version works fine.
Is it really has been fixed in #282?

@maksimsamt
Copy link

@mpywell, should I open new issue or can you reopen current?

@mpywell
Copy link
Contributor

mpywell commented Oct 8, 2024

Hi @maksimsamt

I think raise a new issue as I was able to create the above hcl template in a pool using v1.2.1.

packer {
  required_plugins {
    proxmox = {
      version = "1.2.1"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

I have noticed that the required permissions seem to have changed in the upstream API, see Telmate/terraform-provider-proxmox#784

@maksimsamt
Copy link

maksimsamt commented Oct 8, 2024

@mpywell, ok, done
#289

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

Successfully merging a pull request may close this issue.

3 participants