Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.22k stars 536 forks source link

Setting iSCSI disk image (LUN) parameter? #953

Open ekis opened 9 months ago

ekis commented 9 months ago

I am trying to set deploy a VM that uses a cloud-init image stored in a local pool as source but the VM itself would reside on an iSCSI LUN. Doing this manually would look something like this

image

however, I don't see the Disk image parameter available in the provider API. I've also tried inputting LUN's serial ID into the serial field but that does not work either - the error is Error: storage migration failed: can't allocate space in iscsi storage.

I've also noticed the (failed) clone had the wrong disk attached to it - I would expect an iSCSI LUN in the hard disk field, not the original source drive:

image

Am I doing something wrong here or is what I am trying to do somehow fundamentally unsupported?

Tinyblargon commented 9 months ago

@ekis Currently there is no way to directly use an iscsi LUN as a scsi drive (didn't even know this was possible from the ui). I'll add it to the roadmap, but this might take a while since we have nothing in place to check on what type of storage backend the disk will be placed.

On another note, the serial field is for providing a virtual disk serial number.

ekis commented 9 months ago

Thank you.

I've poked around in the qemu config REST API docs and it doesn't look straightforward. Unless it's somehow the [file=]<volume> parameter, I don't see any obvious way of passing a iSCSI disk image value there. Moreover, I can't see it in any of the three REST ops exposed (GET, POST and PUT).

In fact, there is a single endpoint in the public API that references iSCSI at all. I wonder how UI is doing this and whether this capability is even publicly exposed.

Perhaps I've overlooked something?

EDIT: Dug around the forums - found this. It's the identical error message to what I am getting. This reply indicates it isn't possible to migrate data from any disk to a Direct iSCSI Lun via PVE. The workaround it by doing a direct copy. I am not sure how much this complicates things.

EDIT2: I started experimenting with possible workarounds but what I've seen doesn't look great. For example, trying to clone a VM template (cloud-init) from a local storage to an iSCSI storage seems like a dead-end from UI as well. You can select the new target storage but how does one select a LUN?

image