Skip to content

Commit 3ec5629

Browse files
authored
Merge pull request #237 from stackhpc/upstream/2025.1-2025-11-03
Synchronise 2025.1 with upstream
2 parents deac3ce + 512758b commit 3ec5629

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

neutron/conf/plugins/ml2/drivers/ovn/ovn_conf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@
171171
"automatically set on each subnet upon creation and "
172172
"on all existing subnets when Neutron starts.\n"
173173
"An empty value for a DHCP option will cause that "
174-
"option to be unset globally.\n"
174+
"option to be unset globally. Multiple values should "
175+
"be separated by semi-colon.\n"
175176
"EXAMPLES:\n"
176-
"- ntp_server:1.2.3.4,wpad:1.2.3.5 - Set ntp_server "
177-
"and wpad\n"
177+
"- ntp_server:1.2.3.4,wpad:1.2.3.5;1.2.3.6 - Set "
178+
"ntp_server and wpad\n"
178179
"- ntp_server:,wpad:1.2.3.5 - Unset ntp_server and "
179180
"set wpad\n"
180181
"See the ovn-nb(5) man page for available options.")),
@@ -184,7 +185,8 @@
184185
"automatically set on each subnet upon creation and "
185186
"on all existing subnets when Neutron starts.\n"
186187
"An empty value for a DHCPv6 option will cause that "
187-
"option to be unset globally.\n"
188+
"option to be unset globally. Multiple values should "
189+
"be separated by semi-colon.\n"
188190
"See the ovn-nb(5) man page for available options.")),
189191
cfg.BoolOpt('ovn_emit_need_to_frag',
190192
default=True,

neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,12 @@ def _process_global_dhcp_opts(self, options, ip_version):
23482348
# If the value is null (i.e. config ntp_server:), treat it as
23492349
# a request to remove the option
23502350
if value:
2351-
options[option] = value
2351+
# Example: ntp_server='{1.2.3.4, 1.2.3.5}'. A single value is
2352+
# also allowed but in shake of readability, it is printed as a
2353+
# single string.
2354+
_value = value.split(';')
2355+
options[option] = (_value[0] if len(_value) == 1 else
2356+
'{%s}' % ', '.join(_value))
23522357
else:
23532358
try:
23542359
del options[option]

neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,16 @@ def _check_bw(port_id, max_kbps=None, max_burst_kbps=None,
452452
port_data['id'])
453453
req.get_response(self.api)
454454
_check_bw(port_data['id'], max_kbps, max_burst_kbps, min_kbps)
455+
456+
def test_create_subnet_with_dhcp_options(self):
457+
cfg.CONF.set_override('ovn_dhcp4_global_options',
458+
'ntp_server:1.2.3.4;1.2.3.5,wpad:1.2.3.6',
459+
group='ovn')
460+
with self.network('test-ovn-client') as net:
461+
with self.subnet(net):
462+
dhcp_options = self.nb_api.dhcp_options_list().execute(
463+
check_error=True)[0]
464+
self.assertEqual('{1.2.3.4, 1.2.3.5}',
465+
dhcp_options.options['ntp_server'])
466+
self.assertEqual('1.2.3.6',
467+
dhcp_options.options['wpad'])

0 commit comments

Comments
 (0)