Replicate VM Template with RBD Volume

jordangarside

New Member
Feb 26, 2023
3
0
1
I have 3 nodes in my cluster, let's call them nodeA, nodeB, nodeC.
They have RBD storage backed by Ceph, ceph-rbd.

I created a VM template on nodeA with a disk image on the ceph-rbd storage.
This VM template can be full cloned to nodeB and nodeC IF AND ONLY IF the clone is initiated from nodeA.

What happens if nodeA were to be taken down?
Well, I wouldn't be able to clone the image anymore.
So, I enable HA on the VM template so that it'll pop up on another node if the source node goes down.

Ok, so now I want to use something like Terraform/the API to create new VMs from that clone on any of my nodes.
How do I know which node to source the clone operation from?
Afaik the only way is to first query the API, parse the results and find the current node that has the VM template.
Also, I imagine none of the existing Terraform providers handle this situation. They probably assume the clone operation is supposed to run on the VM destination node -- as opposed to some random node with --target <destination node>.

It seems like whatever tool I use for automated VM creation not only needs to know about the VM template ID, but also the node that's currently owning the template.
Am I missing something here?

Thanks!
 
Yes, you have to find which node has the VM/Template. With pvesh I use this:

Code:
node=$(pvesh get /cluster/resources --type vm --output-format json | jq -r " .[] | select(.id == \"qemu/${vmid}\") | .node")
 
  • Like
Reactions: jordangarside

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!