Updating a network in server resource to refer to the currently used port, cause stack update error

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

Bug Description

old snippet:
  networks:
    - subnet: s1

new snippet:
  networks:
    - port: p1 ---which is the same port

When performing a stack update of a stack created with old_snippet the stack update fail with this error:
  Resource UPDATE failed: NotFound: resources.my_instance: Port id <por_id> could not be found.

# openstack subnet list
+--------------------------------------+----------+--------------------------------------+-----------------+
| ID | Name | Network | Subnet |
+--------------------------------------+----------+--------------------------------------+-----------------+
| e07e105a-5974-47b3-8d9b-eed0a412b10e | provider | d37de52b-c756-402e-8bbd-6eefce92ef60 | 172.16.103.0/24 |
+--------------------------------------+----------+--------------------------------------+-----------------+
# cat subnet_implicit.yaml
heat_template_version: ocata

resources:

  my_instance:
    type: OS::Nova::Server
    properties:
      name: my_server
      image: cirros
      flavor: m1.small
      networks:
        - subnet: provider
# openstack stack create -t subnet_implicit.yaml stack
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | b439d612-5411-4e86-bc2b-5071d5c1dc6a |
| stack_name | stack |
| description | No description |
| creation_time | 2017-07-04T09:35:38Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+--------------------------------------+

# openstack port list
+--------------------------------------+--------------------+-------------------+-----------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+--------------------+-------------------+-----------------------------------------+--------+
| 06d13f70-fbec-4f9b-9754-628c92251e43 | | fa:16:3e:89:91:ca | ip_address='172.16.103.10', | ACTIVE |
| | | | subnet_id='e07e105a-5974-47b3-8d9b- | |
| | | | eed0a412b10e' | |
| 2fba0b47-7324-4f64-87b6-61e85d43cccc | my_instance-port-0 | fa:16:3e:64:cb:0f | ip_address='172.16.103.19', | ACTIVE |
| | | | subnet_id='e07e105a-5974-47b3-8d9b- | |
| | | | eed0a412b10e' | |
+--------------------------------------+--------------------+-------------------+-----------------------------------------+--------+

# cat update_implicit_port_with_port.yaml
heat_template_version: ocata

resources:

  my_instance:
    type: OS::Nova::Server
    properties:
      image: cirros
      flavor: m1.small
      networks:
        - port: 2fba0b47-7324-4f64-87b6-61e85d43cccc

# openstack stack update -t update_implicit_port_with_port.yaml stack
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | b439d612-5411-4e86-bc2b-5071d5c1dc6a |
| stack_name | stack |
| description | No description |
| creation_time | 2017-07-04T09:35:38Z |
| updated_time | 2017-07-04T09:36:50Z |
| stack_status | UPDATE_IN_PROGRESS |
| stack_status_reason | Stack UPDATE started |
+---------------------+--------------------------------------+

# openstack stack show stack
+-----------------------+-------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-------------------------------------------------------------------------------------------------------------+
| id | b439d612-5411-4e86-bc2b-5071d5c1dc6a |
| stack_name | stack |
| description | No description |
| creation_time | 2017-07-04T09:35:38Z |
| updated_time | 2017-07-04T09:36:50Z |
| stack_status | UPDATE_FAILED |
| stack_status_reason | Resource UPDATE failed: NotFound: resources.my_instance: Port id 2fba0b47-7324-4f64-87b6-61e85d43cccc could |
| | not be found. (HTTP 404) (Request-ID: req-3321d344-ae33-4e6b-baee-d27b9ff16349) |
| parameters | OS::project_id: a946df32ae3241e3a4bd34af642c9278 |
| | OS::stack_id: b439d612-5411-4e86-bc2b-5071d5c1dc6a |
| | OS::stack_name: stack |
| | |
| outputs | [] |
| | |
| links | - href: http://192.168.122.248:8004/v1/a946df32ae3241e3a4bd34af642c9278/stacks/stack/b439d612-5411-4e86 |
| | -bc2b-5071d5c1dc6a |
| | rel: self |
| | |
| parent | None |
| disable_rollback | True |
| deletion_time | None |
| stack_user_project_id | 6fc69d8dd02043ec93a61673cbebdd13 |
| capabilities | [] |
| notification_topics | [] |
| stack_owner | None |
| timeout_mins | None |
| tags | None |
+-----------------------+-------------------------------------------------------------------------------------------------------------+

Changed in heat:
assignee: nobody → Harald Jensås (harald-jensas)
status: New → In Progress
Revision history for this message
Harald Jensås (harald-jensas) wrote :
Rico Lin (rico-lin)
Changed in heat:
importance: Undecided → Medium
milestone: none → pike-3
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-3 → pike-rc1
Rabi Mishra (rabi)
Changed in heat:
milestone: pike-rc1 → pike-rc2
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-rc2 → queens-1
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-1 → queens-2
Changed in heat:
assignee: Harald Jensås (harald-jensas) → nobody
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-2 → queens-3
Changed in heat:
assignee: nobody → Harald Jensås (harald-jensas)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/529610

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

Reviewed: https://review.openstack.org/529609
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=07b9b1a033b73b110baeb1f7f86c9d2fc8487085
Submitter: Zuul
Branch: master

commit 07b9b1a033b73b110baeb1f7f86c9d2fc8487085
Author: Harald Jensas <email address hidden>
Date: Thu Dec 21 11:58:42 2017 +0100

    Re-factor and improve update_networks_matching_iface_port

    * Implement _find_best_match() using subset intersection.
    * Reduce number of expensive external neutron calls to get net_id by
      moving this outside the inner loop.

    Unit test updated, we now do a better job at matching and populate more
    data when updating.

    Partial-Bug: #1696483
    Partial-Bug: #1702279
    Change-Id: I2157d35e1c58f3960d5b6aa86199d93bb5b88401

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

Reviewed: https://review.openstack.org/529610
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=8b71c583ad13e5c05ec453fca49b66880ecbafde
Submitter: Zuul
Branch: master

commit 8b71c583ad13e5c05ec453fca49b66880ecbafde
Author: Harald Jensas <email address hidden>
Date: Thu Dec 21 13:58:36 2017 +0100

    Match on subnet update_networks_matching_iface_port

    * Add subnet to interface managed keys when updating nets matching
      interface port
    * Add tests to verify that matching on "poor" nets with only
      subnet works.

    Change-Id: I3c2a251088fafef78c69aa4a758137907f414a60
    Related-Bug: #1696483
    Related-Bug: #1702279

Rico Lin (rico-lin)
Changed in heat:
milestone: queens-3 → queens-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/471969
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=f4a9e9c1b07ec8adcb9085890bd3e7b576819fa4
Submitter: Zuul
Branch: master

commit f4a9e9c1b07ec8adcb9085890bd3e7b576819fa4
Author: Harald Jensas <email address hidden>
Date: Thu Jun 8 00:02:41 2017 +0200

    Exclude updated networks - match actual interface state

    Use update_networks_matching_iface_port() to populate old_nets
    with implicit values from interfaces before matching new_nets
    properties. The network is not updated if added properties match
    what is currently on the interface.

    Without this chanage a stack created with...

        networks:
          - network: net0

    ... then updated with...

        networks:
          - network: net0
            subnet: subnet0

    ... would result in a port replace, which is not necessary if the
    implicit subnet used when the stack was initially created was also
    'subnet0'. The port being replaced will result in neutron re-running
    ipam and the ip_address associated would change.

    Closes-Bug: #1696483
    Closes-Bug: #1702279
    Depends-On: Ic4bbbcc3cee329a4de8f0eac710128175c4fc397
    Change-Id: Iab75ec49b962617943017dcaf1b04b89f91a982e
    Implements: blueprint tripleo-routed-networks-deployment

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 10.0.0.0rc1

This issue was fixed in the openstack/heat 10.0.0.0rc1 release candidate.

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.