hashicorp / packer-plugin-proxmox

Packer plugin for Proxmox Builder
https://www.packer.io/docs/builders/proxmox
Mozilla Public License 2.0
163 stars 72 forks source link

CD/DVD drive assign scsi instead of ide #187

Open oscar-vlugt opened 1 year ago

oscar-vlugt commented 1 year ago

I am trying to use packer on a proxmox cluster running on Raspberry PIs which don't have any IDE support. Normally I would just manually create a virtual machine and then remove the cd/dvd drive and assign SCSI to circumvent the following error:

kvm: -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=101: Bus 'ide.1' not found

Huge fan of Packer, and want to roll it out for my ARM images. Is there any possibility for me to add to my pkr.hcl file to set CD/DVD upon creation to use the Bus SCSI instead of IDE?

My packer file contains :


    # Proxmox Connection Settings
    proxmox_url              = "${var.proxmox_api_url}"
    username                 = "${var.proxmox_api_token_id}"
    token                    = "${var.proxmox_api_token_secret}"
    insecure_skip_tls_verify = true
    # Packer VM Configuration
    bios = "ovmf"
    boot_command      = [
        "<esc> auto preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/Debian-11.x/preseed.cfg<enter>"
    ]
    boot_wait                = "3s"
    cores                    = 2
    cpu_type                 = "host"
    disks {
        disk_size    = "4G"
        format       = "qcow2"
        storage_pool = "local"
        type         = "virtio"
    }
    http_directory           = "http"
    http_port_min            = "8000"
    http_port_max            = "8000"
    http_bind_address        = "0.0.0.0"
    iso_file                 = "local:iso/debian-11.6.0-arm64-netinst.iso"
    memory                   = 2048
    network_adapters {
        bridge = "vmbr0"
        model  = "virtio"
    }
    node                     = "pve002"
    onboot                   = true
    qemu_agent               = true
    scsi_controller          = "virtio-scsi-pci"
    sockets                  = 1
    ssh_username             = "root"
    ssh_password             = "*"
    ssh_timeout              = "3600s"
    template_description     = "Debian 11.x, generated on ${timestamp()}"
    template_name            = "TMPL-Debian11.x"
    unmount_iso              = true
    vm_name                  = "TMPL-Debian11.x"
    vm_id                    = 9980
}

build {
    sources = [
        "source.proxmox-iso.debian"
    ]
}
sebastian-de commented 1 year ago

Since we're talking about virtual machines, missing IDE support on the host shouldn't be an issue. The error you're seeing is interesting, though:

kvm: -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=101: Bus 'ide.1' not found

There is a dot between ide and 1, which shouldn't be there. But only for the first device - ide2 is correct. I guess that's the actual cause of the error. I'm afaid it won't get easy to find out where exactly that dot is coming from, but I'll try.

Apart from that it would be nice to be able to assign ISOs or Cloud-Init drives to SCSI, maybe that will be possible at some point. There is a disk restructure imminent for proxmox-api-go: https://github.com/Telmate/proxmox-api-go/issues/187#issuecomment-1494165170 This will make it necessary to rewrite the disk handling for the Packer plugin, too. While this alone will be a lot of work, it might also be an opportunity to add SCSI support for CD-ROM drives.

sebastian-de commented 1 year ago

There is a dot between ide and 1, which shouldn't be there. But only for the first device - ide2 is correct. I guess that's the actual cause of the error. I'm afaid it won't get easy to find out where exactly that dot is coming from, but I'll try.

Sorry I was wrong, ide.1 seems to be correct, when describing a bus, not a device. Does QEMU on ARM really have no support for IDE emulation?

oscar-vlugt commented 1 year ago

Could be because I installed Pimox on it: https://github.com/pimox/pimox7 . Which might not even be a real supported scenario, but I wanted to try it. I came to the conclusion because of https://github.com/pimox/pimox7/issues/7 , which resulted in me just removing the cd/dvd drive from a VM entirely, and it would start after that. It also gives the same error when I manually create the virtual machine, so I don't think it is a plugin problem.

Would love to see a feature to select the bus. Can try searching for the IDE kernel drivers and report back if I find something.

oscar-vlugt commented 1 year ago

Sadly wasn't able to find another solution then to just deploy it through cloud-init for now. Is the preferred way for me to fill in a feature request on this repository and close this question?