-
Notifications
You must be signed in to change notification settings - Fork 583
Networking V2: Omit empty external IP address of the router #1414
Copy link
Copy link
Closed
Description
The problem description in the https://github.com/terraform-providers/terraform-provider-openstack/issues/449
This request fails:
{
"router": {
"admin_state_up": true,
"external_gateway_info": {
"external_fixed_ips": [
{
"ip_address": "",
"subnet_id": "55130f47-833c-4210-9768-c174fd9b2671"
}
],
"network_id": "f55c8e3d-c798-4c6c-9f7e-eeb6600f6aed"
},
"name": "router"
}
}This one works fine:
{
"router": {
"admin_state_up": true,
"external_gateway_info": {
"external_fixed_ips": [
{
"subnet_id": "55130f47-833c-4210-9768-c174fd9b2671"
}
],
"network_id": "f55c8e3d-c798-4c6c-9f7e-eeb6600f6aed"
},
"name": "router"
}
}response:
{
"router": {
"status": "ACTIVE",
"external_gateway_info": {
"network_id": "f55c8e3d-c798-4c6c-9f7e-eeb6600f6aed",
"enable_snat": true,
"external_fixed_ips": [
{
"subnet_id": "55130f47-833c-4210-9768-c174fd9b2671",
"ip_address": "10.16.25.146"
}
]
},
"name": "router",
"admin_state_up": true,
"tenant_id": "a5e9d48232dc4aa59a716b5ced963584",
"routes": [],
"id": "c1afd3a0-dc39-434f-82c2-1911d764a384",
"description": ""
}
}I assume that this ip_address field could be omitted in gophercloud, if it is not set., because it could be allocated automatically.
Some references:
- https://github.com/openstack/neutron/blob/mitaka-eol/neutron/db/l3_db.py#L217..L224
- https://github.com/openstack/neutron/blob/mitaka-eol/neutron/db/l3_db.py#L450..L487
- https://github.com/openstack/neutron/blob/mitaka-eol/neutron/extensions/l3_ext_gw_mode.py#L22..L39
With the diff below I was able to create a router with the desired subnet_id:
b/openstack/networking/v2/extensions/layer3/routers/results.go
@@ -16,7 +16,7 @@ type GatewayInfo struct {
// ExternalFixedIP is the IP address and subnet ID of the external gateway of a
// router.
type ExternalFixedIP struct {
- IPAddress string `json:"ip_address"`
+ IPAddress string `json:"ip_address,omitempty"`
SubnetID string `json:"subnet_id"`
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels