Open gks0010 opened 6 years ago
Hi @gks0010 ,
Unfortunately I found your message after spending hours figuring out why it did not work :) Thanks for the update. Do you have an idea how to boot VM right after creation ? It works when it cloned from a template but does not with simple VM creation option.
Test to build from this branch https://github.com/dbgeek/terraform-provider-ovm/tree/start_vm_after_clone
added a option that when created vm/cloning to startvm
Hi @dbgeek ,
Thanks for adding new feature. It tired it, but it looks like something wrong with dependencies: Probably it tries start VM before making disk mapping. Created VM has no disks mapping. As a result I see in the exception:
Error: Error applying plan:
1 error(s) occurred:
ovm_vm.vm1: 1 error(s) occurred:
ovm_vm.vm1: error, OVMRU_005039E Cannot boot Virtual Machine: vm1. It has no disks or CDROMs, and PXE is not configured. [Wed Mar 06 04:31:30 PST 2019]
Once I set startvm = false, disk mapping works fine
Did not think about that, but that is logic that it will happen. See if can find a solution for this.
You are creating an empty VM or are you cloning? I guess that when you clone it should work.
Creation of empty VM. I noticed even VM start job was not created on a manager server. I did not try cloning, I will do it too. My config is
provider "ovm" { user = "${var.ovm_username}" password = "${var.ovm_password}" entrypoint = "${var.ovm_endpoint}" }
resource "ovm_vm" "vm1" { name = "vm1" repositoryid = "${var.vm_repositoryid}" serverpoolid = "${var.serverpoolid}" vmdomaintype = "XEN_HVM" cpucount = 2 cpucountlimit = 2 memory = 1024 //MB networkid = "${var.network601}" }
resource "ovm_vd" "vm1_virtualdisk" { count = 2 name = "vm1_vd${count.index}" sparse = true shareable = false repositoryid = "${var.vd_repositoryid}" size = 10485760000 //bytes }
resource "ovm_vdm" "vm1_vdm" { count = 2 vmid = "${ovm_vm.vm1.id}" vdid = "${element(ovm_vd.vm1_virtualdisk.*.id, count.index)}" name = "vm1_vdm_2${count.index}" slot = "${count.index}" description = "Virtual disk mapping for vm1 and vm1_vdm_2${count.index}" }
Also I guess there is no way to boot created VM via PXE. Only cloned via sending messages. Am I right?
Thanks !
Hi @dbgeek,
Could you suggest what have to be values of following variable and configuration argument in config file for deployment from a template? "${var.virtualnicid}" - is it MAC address which I want to be assigned? also in your example: vmdiskmappingid = "0004fb0000130000f8e1fa844def645e" - is disk ID of VM Template ?
I found some errors in the example. I just wanted to share this so others can get this great tool working quickly. I am a terraform novice so this may not be the best code but it worked.
terraform.tfvars:
ovm_username = "admin" ovm_password = "XXXX" ovm_endpoint = "https://999.999.999.999:7002" vm_repositoryid = "0004fb00000300004c1b5b5a69c6e3c4" serverpoolid = "0004fb00000200000b832b5773aedac2" vd_repositoryid = "0004fb00000300004c1b5b5a69c6e3c4"
main.tf:
variable vm_repositoryid {} variable serverpoolid {} variable vd_repositoryid {} variable ovm_username {} variable ovm_password {} variable ovm_endpoint {}
provider "ovm" { user = "${var.ovm_username}" password = "${var.ovm_password}" entrypoint = "${var.ovm_endpoint}" }
resource "ovm_vm" "vm1" { name = "vm1" repositoryid = "${var.vm_repositoryid}" serverpoolid = "${var.serverpoolid}" vmdomaintype = "XEN_HVM" cpucount = 2 cpucountlimit = 2 memory = 512 //MB }
resource "ovm_vd" "vm1_virtualdisk" { count = 2 name = "vm1_vd${count.index}" sparse = true shareable = false repositoryid = "${var.vd_repositoryid}" size = 104857600 //bytes }
resource "ovm_vdm" "vm1_vdm" { count = 2 vmid = "${ovm_vm.vm1.id}" vdid = "${element(ovm_vd.vm1_virtualdisk.*.id, count.index)}" name = "vm1_vdm_2${count.index}" slot = "${count.index}" description = "Virtual disk mapping for vm1 and vm1_vdm_2${count.index}" }