Closed josuemotte closed 1 year ago
Hi,
By TF you mean the TerraForm plugin for XO? If yes, have you reported first to the XO TF Github? Also, could you reproduce the issue and find the exact broken commit?
Thanks!
Hello,
This TF : https://github.com/terra-farm/terraform-provider-xenorchestra , I'll open an issue there as well.
I found the commit : https://github.com/vatesfr/xen-orchestra/commit/d6a3492e90d9ae6135cd43510ce963d08bcf3b8c , this commit bring also another side effect which is that , users are forced to add a MAC Address when creating a VM.
Cheers
Ah indeed good catch. Let me ping @julien-f for this :)
after more testing, the issue seems to be related to the argument : affinity_host of the resource xenorchestra_vm, if the value is not correct you won't receive any error just a broken VM.
The argument was previously optional but since https://github.com/vatesfr/xen-orchestra/commit/d6a3492e90d9ae6135cd43510ce963d08bcf3b8c it is now mandatory.
An issue is open on the TF project : https://github.com/terra-farm/terraform-provider-xenorchestra/issues/231
Perfect, thanks for your investigation. We'll fix this :)
@josuemotte I cannot reproduce the problem in XO itself, the issue may be in the TerraForm provider instead. If you can reproduce directly in XO, let me know.
@pdonias Can you check that VM creation in xo-web does not send an empty MAC address param? The parameter is optional but must not be empty.
hello @julien-f,
To reproduce the issue, you need to set affinity_host to a wrong value such as the pool id instead of the host id, the TF provider won't see it as an error since the formatting is correct.
The machine will be create in XO but the start will give the above error message, can the affinity_host parameter become optional like before ?
Here is how we ended with the error message :
resource "xenorchestra_vm" "vm" {
for_each = local.vm
name_label = each.key
name_description = each.value.description
memory_max = (1073741824 * each.value.memory)
cpus = each.value.cpu
cloud_config = templatefile("linux.tftpl",{
name = each.key
})
cloud_network_config = templatefile("network.tftpl",{
ipaddress = each.value.ipaddress
})
template = "d627d80d-027a-3993-ad48-2b59b621f40e"
affinity_host = "wrongid"
network {
network_id = "bb873991-36c0-a596-d25a-87e87e17b853"
mac_address = each.value.mac_address
}
disk {
sr_id = "5f7ae541-c9be-fae5-51d1-6fc830b1ffe7"
name_label = each.key
size = (1073741824 * each.value.disk_size)
}
tags = [
"Linux",
each.value.tags
]
// Override the default create timeout from 5 mins to 20.
timeouts {
create = "5m"
}
}
This looks like an TerraForm plugin issue and is not something to handle on XO's side.
Anyway, it's perfectly normal for vm.start
to not work if it is passed an invalid host
.
@julien-f Yes, the MAC addresses may be empty, let's fix it.
Closing, feel free to re-open if reproduced in XO itself.
@julien-f can't find the commit https://github.com/vatesfr/xen-orchestra/commit/7a999b460e847546122f152180f08b64b27badc9 in the master branch
@josuemotte The commit you are looking for is https://github.com/vatesfr/xen-orchestra/commit/954b29cb61d8090438513b288d21a30e57a8a41e
Hello,
All machines created via TF are failing at start, while deploying manually is working correctly.
It was working on commit : https://github.com/vatesfr/xen-orchestra/commit/c8b29da67718f8d8b891a7df6474d83534d65978
here is the log output :
What else can I provide in order to help ?