Telmate / proxmox-api-go

Consume the proxmox API in golang
MIT License
370 stars 234 forks source link

fix: Disk incorrectly formatted with `lvm` back-end #292

Closed Tinyblargon closed 8 months ago

Tinyblargon commented 8 months ago

Ran into a bug where the disk format was returned empty by the library.

Apparently the lvm, and file storage back-ends use different syntax for the disks:

Tinyblargon commented 8 months ago

Okay so upon even further investigation, it can create, delete and read the disk inforamtion when backed by LVM, but not update it.

mleone87 commented 8 months ago

safe to merge @Tinyblargon ?

Tinyblargon commented 8 months ago

@mleone87 Still working on this one, sorry for making a premature pull request.

I now know the full extend of what needs to change tho.

These 2 parts of the code I'm gonna extract as a function as the code for parsing the disk info is sadly gonna get more complicated:

https://github.com/Telmate/proxmox-api-go/blob/master/proxmox/config_qemu_disk.go#L208-L216 https://github.com/Telmate/proxmox-api-go/blob/master/proxmox/config_qemu_disk.go#L305-L333

Tinyblargon commented 8 months ago

@mleone87 It's ready to merge.

Work Done:

The following code was moved to its own functions: https://github.com/Telmate/proxmox-api-go/blob/0b0c911a0a512b0ddd8642a9745d9ade4411d1c2/proxmox/config_qemu_disk.go#L208-L216

https://github.com/Telmate/proxmox-api-go/blob/0b0c911a0a512b0ddd8642a9745d9ade4411d1c2/proxmox/config_qemu_disk.go#L305-L333