Closed tonyadolph closed 6 years ago
How does the resources look when you defined them in the main.tf file?
I found the problem and as you guessed, my tf file was passing the vm id as the disk!
I've simplified it to:
resource "ovm_vdm" "vm1_vdm" {
count = 1
vmid = "${ovm_vm.vm1.id}"
vdid = "${ovm_vd.vm1_virtualdisk.id}"
name = "vm1_vdm_${count.index}"
slot = "${count.index}"
description = "DEBUG Virtual disk mapping for VmId ${ovm_vm.vm1.id} virtualDiskId ${ovm_vd.vm1_virtualdisk.id}"
}
and it works fine, but I was trying to fix the error with the example. Because this stanza throws an error:
resource "ovm_vdm" "vm1_vdm" {
count = 2
vmid = "${ovm_vm.vm1.id}"
vdid = "${element(ovm_vd.vm1.*.id, count.index)}"
name = "vm1_vdm_2${count.index}"
slot = "${count.index}"
description = "Virtual disk mapping for vm1 and vm1_vdm_2${count.index}"
}
error:
* resource 'ovm_vdm.vm1_vdm' config: unknown resource 'ovm_vd.vm1' referenced in variable ovm_vd.vm1.*.id
this works as I expect:
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}"
}
Note that I changed the vdid line vm1 -> vm1_virtualdisk
Hi Bjoern
I hope you don’t mind the direct email. I looking to use your provider to replace a python script I have written that does the same thing. I’d prefer to use Terraform for Vm Provisioning, so my Python script is not the preferred method for my team.
I have tried your first example, as you are aware. Thanks.
I want to create a StorageElement Mapping but looking through the code and bearing in mind I’m a golang newbie I can only see a DiskMapping.
Today I was looking at the steps to add the extra mapping type.
Have I overlooked something? Can StorageElement Mapping be dome with the existing code? If not, I’d be happy to give it a shot. I have done this in python, it’s a simple change in the data object passed, with a StorageElementId instead of a VirtualDisk Id. But the challenge was to identify the storage element ID. In my python script I get it from the WWID of the physical disk(s). So that extra code would need to be added.
I have not contributed to github til now, so unsure of the best approach. What do you say?
Regards
Tony Adolph
From: Björn Ahl notifications@github.com Sent: Wednesday, June 20, 2018 10:42 PM To: dbgeek/terraform-provider-ovm terraform-provider-ovm@noreply.github.com Cc: tonyadolph tony.adolph@gmail.com; Author author@noreply.github.com Subject: Re: [dbgeek/terraform-provider-ovm] problem with diskmapping - looks like Vm Id is passed as Vmd Id (#6)
Closed #6 https://github.com/dbgeek/terraform-provider-ovm/issues/6 .
— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/dbgeek/terraform-provider-ovm/issues/6#event-1691939837 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AfzuRERhMPkcb8zwmvS8ZXcIov57BoDVks5t-pdugaJpZM4UnWxk mute the thread. https://github.com/notifications/beacon/AfzuROw9lvgW-qg62O5r8LDA8M5WGNepks5t-pdugaJpZM4UnWxk.gif
Hi Tony.
You are correct there is no support for Storage Element mapping Just now.
Please create a new issue and supply some python sample code. I have limited experience with OVS and have a simple lab environment at home.
But if I can see how you have done it with python I can maybe discovery how to do it in terraform. New resource or expand of a resource...
Creation of a VmDiskMapping is failing.
The error reports that there is no disk with ID xxxx and that's because the xxxx is the ID of the vm and not the disk. I have done a little investigation and it looks like checkForResourceVdm is returning a vmid for a vdid (VirtualDiskId)
I added this debug line to func checkForResourceVdm:
log.Printf("[DEBUG] checkForResourceVdm: VirtualDiskId: %v", vdmParams.VirtualDiskId)
2018-06-14T09:42:08.338+0400 [DEBUG] plugin.terraform-provider-ovm: 2018/06/14 09:42:08 [DEBUG] checkForResourceVdm: VirtualDiskId: &{com.oracle.ovm.mgr.ws.model.VirtualDisk 0004fb00000600000e322ca45373b61b }
0004fb00000600000e322ca45373b61b is the VmId not Disk.
I will investigate and feedback.