Cluster-wide template

davit

New Member
Nov 4, 2022
2
0
1
We have proxmox cluster with 3 nodes. We used to create VM template on each node and later creating new vms from those templates using
"qm clone <template_vmid> <new_vmid>"

In above case we need to keep managing 3 templates (as there are 3 nodes). So trying to see if there is way to have only 1 template which is visible for all 3 nodes and in each node we can use "qm clone" cmd to create new vm using same template ID.
 
I still don't fully understand what exactly you want to achieve with this. Why don't you make a template, then clone the VM and simply move it and the storage to the corresponding node?
 
cloning a new vm from template and then migrating to target node is taking too much time. I was trying to achieve faster solution i.e directly clone vm from template to target node (target can be any node in cluster not just node which have template)
So based on above comment we can say there are only 2 ways to do this?
1. attach NAS/NFS shared storage to nodes in cluster and keep templates there or
2. clone a new vm from template then migrate to target node
 
2. clone a new vm from template then migrate to target node
I think, this approach would be functionally equivalent to what you are doing now. Still moving data from one node to another, just at a different point.

The only way to speed things up is to have Shared Storage. It may be sufficient to have just shared Template storage. However, the template is still "owned" by a node, so you you can only clone to local storage on that node. You'd need two steps, migrate Template to target node, then clone it locally.

If you have Shared Storage for both Template and VM images, then you can make fast clones to any node.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
Hi,

I was facing the same issue!
I have created a VM image (8000) with a custom cloudinit config and converted it to a template which is only visible on the node where it was created.
I'm using a shared storage for images.

After some research I came to the following conclusion:
The config file for the vm-template is stored on the node in /etc/pve/qemu-server, where qemu-server is a symlink to nodes/<node>/qemu-server.
By this apprough, used by proxmox, it is normal that the template is only visible for only the node on which it was created.
Trying to copy the vm-template file to the location of ghe other nodes will result in the message that the file already exist, dispite we can not see it.
The reason for this is that the folder /etc/pve is shared over the cluster nodes, using fuse:
# mount | grep /etc/pve
/dev/fuse on /etc/pve type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
Applying a HA group config does not migrate the VM-template to another node when the node on which it was created becomes unavailable.
Resulting that we are unable to create new VM's using the VM-template on other nodes.

BTW, it is also disappointing that the clones process to another node will first create the vm on the node on which the vm-template is available and migrates it afterwards to the selected node!

Right now, the best solution I have is as follow:
  • clone the vm-template with VM_ID 8000) to new VM_ID 8001 on another node.
    This will result of course in a new base (OS) and vm-cloudinit image refering to the new VM_ID.

  • convert the new VM_ID to a template

  • ssh on the node where the template has been cloned to:

    edit the file in /etc/pve/qemu-server/8001.conf
    change following in the file for the base (OS) and clouninit image, in my case the lines starting with ide2 and scsi0:
    • 8001/vm-8001-cloudinit.qcow2
    • 8001/base-8001-disk-0.qcow2

      replace for both lines the new VM_ID 8001 by the initial VM_ID 8000.
The new vm-template 8001 will now make use of the base (OS) and cloudinit images of the initial vm-template 8000​
  • The base and cloudinit images for the new vm-template 8001 can now be removed safely.
    You can not remove them from the web-interface -> selecting the storage for images, as it will result in an error that the image is assigned to the VM-ID and can not be removed.
    However, you can safely remove the folder (new VM_ID 8001) from your shared storage.
    This way, you only use disk-space for one single base and cloudinit image.

  • Apply the same procedure for cloning the vm-template to other nodes when needed
Hope this is usefull for others, untill proxmox provides a solution to make one single vm-template available for all n odes or allow admins to select nodes on which it should become available for use.
 
Hi,

For the solution described above, the four steps described for making the VM-template available on other nodes can be more easily accomplished as follows:

ssh on the node where the initial vm-template has been created.

cd /etc/pve/nodes/<current node name>/qemu-server
cp 8000.conf /etc/pve/nodes/<node name to copy the vmtemplate to>/qemu-server/8001.conf

After some time you will see in the web-interface that the vm-template is recognized as a new vm-template and works fine to create new VM's from it by using the initial base (OS) and cloudinit images located on the shared storage.

Note: make use of different VM_ID's when copying the template to other nodes!
 
Last edited:
I have created a VM image (8000) with a custom cloudinit config and converted it to a template which is only visible on the node where it was created.
I'm using a shared storage for images.
I have a "real" cluster with a "real" shared storage" (FC-based SAN) it it just works as it should. I have a template on node 1 and I can simple right click on the template, clone it to another node and it works as it should.

So I really don't get what is NOT working exactly if the image is already on a shared storage (without a shared storage, it won't work).
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!