Browse Source

Merge "Add implementation of VIP Port Creation in OVN"

Zuul 2 months ago
parent
commit
9df67005ce
4 changed files with 24 additions and 4 deletions
  1. 1
    1
      lower-constraints.txt
  2. 21
    2
      networking_ovn/octavia/ovn_driver.py
  3. 1
    0
      requirements.txt
  4. 1
    1
      test-requirements.txt

+ 1
- 1
lower-constraints.txt View File

@@ -58,7 +58,7 @@ netaddr==0.7.18
58 58
 netifaces==0.10.4
59 59
 neutron==13.0.0.0b2
60 60
 neutron-lib==1.22.0
61
-octavia-lib==1.0.0
61
+octavia-lib==1.1.1
62 62
 openstackdocstheme==1.18.1
63 63
 openstacksdk==0.11.2
64 64
 os-client-config==1.28.0

+ 21
- 2
networking_ovn/octavia/ovn_driver.py View File

@@ -296,7 +296,8 @@ class OvnProviderHelper(object):
296 296
             self._octavia_driver_lib.update_loadbalancer_status(status)
297 297
         except driver_exceptions.UpdateStatusError as e:
298 298
             # TODO(numans): Handle the exception properly
299
-            LOG.error('Error while updating the load balancer status: %s', e)
299
+            LOG.error('Error while updating the load balancer status: %s',
300
+                      e.fault_string)
300 301
 
301 302
     def _find_ovn_lb(self, loadbalancer_id):
302 303
         find_condition = ('name', '=', loadbalancer_id)
@@ -517,7 +518,6 @@ class OvnProviderHelper(object):
517 518
                     if ip['ip_address'] == loadbalancer['vip_address']:
518 519
                         port = p
519 520
                         break
520
-
521 521
             # In case port is not found for the vip_address we will see an
522 522
             # exception when port['id'] is accessed.
523 523
             self.ovn_nbdb_api.db_create(
@@ -1238,6 +1238,15 @@ class OvnProviderHelper(object):
1238 1238
         return [(meminf.split('_')[1], meminf.split(
1239 1239
             '_')[2]) for meminf in existing_members.split(',')]
1240 1240
 
1241
+    def create_vip_port(self, project_id, lb_id, vip_d):
1242
+        port = {'port': {'name': 'ovn-lb-vip-' + str(lb_id),
1243
+                         'network_id': vip_d['vip_network_id'],
1244
+                         'fixed_ips': [{'subnet_id': vip_d['vip_subnet_id']}],
1245
+                         'admin_state_up': True,
1246
+                         'project_id': project_id}}
1247
+        network_driver = get_network_driver()
1248
+        return network_driver.neutron_client.create_port(port)
1249
+
1241 1250
 
1242 1251
 class OvnProviderDriver(driver_base.ProviderDriver):
1243 1252
     def __init__(self):
@@ -1480,3 +1489,13 @@ class OvnProviderDriver(driver_base.ProviderDriver):
1480 1489
             raise driver_exceptions.UnsupportedOptionError(
1481 1490
                 user_fault_string=msg,
1482 1491
                 operator_fault_string=msg)
1492
+
1493
+    def create_vip_port(self, lb_id, project_id, vip_dict):
1494
+        try:
1495
+            port = self._ovn_helper.create_vip_port(
1496
+                project_id, lb_id, vip_dict)['port']
1497
+            vip_dict['vip_port_id'] = port['id']
1498
+            vip_dict['vip_address'] = port['fixed_ips'][0]['ip_address']
1499
+        except Exception as e:
1500
+            raise driver_exceptions.DriverError(e)
1501
+        return vip_dict

+ 1
- 0
requirements.txt View File

@@ -15,6 +15,7 @@ tenacity>=4.4.0 # Apache-2.0
15 15
 Babel!=2.4.0,>=2.3.4 # BSD
16 16
 six>=1.10.0 # MIT
17 17
 neutron>=13.0.0.0b2 # Apache-2.0
18
+octavia-lib>=1.1.1 # Apache-2.0
18 19
 
19 20
 # The comment below indicates this project repo is current with neutron-lib
20 21
 # and should receive neutron-lib consumption patches as they are released

+ 1
- 1
test-requirements.txt View File

@@ -14,7 +14,7 @@ oslotest>=3.2.0 # Apache-2.0
14 14
 os-testr>=1.0.0 # Apache-2.0
15 15
 pylint==1.9.3;python_version=='2.7' # GPLv2
16 16
 pylint==2.3.0;python_version>='3.0' # GPLv2
17
-octavia-lib>=1.0.0
17
+octavia-lib>=1.1.1
18 18
 testresources>=2.0.0 # Apache-2.0/BSD
19 19
 testscenarios>=0.4 # Apache-2.0/BSD
20 20
 WebTest>=2.0.27 # MIT

Loading…
Cancel
Save