Browse Source

Merge "Use --bind-dynamic with dnsmasq instead of --bind-interfaces" into stable/queens

changes/71/673171/1
Zuul 2 months ago
parent
commit
22aaf9fa9d
2 changed files with 14 additions and 8 deletions
  1. 2
    6
      neutron/agent/linux/dhcp.py
  2. 12
    2
      neutron/tests/unit/agent/linux/test_dhcp.py

+ 2
- 6
neutron/agent/linux/dhcp.py View File

@@ -355,14 +355,10 @@ class Dnsmasq(DhcpLocalProcess):
355 355
             '--dhcp-leasefile=%s' % self.get_conf_file_name('leases'),
356 356
             '--dhcp-match=set:ipxe,175',
357 357
             '--local-service',
358
+            '--bind-dynamic',
358 359
         ]
359
-        if self.device_manager.driver.bridged:
360
+        if not self.device_manager.driver.bridged:
360 361
             cmd += [
361
-                '--bind-interfaces',
362
-            ]
363
-        else:
364
-            cmd += [
365
-                '--bind-dynamic',
366 362
                 '--bridge-interface=%s,tap*' % self.interface_name,
367 363
             ]
368 364
 

+ 12
- 2
neutron/tests/unit/agent/linux/test_dhcp.py View File

@@ -1205,7 +1205,8 @@ class TestDnsmasq(TestBase):
1205 1205
     def _test_spawn(self, extra_options, network=FakeDualNetwork(),
1206 1206
                     max_leases=16777216, lease_duration=86400,
1207 1207
                     has_static=True, no_resolv='--no-resolv',
1208
-                    has_stateless=True, dhcp_t1=0, dhcp_t2=0):
1208
+                    has_stateless=True, dhcp_t1=0, dhcp_t2=0,
1209
+                    bridged=True):
1209 1210
         def mock_get_conf_file_name(kind):
1210 1211
             return '/dhcp/%s/%s' % (network.id, kind)
1211 1212
 
@@ -1225,8 +1226,12 @@ class TestDnsmasq(TestBase):
1225 1226
             '--dhcp-leasefile=/dhcp/%s/leases' % network.id,
1226 1227
             '--dhcp-match=set:ipxe,175',
1227 1228
             '--local-service',
1228
-            '--bind-interfaces',
1229
+            '--bind-dynamic',
1229 1230
         ]
1231
+        if not bridged:
1232
+            expected += [
1233
+                '--bridge-interface=tap0,tap*'
1234
+            ]
1230 1235
 
1231 1236
         seconds = ''
1232 1237
         if lease_duration == -1:
@@ -1300,6 +1305,11 @@ class TestDnsmasq(TestBase):
1300 1305
     def test_spawn(self):
1301 1306
         self._test_spawn(['--conf-file=', '--domain=openstacklocal'])
1302 1307
 
1308
+    def test_spawn_not_bridged(self):
1309
+        self.mock_mgr.return_value.driver.bridged = False
1310
+        self._test_spawn(['--conf-file=', '--domain=openstacklocal'],
1311
+                         bridged=False)
1312
+
1303 1313
     def test_spawn_infinite_lease_duration(self):
1304 1314
         self.conf.set_override('dhcp_lease_duration', -1)
1305 1315
         self._test_spawn(['--conf-file=', '--domain=openstacklocal'],

Loading…
Cancel
Save