Unable to clone my template's disk
-
Hi, thank for your work. I'm starting with XCP-ng and Xen Orchestra. I'm trying to clone a template to create a new VM.
I first imported a VM from VMware, then I converted this VM into a template under Xen Orchestra .
I'm now trying to clone this template with Terraform. The VM deploys but without OS installed, and the VM remains stuck at boot.
I have the impression that the disk is not recovered from the template (which is the case when I create a new VM from this template via the XO GUI).
Here's my file
data "xenorchestra_pool" "pool" { name_label = "${var.xoa_pool}" } data "xenorchestra_template" "template" { name_label = "${var.xoa_template}" } data "xenorchestra_network" "net" { name_label = "${var.vlan_lan}" } data "xenorchestra_sr" "default" { name_label = "${var.vm_02_dts}" pool_id = data.xenorchestra_pool.pool.id } resource "xenorchestra_vm" "bar" { memory_max = "${var.vm_02_memory_size}" cpus = "${var.vm_02_cpu_number}" name_label = "${var.vm_02_name}" template = data.xenorchestra_template.template.id network { network_id = data.xenorchestra_network.net.id } disk { sr_id = data.xenorchestra_sr.default.id name_label = "[ESXI]prdtpllin501-flat.vmdk" size = 32212254720 } // Override the default create timeout from 5 mins to 20. timeouts { create = "20m" } }
Is this normal or am I using the provider incorrectly?
Thanks -
@AtaxyaNetwork
Hi thank you for your help.I was finally able to solve the problem.
In fact, it's simply that during deployment, the VM ends up with the boot firmware option set to “bios”, whereas my template is originally in uefi.I simply added “hvm_boot_firmware” to uefi in my terraform resource “xenorchestra_vm”.... and that's it!
-
@bvivi57 Hi !
What's the value of
var.xoa_template
in your file ? -
@AtaxyaNetwork
Hi
Thanks for your helpMy value is
variable "xoa_template" { default = "prdtpllin502" }
-
Here is my template
-
@bvivi57 Hum, weird.
From what i see, i can't tell you why is not working.
For the disk part, I did:
disk { sr_id = data.xenorchestra_sr.local_storage.id name_label = var.name size = var.disk_size * 1024 * 1024 * 1024 }
You can check my old project (I used it a couple month ago, so it should work correctly), and check if you can find some differences: https://git.ataxya.net/ataxya/Tsunami
I'll try to find some time to test your file
-
@AtaxyaNetwork
Hi thank you for your help.I was finally able to solve the problem.
In fact, it's simply that during deployment, the VM ends up with the boot firmware option set to “bios”, whereas my template is originally in uefi.I simply added “hvm_boot_firmware” to uefi in my terraform resource “xenorchestra_vm”.... and that's it!
-
@bvivi57 Ah yes, good catch, I didn't think of that !
-
-