Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reservation AR_ID cannot be set to 0 #512

Closed
sk4zuzu opened this issue Dec 20, 2023 · 0 comments · Fixed by #513
Closed

Reservation AR_ID cannot be set to 0 #512

sk4zuzu opened this issue Dec 20, 2023 · 0 comments · Fixed by #513

Comments

@sk4zuzu
Copy link
Collaborator

sk4zuzu commented Dec 20, 2023

Description

ARs in OpenNebula for any VNET are numbered starting from 0. Setting the IP parameter in the reservation template requires also AR_ID to be provided. In the current implementation setting reservation_ar_id=0 is just the same as implying reservation_ar_id=null, thus the reservation_first_ip parameter cannot be with the first AR in a VNET. This is not reflected in unit tests as the AR used there is never the first one (AR_ID=0).

Terraform and Provider version

Terraform v1.6.5
on linux_amd64
+ provider registry.terraform.io/opennebula/opennebula v1.3.1

Affected resources and data sources

opennebula_virtual_network

Terraform configuration

resource "opennebula_virtual_network" "example" {
  name                 = "virtual-network"
  reservation_vnet     = 394
  reservation_size     = 5
  reservation_ar_id    = 0 # here
  reservation_first_ip = "172.16.100.105"
}

Expected behavior

Reservation is created without errors.

Actual behavior

OpenNebula returns error:

╷
│ Error: Failed to reserve network addresses
│
│   with opennebula_virtual_network.example,
│   on main.tf line 17, in resource "opennebula_virtual_network" "example":
│   17: resource "opennebula_virtual_network" "example" {
│
│ Virtual network (ID: 1) reservation: OpenNebula error [ACTION]: [one.vn.reserve] AR_ID must be specified for IP/MAC based reservations
╵

The AR_ID is actually missing from the reservation template.

Steps to Reproduce

It's just enough the take any VNET and try to create reservation with both reservation_first_ip="A.B.C.D" and reservation_ar_id=0.

Debug output

Not sure if this is required, the issue is really easy to reproduce.

Panic output

N/A

Important factoids

N/A

References

https://docs.opennebula.io/stable/integration_and_development/system_interfaces/api.html#one-vn-reserve

@sk4zuzu sk4zuzu self-assigned this Dec 20, 2023
sk4zuzu added a commit that referenced this issue Dec 20, 2023
@treywelsh treywelsh linked a pull request Jan 3, 2024 that will close this issue
7 tasks
@treywelsh treywelsh added this to the 1.4.0 milestone Jan 4, 2024
treywelsh pushed a commit that referenced this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants