Browse Source

Fix _create_gw_port interface update

Change-Id: I62b395a37f1735f84b4720621f18ded9dadb68eb
Harkirat Singh 4 years ago
parent
commit
4a95874e49
1 changed files with 10 additions and 9 deletions
  1. 10
    9
      networking_brocade/vyatta/vrouter/neutron_plugin.py

+ 10
- 9
networking_brocade/vyatta/vrouter/neutron_plugin.py View File

@@ -448,18 +448,19 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
448 448
         ext_ip_change = self._check_for_external_ip_change(
449 449
             context, gw_port, ext_ips)
450 450
 
451
-        self._delete_current_gw_port(context, router_id, router, network_id,
452
-                                     ext_ip_change)
453
-        self._create_gw_port(context, router_id, router, network_id, ext_ips,
454
-                             ext_ip_change)
451
+        if gw_port and ext_ip_change and gw_port['network_id'] == network_id:
452
+            self._update_current_gw_port(context, router_id, router,
453
+                                         ext_ips)
454
+        else:
455
+            self._delete_current_gw_port(context, router_id, router,
456
+                                         network_id)
457
+            self._create_gw_port(context, router_id, router, network_id,
458
+                                 ext_ips)
455 459
 
456
-    def _delete_current_gw_port(self, context, router_id, router, new_network,
457
-                                ext_ip_change):
460
+    def _delete_current_gw_port(self, context, router_id, router, new_network):
458 461
         """Delete gw port if attached to an old network or IPs changed."""
459 462
         port_requires_deletion = (
460
-            router.gw_port and
461
-            (router.gw_port['network_id'] != new_network or ext_ip_change)
462
-        )
463
+            router.gw_port and router.gw_port['network_id'] != new_network)
463 464
         if not port_requires_deletion:
464 465
             return
465 466
         admin_ctx = context.elevated()

Loading…
Cancel
Save