dbgeek / terraform-provider-ovm

Terraform provider to manage Oracle OVM resources
MIT License
12 stars 7 forks source link

Resource #8

Open felipeaom opened 6 years ago

felipeaom commented 6 years ago

Hello Björn Ahl,

First of all congratulations for the code, the Oracle VM Server community is not very big but I have full conviction that you made a difference with the terraform.

I have two OVS in my framework and I'm having a hard time parameterizing the "resource". I am in doubt about the code, which I followed the application of the plan:

Error: Error applying plan:

1 error (s) occurred:

* ovm_vm.main: 1 error (s) occurred:

* ovm_vm.main: Post 0004fb00000100007d6dfb629a26512f / ovm / core / wsapi / rest / Vm: unsupported protocol scheme ""

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Can you help with these parameters?

dbgeek commented 6 years ago

Thanks for trying it my pock project.

If you post your terraform main.tf file i can see if I can help you out.

felipeaom commented 6 years ago

Thanks for the feedback.

I tried to make a disk insert and neither performed terraform plan, below was the one that set up and introduced error above.

provider "ovm" {
  user       = "admin"
  password   = "senha"
  entrypoint = "0004fb00000100007d6dfb629a26512f"
}

resource "ovm_vm" "main" {
  name          = "LAB01"
  repositoryid  = "0004fb0000030000c9588907146c705a"
  serverpoolid  = "0004fb0000020000f8ebb4ad66f4a6eb"
  vmdomaintype  = "XEN_HVM"
  cpucount      = 1
  cpucountlimit = 1
  memory        = 1024 //MB
}

entrypoint = ID_POOL repositoryid = ID_OVM serverpoolid = ID_POOL_OVSs

dbgeek commented 6 years ago

entrypoint looks little odd. It should be url to the OVM endpoint. for example

entrypoint = "https://10.64.78.100:7002"

felipeaom commented 6 years ago

I made the suggested change, as follows:

Error: Error applying plan:

1 error(s) occurred:

* ovm_vm.main: 1 error(s) occurred:

* ovm_vm.main: error, OVMAPI_4010E Attempt to send command: create_vm to server: 2cmovs02 failed. OVMAPI_4004E Sync command failed on server: 172.16.10.52. Command: create_vm,

Server error: org.apache.xmlrpc.XmlRpcException: Failed to read server's response: Não há rota para o host (Host unreachable)

 [Sat Aug 18 09:42:10 BRT 2018]

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Ps.

In my environment I have two OVS in Pool but no storage. In the above error I reported the OVS2 repository, when I reported the OVS1 repository it accepted the plan. As a reference for OVS2 to correct the above error.

dbgeek commented 6 years ago

Look like you have problem reaching your ovm?

Server error: org.apache.xmlrpc.XmlRpcException: Failed to read server's response: Não há rota para o host (Host unreachable)

felipeaom commented 6 years ago

This morning I discovered the error in OVS02 and managed to create the main file for it in a simple way.

Can you help me better understand the syntax of your code?

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. *. id, count.index)}" name = "vm1_vdm_2 $ {count.index}" slot = "$ {count.index}" description = "Virtual disk mapping for vm1 and vm1_vdm_2 $ {count.index}" }

I noticed that you use variables for reference or collect the vm ID that will be created, how to edit or create this variable?

Is it possible to create a network interface too?