Linked Templates/Clones

zagerstyle

New Member
Mar 17, 2022
4
0
1
42
I managed proxmox via terraform. It just so happens I lost my local configuration and didn't have this one DC in github. I was recreating the state file and the configuration and when i import the resource i see that the the provider at least thinks this isn't a clone
Code:
            "clone": null,
            "clone_wait": null,

well that is strange -- i also see there is an attribute called "full_clone" and it is set to false. Since i know i created these VM's with terraform and I am about 95% sure i did a full clone, i need to verify this is a problem with the provider and not a configuration error on my part. However i do not see a way to show the parent of a VM (if it is a clone) or the childen of a template. Is there a quick way to display this?

Assuming that for some reason I did not create a template -- can i alter a config file or a db entry to tell proxmox this is in fact a full clone so i can reconcile my terraform state?
 
In the subject you mention "Linked Templates/Clones" but the text of your question is about "full" clones. Admittedly I dont know what dependencies you have for terraform, however a full clone has no dependencies or linkage to the original VM or Template. Its literally a full byte copy. Any further tracking where that clone came from is only for your application use.
A linked-clone from a template is different. Depending on your underlying storage the clone start completely thin and depends for its data on the original template.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
In the subject you mention "Linked Templates/Clones" but the text of your question is about "full" clones. Admittedly I dont know what dependencies you have for terraform, however a full clone has no dependencies or linkage to the original VM or Template. Its literally a full byte copy. Any further tracking where that clone came from is only for your application use.
A linked-clone from a template is different. Depending on your underlying storage the clone start completely thin and depends for its data on the original template.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Sorry if I was not clear -- the terraform module pulls data from the proxmox api and the api is returning that the vm was not created with a template. Is there somewhere in the template or the vm I can see what relationships I have between templates and vm's ? Sorry for poor formatting on my phone
 
I dont think you can. If its a full clone - its essentially a full independent VM. Short of using --description there is nothing that indicates its origin.
Even for linked clones, Proxmox offloads implementation of "linked" to the underlying storage and treats the VMs no different than others.
Again, you could use "description" or query the storage to figure out if the disk is thin/cloned (but this depends on storage).

Perhaps one of the PVE members will chime in, but I wouldnt be surprised if that field you found is not used. Proxmox strives to not keep central database of configuration for VMs. Almost all VM information is stored in vm.conf file that you can examine.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
out of curiosity - do you know which API call produced those fields that you mentioned?
A quick glance at https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/config and around it, did not reveal "clone" or "clone_wait". It could be something terraform "makes up" for its own use.

This page : https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/resources/vm_qemu
states that at least clone_wait is depreciated.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
I dont think you can. If its a full clone - its essentially a full independent VM. Short of using --description there is nothing that indicates its origin.
Even for linked clones, Proxmox offloads implementation of "linked" to the underlying storage and treats the VMs no different than others.
Again, you could use "description" or query the storage to figure out if the disk is thin/cloned (but this depends on storage).

Perhaps one of the PVE members will chime in, but I wouldnt be surprised if that field you found is not used. Proxmox strives to not keep central database of configuration for VMs. Almost all VM information is stored in vm.conf file that you can examine.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
That is unfortunate. In my case i am using ZFS and don't see the underlying disk as a clones of anything. Which i would expect as i do full clones -- so i need a way to reconcile the terraform state since the normal sync doesn't seem to work at least the way i expect it to. Obviously this is not a problem with proxmox -- it is an issue of getting the correct state in terraform. Anything i would do in proxmox is a workaround to that end. Thanks for the time in replying!
 
out of curiosity - do you know which API call produced those fields that you mentioned?
A quick glance at https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/config and around it, did not reveal "clone" or "clone_wait". It could be something terraform "makes up" for its own use.

This page : https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/resources/vm_qemu
states that at least clone_wait is depreciated.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
I am actually crawling through the code now to get that information and how the module produces this data. Here is the code base that interacts with the API but i don't know if its the only part of the code that interacts with it
Code:
https://github.com/Telmate/proxmox-api-go/blob/master/proxmox/config_qemu.go

My GO isn't exactly top tier so its taking me a bit longer than normal
 

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!