Skip to content

Commit 824dbc6

Browse files
committed
Add ovn-monitor-all configuration option to ovn-controller
This commit adds the option 'ovn-monitor-all' to the OVN charm, allowing the operator to enable or disable monitoring of all records in the OVN_Southbound database by the ovn-controller. - Updated config.yaml to include 'ovn-monitor-all' (default: false) - Updated lib/charms/ovn_charm.py to handle the option in configure_bridges() - Added unit tests Closes-Bug: 2138758
1 parent ca7f446 commit 824dbc6

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,11 @@ options:
371371
372372
If you are upgrading across LTS boundaries you may need to use version
373373
pinning to avoid data plane outage during the upgrade.
374+
ovn-monitor-all:
375+
type: boolean
376+
default: false
377+
description: |
378+
A boolean value that tells if ovn-controller should monitor all records
379+
of tables in the OVN_Southbound. If this option is set to false,
380+
ovn-controller will conditionally monitor only the records that are
381+
needed for the local chassis.

lib/charms/ovn_charm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,11 @@ def configure_bridges(self):
13441344
else:
13451345
opvs.remove('.', 'external_ids', 'ovn-cms-options')
13461346

1347+
if self.options.ovn_monitor_all:
1348+
opvs.set('.', 'external_ids:ovn-monitor-all', 'true')
1349+
else:
1350+
opvs.remove('.', 'external_ids', 'ovn-monitor-all')
1351+
13471352
def _get_ovn_cms_options(self):
13481353
"""Get options to be passed into ovn-cms-options"""
13491354
cms_opts = []

unit_tests/test_lib_charms_ovn_charm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ def _fake_config(x=None):
498498
'enable-dpdk': False,
499499
'bridge-interface-mappings': 'br-ex:eth0',
500500
'prefer-chassis-as-gw': False,
501+
'ovn-monitor-all': False,
501502
'vpd-device-spec':
502503
'[{"bus": "pci", "vendor_id": "beef", "device_id": "cafe"}]',
503504
}
@@ -580,6 +581,7 @@ def setUp(self):
580581
'ovn-bridge-mappings': (
581582
'provider:br-ex other:br-data'),
582583
'prefer-chassis-as-gw': False,
584+
'ovn-monitor-all': False,
583585
'dpdk-runtime-libraries': '',
584586
'vpd-device-spec': '',
585587
'ovn-source': 'distro',
@@ -766,6 +768,7 @@ def setUp(self):
766768
'ovn-bridge-mappings': (
767769
'provider:br-ex other:br-data'),
768770
'prefer-chassis-as-gw': False,
771+
'ovn-monitor-all': False,
769772
'dpdk-runtime-libraries': '',
770773
'vpd-device-spec': '',
771774
'pmd-cpu-set': '',
@@ -1099,6 +1102,7 @@ def setUp(self):
10991102
'ovn-bridge-mappings': (
11001103
'provider:br-provider other:br-other'),
11011104
'prefer-chassis-as-gw': True,
1105+
'ovn-monitor-all': True,
11021106
'vpd-device-spec':
11031107
'[{"bus": "pci", "vendor_id": "beef", "device_id": "cafe"}]',
11041108
'ovn-source': 'distro',
@@ -1440,7 +1444,9 @@ def test_configure_bridges(self):
14401444
mock.call('.', 'external_ids:ovn-bridge-mappings',
14411445
'other:br-other,provider:br-provider'),
14421446
mock.call('.', 'external_ids:ovn-cms-options',
1443-
'enable-chassis-as-gw,card-serial-number=c4rd-53r14l'),
1447+
'enable-chassis-as-gw,card-serial-number=c4rd-53r14l,'),
1448+
mock.call('.', 'external_ids',
1449+
'ovn-monitor-all=true'),
14441450
], any_order=True)
14451451

14461452
def test_wrong_configure_bridges(self):

0 commit comments

Comments
 (0)