Please allow ($VID) use on restore and templates (suggestion)

luison

Renowned Member
Feb 22, 2010
160
6
83
Spain
elsurexiste.com
I think this subject has been commented before but i have not found any directly related posts or documentation.
In our case we use mainly LXC containers mainly for the sake of being able to share certain paths from the hosts across various containers.
We either use templates or restore a template-like backup when we need to create a new container.
Most of our containers bind mount a few directories from the root, in many cases identified by the container id, this is:

/logs/120/ ---> mounted as /var/log
/logs/121/

or

/cache/120 ---> mounted as /var/cache[/CODE]

It would be so great to be able to simply use the container ID as a variable that could work when creating templates or when restoring, so if I restore a template to a new container with ID 100 we could just a kind of variable <$VID>, so instead of

memory: 4096
mp0: /logs/950,mp=/var/log,size=0T
mp1: /cache/950,mp=/cache,size=0T

the /etc/pve/lxc definition files could use:

memory: 4096
mp0: /logs/<$VID>,mp=/var/log,size=0T
mp1: /cache/<$VID>,mp=/cache,size=0T

So would adapt to the containers id when restored.
Apologise if this kind of suggestions should be published elsewhere.