Closed Lithimlin closed 2 months ago
Files identified in the description:
plugins/modules/proxmox
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @Ajpantuso @Thulium-Drake @UnderGreen @joshainglis @karmab @krauthosting click here for bot help
Upon further investigation it seems that this is a problem with the Proxmox API:
The syntax for creating and mounting a new volume is <storage>:<size-in-GB>,mp=<mountpoint>
.
However, to not overwrite this, the syntax <storage>:vm-<vmid>-disk-<index>,mp=<mountpoint>,size=<size>G[,...]
would be required, otherwise a new volume is created each time.
I'd prefer to have a solution inside the proxmox module though rather than, e.g., check inside a playbook each time whether a volume already exists or it needs to be created.
Looking at the module, it seems the best way to go about this may be to slightly rework the way mounts and disks are defined: Instead of taking the plain string, the module would take dicts to define each mount and the rootfs.
Sounds like a good idea to me - but you have to make this backwards compatible, so it's probably best to add a new option for that, mutually exclusive with the old one, and in case the old is specified parse the mount config and convert it to the new form.
(I have no idea how much work that would be though...)
I'm not sure how long this would take either and I'm also not sure how much time I'll be able to allocate to this. I also have no clue yet what overhead goes into contributing to this. The biggest question I think is how much we'd want to future-proof the implementation against possible future options.
Due to the existence of Bind Mount Points, things seem more complicated than I first expected.
Summary
Currently, it seems the creation of mount points with the documented syntax is not idempotent but instead creates a new mount disk each time the update task is run.
In the documentation's example, the syntax is:
<storage>:<size-in-GB>,mp=<mountpoint>
Issue Type
Bug Report
Component Name
proxmox
Ansible Version
Community.general Version
Configuration
OS / Environment
Steps to Reproduce
Expected Results
The LXC is created and configured with a single mountpoint idempotently, even when the playbook is run again. More importantly, no extra volumes are created on subsequent runs unless specified.
Actual Results
The LXC is updated and a new mount volume is created. On a container restart, the previous volume is unmounted and the newly-created on is mounted. In the
machines01
storage, new volumesvm-<id>-disk-<n>
are created each time the playbook is run. In the LXC resources tab, the actually mounted disk ismachines01:vm-<id>-disk-<n>,mp=/mnt/data,size=4G
with a change tomachines01:4,mp=/mnt/data
is queued.Code of Conduct