hashicorp / packer-plugin-proxmox

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

Unable to create qcow2 format disks #23

Open sudomas opened 3 years ago

sudomas commented 3 years ago

Packer creates the VM always with raw disks only, no matter what disk format is defined in disks block. Here's my disk configuration.

disks { storage_pool = var.isoStore storage_pool_type = "directory" type = "virtio" disk_size = var.diskSize cache_mode = "none" format = "qcow2" }

It creates VM with a raw disk always. I tried changing the disk type to iscsi, format to qcow etc. but that did not help.

I use the Packer version 1.7.3 on Ubuntu 20.04 and trying to create a template of Ubuntu 20.04.

jorikseldeslachts commented 3 years ago

I have the same issue on Ubuntu 20.04 with Packer 1.7.4, using the following configuration block:

disks {
  type              = "virtio"
  disk_size         = "10G"
  storage_pool      = "local"
  storage_pool_type = "directory"
  format            = "qcow2"
}
dbuenoparedes commented 3 years ago

Same issue here with Packer 1.7.6, I'm building a VM based off of a Peakflow ISO image with the following disk settings:

  disks {
    disk_size         = "120G"
    storage_pool      = "gluster-volume"
    storage_pool_type = "directory"
    type              = "scsi"
    format            = "qcow2"
  }

The only workaround I found is to live change the disk format while the OS is installing, before Packer converts it to a template. I tried with storage_pool_type zfspool and lvm getting the same result.

pupaxxo commented 2 years ago

Fixed with https://github.com/Telmate/proxmox-api-go/commit/062fd1a6ab103ed125fed4b9a27b88f9efcb4e43

fldu commented 2 years ago

Hello, is there any plan to bump github.com/Telmate/proxmox-api-go to v0.0.0-20220129131641-6909b62b8cf0 (I'm not aware at all about your release model)? Sounds like the fix is working

humberto-garza commented 2 years ago

We are also experiencing this issue with Packer 1.7.10

Pumba98 commented 2 years ago

60 fixed this.

Could you release a new version please? @azr

Pumba98 commented 2 years ago

works fine now with 1.0.5, thanks

theblop commented 2 years ago

@Pumba98 Are you sure? I upgraded to 1.0.5 and it still ignores the format value and produces only raw disks...

Pumba98 commented 2 years ago

yes, I am @theblop . I changed the version in my required_plugins to >= 1.0.5 and run packer init. Before the files were .raw now they are .qcow2 and it fixed my problems after cloning them with terraform

theblop commented 2 years ago

@Pumba98 that's weird... I upgraded too and I still get a raw disk...

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

source "proxmox-iso" "vm" {
  ...
  vm_id = 99999
  disks {
    disk_size         = "80G"
    format            = "qcow2"
    storage_pool      = var.proxmox.storage_pool
    storage_pool_type = var.proxmox.storage_pool_type
    type              = "scsi"
  }
  ...
}

After the build I get a raw image:

root@ebsifactory:~# pvesh get /nodes/proxmox/qemu/99999/config
...
│ scsi0       │ storage:99999/base-99999-disk-0.raw,iothread=0,size=80G │
Pumba98 commented 2 years ago

@theblop sorry, I have no idea what could be wrong. Double check with packer plugins installed (new in packer 1.8) that you got the right proxmox plugin version. Everything else lgtm

f-bn commented 2 years ago

Can confirm it works on my side (Packer 1.8.0). Great !

image

root@baikonour:~# qemu-img info /mnt/pve/vmfs/images/1000/vm-1000-disk-0.qcow2
image: /mnt/pve/vmfs/images/1000/vm-1000-disk-0.qcow2
file format: qcow2
virtual size: 32 GiB (34359738368 bytes)
disk size: 65.3 MiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
dbuenoparedes commented 2 years ago

I'm still experiencing the same issue even with plugin version 1.0.5:

... disks { disk_size = "120G" storage_pool = "efs" storage_pool_type = "directory" type = "scsi" format = "qcow2" } ...

- Packer and plugin version:

$ packer plugins installed /home/dbuenoparedes/.packer.d/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.0.5_x5.0_linux_amd64 $ packer version Packer v1.8.0

- Proxmox VM disk info:

pvesh get /nodes/cop-compute-pve2/qemu/9500/config | grep scsi

│ boot │ order=scsi0;ide2;net0 │ │ scsi0 │ efs:9500/base-9500-disk-0.raw,iothread=0,size=120G │ │ scsihw │ virtio-scsi-pci │

qemu-img info /mnt/efs/images/9500/base-9500-disk-0.raw

image: /mnt/efs/images/9500/base-9500-disk-0.raw file format: raw virtual size: 120 GiB (128849018880 bytes) disk size: 579 MiB

humberto-garza commented 2 years ago

@ruskofd, could you confirm that packer 1.8.0 does work for you? I tested 1.8.0 and the issue was still there But I confirmed that with 1.8.1 the problem is fixed! @dbuenoparedes, could you confirm this?

mm3906078 commented 2 years ago

my packer version is 1.8.2 and I have the same issue

andrei-matei commented 2 years ago

Same issue for me, I am using Packer 1.8.3 and proxmox 1.0.8.

modem7 commented 1 year ago

No issues currently for me:

$ packer plugins installed
homedir/.config/packer/plugins/github.com/ivoronin/sshkey/packer-plugin-sshkey_v1.0.8_x5.0_linux_amd64
$ packer version
Packer v1.8.4