Skip to content

Commit 15439ac

Browse files
authored
Merge pull request #29 from stackhpc/upstream/yoga-2023-03-01
Synchronise yoga with upstream
2 parents 3289eb3 + 2642588 commit 15439ac

File tree

6 files changed

+36
-9
lines changed

6 files changed

+36
-9
lines changed

neutron/cmd/ovn/neutron_ovn_db_sync_util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ def main():
203203
'port_forwarding',
204204
'qos'
205205
]
206+
extension_drivers = list(set(cfg.CONF.ml2.extension_drivers + ['qos']))
207+
cfg.CONF.set_override('extension_drivers', extension_drivers, 'ml2')
208+
206209
else:
207210
LOG.error('Invalid core plugin : ["%s"].', cfg.CONF.core_plugin)
208211
return

neutron/plugins/ml2/drivers/ovn/agent/neutron_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def as_dict(self):
8181
return {
8282
'binary': self.binary,
8383
'host': self.chassis.hostname,
84-
'heartbeat_timestamp': self.updated_at,
84+
'heartbeat_timestamp': timeutils.normalize_time(
85+
self.updated_at.replace(microsecond=0)),
8586
'availability_zone': ', '.join(
8687
ovn_utils.get_chassis_availability_zones(self.chassis)),
8788
'topic': 'n/a',

neutron/tests/functional/agent/test_dhcp_agent.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import eventlet
2121
import fixtures
2222
import netaddr
23+
from neutron_lib.api import converters
2324
from neutron_lib import constants as lib_const
2425
from oslo_config import fixture as fixture_config
2526
from oslo_utils import uuidutils
@@ -42,10 +43,10 @@
4243

4344
class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
4445

45-
_DHCP_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:4c")
46-
_DHCP_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
47-
_TENANT_PORT_MAC_ADDRESS = netaddr.EUI("24:77:03:7d:00:3a")
48-
_TENANT_PORT_MAC_ADDRESS.dialect = netaddr.mac_unix
46+
_DHCP_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
47+
'24:77:03:7d:00:4c')
48+
_TENANT_PORT_MAC_ADDRESS = converters.convert_to_sanitized_mac_address(
49+
'24:77:03:7d:00:3a')
4950

5051
_IP_ADDRS = {
5152
4: {'addr': '192.168.10.11',
@@ -307,9 +308,8 @@ def test_bad_address_allocation(self):
307308
network, port = self._get_network_port_for_allocation_test()
308309
network.ports.append(port)
309310
self.configure_dhcp_for_network(network=network)
310-
bad_mac_address = netaddr.EUI(self._TENANT_PORT_MAC_ADDRESS.value + 1)
311-
bad_mac_address.dialect = netaddr.mac_unix
312-
port.mac_address = str(bad_mac_address)
311+
port.mac_address = converters.convert_to_sanitized_mac_address(
312+
'24:77:03:7d:00:4d')
313313
self._plug_port_for_dhcp_request(network, port)
314314
self.assert_bad_allocation_for_port(network, port)
315315

neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ def test_agent_show_real_heartbeat_timestamp(self):
11481148
'Chassis_Private', self.chassis, 'nb_cfg_timestamp'
11491149
).execute(check_error=True)
11501150
updated_at = datetime.datetime.fromtimestamp(
1151-
int(chassis_ts / 1000), datetime.timezone.utc)
1151+
int(chassis_ts / 1000))
11521152
# if table Chassis_Private present, agent.updated_at is
11531153
# Chassis_Private.nb_cfg_timestamp
11541154
self.assertEqual(updated_at, heartbeat_timestamp)

neutron/tests/unit/plugins/ml2/drivers/ovn/agent/test_neutron_agent.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
1414

15+
import datetime
1516
from unittest import mock
1617

1718
import eventlet
@@ -67,3 +68,19 @@ def test_agents_by_chassis_private(self):
6768
agents = list(agents)
6869
self.assertEqual(1, len(agents))
6970
self.assertEqual('chassis5', agents[0].agent_id)
71+
72+
@mock.patch.object(neutron_agent.ControllerAgent, 'alive')
73+
def test_heartbeat_timestamp_format(self, agent_alive):
74+
chassis_private = fakes.FakeOvsdbRow.create_one_ovsdb_row(
75+
attrs={'name': 'chassis5'})
76+
agents = self.agent_cache.agents_by_chassis_private(chassis_private)
77+
agent = list(agents)[0]
78+
agent.chassis.hostname = 'fake-hostname'
79+
agent.updated_at = datetime.datetime(
80+
year=2023, month=2, day=23, hour=1, minute=2, second=3,
81+
microsecond=456789).replace(tzinfo=datetime.timezone.utc)
82+
agent_alive.return_value = True
83+
84+
# Verify that both microseconds and timezone are dropped
85+
self.assertEqual(str(agent.as_dict()['heartbeat_timestamp']),
86+
'2023-02-23 01:02:03')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Normalise OVN agent heartbeat timestamp format to match other agent types.
5+
This fixes parsing of ``GET /v2.0/agents`` for some clients, such as
6+
gophercloud.

0 commit comments

Comments
 (0)