Hello from France,
I'm asking for some guidance/better explanations about something I'm trying to do with some Virtual Machines under Proxmox VE.
I'm using IaC tools (Terraform / Terragrunt).
My idea is to create a virtual disk statically and attach it to a virtual machine I would build again and rebuild when needed (configuration is provided through cloud-init which is currently working perfectly fine).
This idea would allow to persist the data (so the virtual disk would be a data disk used by the virtual machine).
I saw that virtual disk creation is allowed by the API here : Proxmox API and it's management (e.g attaching) here : Proxmox API
About the API call which allows virtual disk creation, why is there a required VMID ? Is it not possible to create an unattached virtual disk that I would attach when needed to a virtual machine that I want (e.g I do not care about VMID and I would like to be able to attach the disk to a different VMID VM) ?
When we destroy the Virtual Machine, only attached disks are destroyed as well and it seems there is no option to control that unless detaching the disk before deletion unless I missed something.
E.g the virtual disk created by the CLI (or corresponding API) call
is destroyed if during virtual machine deletion if it is attached through
Would it be possible to add an option which keeps the disks images in the storage even if they are referenced/attached ?
Or, maybe there would better options for doing what I'm trying to do ?
EDIT : My request would be to include an optional parameter in this CLI/API call : Proxmox API
I'm asking for some guidance/better explanations about something I'm trying to do with some Virtual Machines under Proxmox VE.
I'm using IaC tools (Terraform / Terragrunt).
My idea is to create a virtual disk statically and attach it to a virtual machine I would build again and rebuild when needed (configuration is provided through cloud-init which is currently working perfectly fine).
This idea would allow to persist the data (so the virtual disk would be a data disk used by the virtual machine).
I saw that virtual disk creation is allowed by the API here : Proxmox API and it's management (e.g attaching) here : Proxmox API
About the API call which allows virtual disk creation, why is there a required VMID ? Is it not possible to create an unattached virtual disk that I would attach when needed to a virtual machine that I want (e.g I do not care about VMID and I would like to be able to attach the disk to a different VMID VM) ?
When we destroy the Virtual Machine, only attached disks are destroyed as well and it seems there is no option to control that unless detaching the disk before deletion unless I missed something.
E.g the virtual disk created by the CLI (or corresponding API) call
Bash:
pvesh create /nodes/{node}/storage/{storage}/content --filename vm-{vmid}-file --size 20G --vmid {vmid}
Bash:
pvesh create /nodes/{node}/qemu/{vmid}/config --scsi0 dell-storage:vm-{vmid}-file
Would it be possible to add an option which keeps the disks images in the storage even if they are referenced/attached ?
Or, maybe there would better options for doing what I'm trying to do ?
EDIT : My request would be to include an optional parameter in this CLI/API call : Proxmox API
Bash:
unregister | Force virtual disk unregister. Without this, the virtual disk is still referenced in the configuration and will be deleted if the virtual machine is deleted.
Last edited: