Open m0ps opened 5 years ago
@m0ps actually I think the issue is that the provider "variables" don't work 😑. The NewClient function I use everywhere pulls the creds from environment variables and doesn't use the provider's ConfigureFunc.
So please set the XOA_HOST, XOA_USER and XOA_PASSWORD variables like so.
export XOA_HOST=xo.domain.local:443
export XOA_USER=USERNAME
export XOA_PASSWORD=password
The environment variables are actually better since it keeps these credentials out of version control (since I'm guessing most people track this file in git like I do).
Although I just tried to run the test suite and it will fail again because I hardcode the ws
protocol (which will need to be wss
). I should have a fix for this today.
Ok, I tried to use env vars, but now I got another error:
frpa1-cg8332k1s:xenorchestra mkursin$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.xenorchestra_template.template: Refreshing state...
data.xenorchestra_pif.pif: Refreshing state...
Error: Error refreshing state: 2 error(s) occurred:
* data.xenorchestra_template.template: 1 error(s) occurred:
* data.xenorchestra_template.template: data.xenorchestra_template.template: websocket: bad handshake
* data.xenorchestra_pif.pif: 1 error(s) occurred:
* data.xenorchestra_pif.pif: data.xenorchestra_pif.pif: websocket: bad handshake
Ah... I understood what you meant when you said about ws/wss. ws is used for http and wss for https. Ok, so I'm waiting for a fix.
Thanks
I performed a quick source code modification - switched ws to wss and now connection successful. But... I got another error:
1 error(s) occurred:
* xenorchestra_vm.bar: 1 error(s) occurred:
* xenorchestra_vm.bar: jsonrpc2: code -32000 message: unknown error from the peer
I suppose that it out of the scope of the current issue, so if you wish - I can create a separate issue.
BTW cloud config created successfully.
BTW - using cloud_config as a sticky required option is not a good idea cuz terraform has builtin provisioning feature.
But... I got another error:
Bellow you can find xenorchestra_vm resouce config:
resource "xenorchestra_vm" "bar" {
memory_max = 1073733632
cpus = 1
cloud_config = "${xenorchestra_cloud_config.bar.template}"
name_label = "idmbs-testvm2-disk1"
name_description = "description"
template = "${data.xenorchestra_template.template.id}"
network {
network_id = "${data.xenorchestra_pif.pif.network}"
}
disk {
sr_id = "fb489777-f615-1207-119a-3ac5b94d2ff0"
name_label = "idmbs-testvm2-disk1"
size = 32212254720
}
@m0ps the ws and wss was fixed in #11. Notice that I introduced a breaking change (XOA_HOST => XOA_URL). This provider has still not had a tagged release yet so I wanted to name it properly.
Since this issue has quickly become a discussion on multiple things, I have created some other issues. #12 is for the provider configuration bug. #13 is address your concerns about cloud config being a required parameter.
For the latest error you posted:
1 error(s) occurred:
* xenorchestra_vm.bar: 1 error(s) occurred:
* xenorchestra_vm.bar: jsonrpc2: code -32000 message: unknown error from the peer
I'm going to need more help. That jsonrpcv2 error indicates a server error. What version of XO and Xen are you running? The provider has only been tested with Xen Orchestra 5.31.2+. Have you looked at the XO logs at all? Also it would be helpful if you pasted all your terraform code instead of just the vm resource. I want to compare your terraform code to what the acceptance tests run (make testacc
).
@ddelnano thanks for fixes
As for latest error:
I checked logs and found following error:
2019-04-05T09:03:05.999Z - xo:api - [WARN] m0ps | vm.create(...) [6s] =!> Error: no object with UUID or opaque ref: fb489777-f615-1207-119a-3ac5b94d2ff0
This UUID specified in sr_id option of disk description. I double checked and it exist:
[root@idmbs-hv002 ~]# xe sr-list uuid=fb489777-f615-1207-119a-3ac5b94d2ff0
uuid ( RO) : fb489777-f615-1207-119a-3ac5b94d2ff0
name-label ( RW): idmbs-hv002-hdd01
name-description ( RW):
host ( RO): idmbs-hv002
type ( RO): ext
content-type ( RO): user
It looks like I need to describe our env, so it can help you to understand what's wrong.
We have 6 XenServer pools (which contains from one to three physical hosts). All those pools added to the same XO-CE. There is no shared storage used. Each host uses its local (directly attached) storage as SR. Some hosts have few SR, but all of them are stored on local storage devices.
P.S. We are using xo-server 5.36.3 (CE).
What pool does idmbs-hv002
exist on? My setup is currently 1 host and the vm resource does not use pool id. I'm wondering if it's trying to create the VM on a host that doesn't have the SR you are trying to use.
Can you list out the SR objects from XO's side? Use the xo-cli like so.
xo-cli --list-objects --type=SR
Can you try creating a VM with a SR that XO recognizes?
idmbs-hv002 added into the pool that contains only one host. But you are right. I suppose that terraform should "tell" XO on which pool/host VM should be deployed cuz during manual VM rollout - I do it by myself. At least the pool needs to be defined (as a mandatory parameter). But it will be a good idea to have the ability to specify also a host (as an optional parameter).
As for xo-cli - currently we run XO-CE into docker container, and this tool is missed. I'm going to check how to add it soon.
xo-cli output for fb489777-f615-1207-119a-3ac5b94d2ff0 datastore:
{
"type": "SR",
"content_type": "user",
"physical_usage": 248793915392,
"name_description": "",
"name_label": "idmbs-hv002-hdd01",
"size": 1771339907072,
"shared": false,
"SR_type": "ext",
"tags": [],
"usage": 3135326126080,
"VDIs": [
"b476f7e2-c0b5-4304-a372-3031d0d6e303",
"482e3d2e-c538-4aec-8a82-0510c99ea452",
"4b10cd2d-7a70-4ce6-86c1-e341f20acc01",
"c76cbb7e-9a95-4464-a542-ab8d5736c43b",
"3472ebb7-685d-460f-8d63-2d7759fdf081",
"efcbda0c-50da-4586-8ead-22d575de2ffc",
"94e3d12f-a42c-4867-8dec-9eaea712aee3",
"beaf819d-789f-4bc7-a850-34b07b03f0dd",
"5e7e23fb-5d1e-4fc5-b38b-56b430f213a6",
"f6a404ea-6054-43fd-81d6-b7a386acb61f",
"1342967b-8148-41b6-bd06-2ecd4ed5f90a",
"a949414c-451c-4252-9ed1-106d249071cf",
"4f3e72e6-d0a2-44bb-ad1a-ed8e099a5456",
"0736c976-e219-4d25-9660-743f7577bb5d",
"2a828138-e7a6-4a4b-9323-5f4c80393cbd",
"98a56078-52f0-47b7-9eb2-f15b61e8d329",
"2282f42f-8d62-4c73-aa04-9555a7476de6",
"5c0f6785-e7a0-465d-a9d8-a51cb4f01e8f",
"4e0350f6-f36b-4757-bcbf-f3a9a916fae7",
"6232588d-b2ff-476b-b803-74db08f1da8e",
"43806892-3752-4a0f-9170-4bc840e80319",
"49a9f36a-782e-4d44-a0e5-e40728448f87",
"e62d8b1c-7dd0-4526-adfa-a9d09a250953",
"8b5755d2-f44a-49e6-ab07-d68993bd0fef",
"ef540c10-d75d-41d2-ad20-471cb1375f09",
"f8a2685b-982e-490e-8a8e-d381e757301c",
"1dd20a11-f8bc-4aaa-b0d3-701b7a804b84",
"aba7f015-ea86-4b2c-a72e-8ec3a484b799",
"789cfcb6-52f8-43f3-9f98-70c2f8758acd",
"b4c33781-53e5-481f-b8fd-58a7490df308",
"850dcf2e-6331-46e9-961f-a4a1a706854e",
"3adb7759-2cc6-4463-8331-db2da7036afc",
"21a7643c-082a-47f2-adb5-0f1d0c2bf59d",
"14991255-3be6-45e0-9308-387a6ef6242c",
"a084cd2a-5e0b-4a6c-adb2-a1afb10c7ca1",
"036ec4c1-ae7e-4963-9bf9-8f166ab8d43b",
"b16872d1-0bd4-40a0-8fb2-d888af567936",
"b0148c8e-a440-4bdb-a818-076bead189bf",
"ec4a6fa7-5b12-4133-ac9c-bf523e4758ee",
"50f0bd55-ea36-4d8e-a295-0297893404f0",
"d66a9f64-ef0d-4f2f-a258-35ec3e5ee4a0",
"862c692a-371d-4311-87c5-c015ae1bc669",
"f90d1477-a8fc-48ba-9d89-a990774dcadd",
"416319ed-d96c-44b9-a361-07f013ecd016",
"3a84864c-fd59-40f0-9785-93267cba3230",
"e3305ab1-e841-4f29-a70b-b7df0980835a",
"07cebf1d-30c1-49d5-adb6-5535f90d270f",
"d09f17f1-813d-4787-807d-e0cb7d48fb25",
"6cfb2d3e-fe42-4800-a916-bd7ee802726d",
"6f25d43f-97c2-4411-ae90-926dc755e27c",
"65dfdc50-1d56-4318-b3dc-e4724d87583d",
"bdb21bbc-f3fb-483b-889a-fe20c9cd6614",
"d9bc1728-da8c-4d1c-991c-4b7348ee5cc7",
"fad007df-05ef-40a0-9668-3126b5d65279"
],
"other_config": {
"i18n-original-value-name_label": "Local storage",
"i18n-key": "local-storage"
},
"sm_config": {
"devserial": "scsi-361866da059754900231184d125104b56"
},
"$container": "78ee94ae-d2c6-4129-98bf-da99875684c9",
"$PBDs": [
"ff171cab-9eee-d88a-bc77-86f12a4d4525"
],
"id": "fb489777-f615-1207-119a-3ac5b94d2ff0",
"uuid": "fb489777-f615-1207-119a-3ac5b94d2ff0",
"$pool": "bdabdcfc-8708-3e32-4c63-156965020968",
"$poolId": "bdabdcfc-8708-3e32-4c63-156965020968"
}
Hm after looking into this more the xo api does not support setting the pool id. I know the web UI allows you to select which pool the VM will be created on but I'm not sure how that is being implemented (since vm.create
doesn't have a pool id parameter).
Maybe this is what affinityHost
should be used for? Or maybe passing SRs to the vm.create endpoint is the wrong thing? Maybe they should be VDIs instead? I'm still very new to Xen but I'll be doing some research around that and ask on the XO irc.
Yes, affinityHost is used for selecting exactly host in a pool on which VM will be placed. As for the pool selection method, probably @olivierlambert can clarify.
Pool (and even host) placement is SR related. Within a pool, affinityHost
is a way to ask XAPI if it could be started on a specific host but without any guarantee it will run there.
VM placement is a very complex topic, feel free to ask for me details, I'll answer when I can.
Evaluating also this provider (and xenorchesta as a whole) and pumped to this same error
xenorchestra_vm.bar: Creating...
core_os: "" => "false"
cpu_cap: "" => "0"
cpu_weight: "" => "0"
cpus: "" => "1"
disk.#: "" => "1"
disk.2471359032.name_label: "" => "lab-terraform-server1_imavo"
disk.2471359032.size: "" => "32212254720"
disk.2471359032.sr_id: "" => "a744fb8b-a102-2585-a81f-d0f2958ef44f"
memory_max: "" => "1073733632"
name_description: "" => "first terraform server ever"
name_label: "" => "lab-terraform-server1"
network.#: "" => "1"
network.2629153133.network_id: "" => "f8ccb7ba-6400-b172-7913-f202eeafd7ed"
template: "" => "OpaqueRef:c5077108-40b3-4ea1-b9ef-b6803bd79900"
Error: Error applying plan:
1 error occurred:
* xenorchestra_vm.bar: 1 error occurred:
* xenorchestra_vm.bar: jsonrpc2: code -32000 message: unknown error from the peer
And these logs I got when I ran this on xoa server sudo journalctl -f -u xo-server.service
:
Jul 01 08:09:12 xoa xo-server[62170]: 2019-07-01T12:09:12.335Z - xo:main - [INFO] + WebSocket connection (::ffff:192.168.1.229)
Jul 01 08:09:12 xoa xo-server[62170]: 2019-07-01T12:09:12.336Z - xo:main - [INFO] + WebSocket connection (::ffff:192.168.1.229)
Jul 01 08:09:20 xoa xo-server[62170]: 2019-07-01T12:09:20.204Z - xo:main - [INFO] + WebSocket connection (::ffff:192.168.1.229)
Jul 01 08:09:20 xoa xo-server[62170]: 2019-07-01T12:09:20.272Z - xo:xapi - [DEBUG] Cloning VM Debian Stretch 9.0 as lab-terraform-server1
Jul 01 08:09:20 xoa xo-server[62170]: 2019-07-01T12:09:20.613Z - xo:xapi - [DEBUG] Creating VIF for VM lab-terraform-server1 on network Pool-wide network associated with eth0
Jul 01 08:09:20 xoa xo-server[62170]: 2019-07-01T12:09:20.946Z - xo:xapi - [DEBUG] Deleting VM lab-terraform-server1
Jul 01 08:09:21 xoa xo-server[62170]: 2019-07-01T12:09:21.151Z - xo:api - [WARN] admin@admin.net | vm.create(...) [880ms] =!> Error: no object with UUID or opaque ref: undefined
Jul 01 08:09:21 xoa xo-server[62170]: 2019-07-01T12:09:21.176Z - xo:main - [INFO] - WebSocket connection (::ffff:192.168.1.229)
Any pointers to look further on this?
@7ojo sorry I've been through moving aparments and a few trips the past few weeks. Can you explain more about your Xenserver setup (how many hosts, etc)?
Error: no object with UUID or opaque ref: undefined That part is interesting since in the previous logs we looked at earlier in this thread led us to a specific SR.
No worries. Setup was nothing special really. I was just evaluating this and installed XCP-ng + XenOrchestra on Intel Nuc hardware so it was a fresh installation.
I don't have this setup anymore so can't debug more on this, had to move different platform.
I've got the same issue with version 0.24.1 and 0.25.1. My set up is with 3 pools. I can deploy to the first pool but when I try to deploy to the other pool I'm getting the errors "Error: jsonrpc2: code -32000 message: no object with UUID or opaque ref:"
Any help really appreciated.
I suppose your XO is connected to all those pools, right? (sorry for the trivial question)
yes, it is. TF code can gather information like pool, storage, network or host ID.
Hello! I'm trying to evaluate terraform-provider-xenorchestra and faced with the following issue:
As I correctly understand, it tries to connect via http (tcp/80) to xenorchestra, but in our deployment only https (tcp/443) is available.
Provider credentials configured in the following way:
So I suppose that it should tries to connect over https. Or I miss something?