openstack client does not pass prefixlen when creating subnet
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack SDK |
Fix Released
|
Undecided
|
Unassigned | ||
neutron |
Fix Released
|
High
|
Brian Haley |
Bug Description
Version: Pike
OpenStack Client: 3.12.0
When testing Subnet Pool functionality, I found that the behavior between the openstack and neutron clients is different.
Subnet pool:
root@controller
+------
| Field | Value |
+------
| address_scope_id | None |
| created_at | 2018-03-
| default_prefixlen | 8 |
| default_quota | None |
| description | |
| id | e49703d8-
| ip_version | 4 |
| is_default | False |
| max_prefixlen | 32 |
| min_prefixlen | 8 |
| name | MySubnetPool |
| prefixes | 172.31.0.0/16 |
| project_id | 9233b6b4f6a5438
| revision_number | 0 |
| shared | False |
| tags | |
| updated_at | 2018-03-
+------
When attempting to create a /28 subnet from that pool with the openstack client, the following error is observed:
root@controller
> --subnet-pool MySubnetPool \
> --prefix-length 28 \
> --network MyVLANNetwork2 \
> MyFlatSubnetFro
HttpException: Internal Server Error (HTTP 500) (Request-ID: req-61b3f00a-
However, the same request is successful with the neutron client:
root@controller
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+------
| Field | Value |
+------
| allocation_pools | {"start": "172.31.0.2", "end": "172.31.0.14"} |
| cidr | 172.31.0.0/28 |
| created_at | 2018-03-
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 172.31.0.1 |
| host_routes | |
| id | 43cb9dda-
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | MySubnetFromPool |
| network_id | e01ca743-
| project_id | 9233b6b4f6a5438
| revision_number | 0 |
| service_types | |
| subnetpool_id | e49703d8-
| tags | |
| tenant_id | 9233b6b4f6a5438
| updated_at | 2018-03-
+------
The payload is different between these clients - the openstack client fails to send the prefixlen key.
openstack client:
REQ: curl -g -i -X POST http://
http://
neutron client:
REQ: curl -g -i -X POST http://
This appears to stem from prefixlen missing as a query parameter and property in the python-openstacksdk here:
https:/
https:/
The Neutron docs do not show prefixlen as a subnet as a valid property, which could be why:
https:/
I was able to patch the openstack SDK in my environment and got the client to work. Please let me know if you have any questions!
So it looks like there are multiple issues here - the api-ref in neutron-lib is missing this field, and as you stated, the sdk is missing it probably because it's not listed. I'll ping someone to take a look at the api-ref. I'm not that familiar with the sdk but if you had a simple patch that helps feel free to post it and I'll take a look. Thanks.