Subnet update with the subnet's current segment_id fail with: NoUpdateSubnetWhenMultipleSegmentsOnNetwork

Bug #1793391 reported by Harald Jensås
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Harald Jensås

Bug Description

When the update request contains segment_id and the provided segment_id is equal to the id currently on the subnet, the update request will fail if any of the checks in _validate_segment fail with NoUpdateSubnetWhenMultipleSegmentsOnNetwork or SubnetsNotAllAssociatedWithSegments.

[stack@heat-devstack ~]$ openstack network segment list --network testnet
+--------------------------------------+------+--------------------------------------+--------------+---------+
| ID | Name | Network | Network Type | Segment |
+--------------------------------------+------+--------------------------------------+--------------+---------+
| 14ec1077-7836-45ec-9ce1-1bc45c670321 | net1 | 51394a06-75ce-401b-b46b-ebb2b34688b5 | flat | None |
| 884c98bb-22eb-4006-872b-966344d5bf8f | net2 | 51394a06-75ce-401b-b46b-ebb2b34688b5 | flat | None |
+--------------------------------------+------+--------------------------------------+--------------+---------+
[stack@heat-devstack ~]$ openstack subnet list --network testnet
+--------------------------------------+---------+--------------------------------------+-----------------+
| ID | Name | Network | Subnet |
+--------------------------------------+---------+--------------------------------------+-----------------+
| f21edda9-519e-4003-94f1-855c44a52cf8 | subnet1 | 51394a06-75ce-401b-b46b-ebb2b34688b5 | 10.100.100.0/24 |
+--------------------------------------+---------+--------------------------------------+-----------------+
[stack@heat-devstack ~]$ openstack subnet show subnet1
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| allocation_pools | 10.100.100.2-10.100.100.254 |
| cidr | 10.100.100.0/24 |
| created_at | 2018-09-19T20:37:13Z |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 10.100.100.1 |
| host_routes | |
| id | f21edda9-519e-4003-94f1-855c44a52cf8 |
| ip_version | 4 |
| ipv6_address_mode | None |
| ipv6_ra_mode | None |
| name | subnet1 |
| network_id | 51394a06-75ce-401b-b46b-ebb2b34688b5 |
| project_id | fee5807fd59146bc973f89ce2a7c70bd |
| revision_number | 2 |
| segment_id | 14ec1077-7836-45ec-9ce1-1bc45c670321 |
| service_types | |
| subnetpool_id | None |
| tags | |
| updated_at | 2018-09-19T20:40:54Z |
+-------------------+--------------------------------------+

Actual result:
--------------

[stack@heat-devstack ~]$ curl -g -i -X PUT http://192.168.122.222:9696/v2.0/subnets/f21edda9-519e-4003-94f1-855c44a52cf8 -H "Content-Type: application/json" -H "X-Auth-Token: $(openstack token issue -f value -c id)" -d '{"subnet": {"segment_id": "14ec1077-7836-45ec-9ce1-1bc45c670321"}}'
HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 277
X-Openstack-Request-Id: req-999a512f-f49d-407a-bc8c-a7b9f3cb38a7
Date: Wed, 19 Sep 2018 20:43:27 GMT

{"NeutronError": {"message": "The network '51394a06-75ce-401b-b46b-ebb2b34688b5' has multiple segments, it is only possible to associate an existing subnet with a segment on networks with a single segment.", "type": "NoUpdateSubnetWhenMultipleSegmentsOnNetwork", "detail": ""}}

Expected result:
----------------

[stack@heat-devstack ~]$ curl -g -i -X PUT http://192.168.122.222:9696/v2.0/subnets/f21edda9-519e-4003-94f1-855c44a52cf8 -H "Content-Type: application/json" -H "X-Auth-Token: $(openstack token issue -f value -c id)" -d '{"subnet": {"segment_id": "14ec1077-7836-45ec-9ce1-1bc45c670321"}}'
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 670
X-Openstack-Request-Id: req-66f4d422-5a9d-4276-9eae-81142cff4aba
Date: Wed, 19 Sep 2018 21:07:08 GMT

{"subnet":{"updated_at":"2018-09-19T21:07:08Z","ipv6_ra_mode":null,"allocation_pools":[{"start":"10.100.100.2","end":"10.100.100.254"}],"host_routes":[],"revision_number":4,"ipv6_address_mode":null,"id":"f21edda9-519e-4003-94f1-855c44a52cf8","dns_nameservers":[],"gateway_ip":"10.100.100.1","project_id":"fee5807fd59146bc973f89ce2a7c70bd","description":"","tags":[],"cidr":"10.100.100.0/24","subnetpool_id":null,"service_types":[],"name":"subnet1","enable_dhcp":true,"segment_id":"14ec1077-7836-45ec-9ce1-1bc45c670321","network_id":"51394a06-75ce-401b-b46b-ebb2b34688b5","tenant_id":"fee5807fd59146bc973f89ce2a7c70bd","created_at":"2018-09-19T20:37:13Z","ip_version":4}}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/603921

Changed in neutron:
assignee: nobody → Harald Jensås (harald-jensas)
status: New → In Progress
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/603921
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3b5373b4efffc4213bf8753680c9ed3cc305b0d4
Submitter: Zuul
Branch: master

commit 3b5373b4efffc4213bf8753680c9ed3cc305b0d4
Author: Harald Jensås <email address hidden>
Date: Wed Sep 19 15:36:27 2018 +0200

    Allow update request with current segment_id

    If the segment_id in the update request equals the segment_id
    already associated with the subnet being updated, there is no
    need for further update related segment validations.

    Closes-Bug: #1793391
    Change-Id: I65cd5b92b219c14dd07ae72457af243756c4ed02

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/612005

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 13.0.2

This issue was fixed in the openstack/neutron 13.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.0.0b1

This issue was fixed in the openstack/neutron 14.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.