components/openstack/neutron/patches/10-floatingip-remove-port-on-failed-create.patch
changeset 6848 8e252a37ed0d
parent 6847 57069587975f
child 6849 f9a2279efa0d
equal deleted inserted replaced
6847:57069587975f 6848:8e252a37ed0d
     1 Patch to make call to plugin's delete_port() when floatingip creation fails
       
     2 after the plugin has created the port. These changes will eventually be
       
     3 proposed upstream.
       
     4 
       
     5 *** neutron-2015.1.2/neutron/db/l3_db.py	Tue Oct 13 10:35:16 2015
       
     6 --- new/neutron/db/l3_db.py	Wed Jul 13 23:51:38 2016
       
     7 ***************
       
     8 *** 954,963 ****
       
     9                   floating_ip_address=floating_ip_address,
       
    10                   floating_port_id=external_port['id'])
       
    11               fip['tenant_id'] = tenant_id
       
    12 !             # Update association with internal port
       
    13 !             # and define external IP address
       
    14 !             self._update_fip_assoc(context, fip,
       
    15 !                                    floatingip_db, external_port)
       
    16               context.session.add(floatingip_db)
       
    17   
       
    18           return self._make_floatingip_dict(floatingip_db)
       
    19 --- 954,969 ----
       
    20                   floating_ip_address=floating_ip_address,
       
    21                   floating_port_id=external_port['id'])
       
    22               fip['tenant_id'] = tenant_id
       
    23 !             try:
       
    24 !                 # Update association with internal port
       
    25 !                 # and define external IP address
       
    26 !                 self._update_fip_assoc(context, fip,
       
    27 !                                        floatingip_db, external_port)
       
    28 !             except:
       
    29 !                 with excutils.save_and_reraise_exception():
       
    30 !                     self._core_plugin.delete_port(context.elevated(),
       
    31 !                                                   external_port['id'],
       
    32 !                                                   l3_port_check=False)
       
    33               context.session.add(floatingip_db)
       
    34   
       
    35           return self._make_floatingip_dict(floatingip_db)