Skip to content

Commit 154dfd7

Browse files
authored
Merge pull request #172 from stackhpc/upstream/zed-2024-08-19
Synchronise zed with upstream
2 parents 738ec69 + aa68e69 commit 154dfd7

File tree

9 files changed

+173
-27
lines changed

9 files changed

+173
-27
lines changed

neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,39 @@ def network_update(self, context, **kwargs):
112112
def binding_activate(self, context, **kwargs):
113113
if kwargs.get('host') != self.agent.conf.host:
114114
return
115-
LOG.debug("binding activate for port %s", kwargs.get('port_id'))
116-
device_details = self.agent.get_device_details_from_port_id(
117-
kwargs.get('port_id'))
118-
mac = device_details.get('mac_address')
119-
binding_profile = device_details.get('profile')
120-
if binding_profile:
121-
pci_slot = binding_profile.get('pci_slot')
122-
self.agent.activated_bindings.add((mac, pci_slot))
115+
116+
port_id = kwargs.get('port_id')
117+
118+
def _is_port_id_in_network(network_port, port_id):
119+
for network_id, ports in network_port.items():
120+
for port in ports:
121+
if port['port_id'] == port_id:
122+
return True
123+
return False
124+
125+
is_port_id_sriov = _is_port_id_in_network(
126+
self.agent.network_ports, port_id
127+
)
128+
129+
if is_port_id_sriov:
130+
LOG.debug("binding activate for port %s", port_id)
131+
device_details = self.agent.get_device_details_from_port_id(
132+
port_id)
133+
mac = device_details.get('mac_address')
134+
binding_profile = device_details.get('profile')
135+
if binding_profile:
136+
pci_slot = binding_profile.get('pci_slot')
137+
self.agent.activated_bindings.add((mac, pci_slot))
138+
else:
139+
LOG.warning(
140+
"binding_profile not found for port %s.",
141+
port_id
142+
)
123143
else:
124-
LOG.warning("binding_profile not found for port %s.",
125-
kwargs.get('port_id'))
144+
LOG.warning(
145+
"This port is not SRIOV, skip binding for port %s.",
146+
port_id
147+
)
126148

127149
def binding_deactivate(self, context, **kwargs):
128150
if kwargs.get('host') != self.agent.conf.host:

neutron/tests/functional/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,12 @@ def stop(self):
407407
if self.maintenance_worker:
408408
self.mech_driver.nb_synchronizer.stop()
409409
self.mech_driver.sb_synchronizer.stop()
410-
self.mech_driver.nb_ovn.ovsdb_connection.stop()
411-
self.mech_driver.sb_ovn.ovsdb_connection.stop()
410+
for ovn_conn in (self.mech_driver.nb_ovn.ovsdb_connection,
411+
self.mech_driver.sb_ovn.ovsdb_connection):
412+
try:
413+
ovn_conn.stop(timeout=10)
414+
except Exception: # pylint:disable=bare-except
415+
pass
412416

413417
def restart(self):
414418
self.stop()

neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py

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

16+
import collections
1617
import copy
1718
from unittest import mock
1819

@@ -460,6 +461,7 @@ def __init__(self):
460461
self.activated_bindings = set()
461462
self.conf = mock.Mock()
462463
self.conf.host = 'host1'
464+
self.network_ports = collections.defaultdict(list)
463465

464466

465467
class TestSriovNicSwitchRpcCallbacks(base.BaseTestCase):
@@ -528,6 +530,12 @@ def test_binding_activate(self):
528530
}
529531
kwargs = self._create_fake_bindings(fake_port, self.agent.conf.host)
530532
kwargs['context'] = self.context
533+
534+
self.agent.network_ports['network_id'].append({
535+
'port_id': fake_port['id'],
536+
'device': 'fake_device'
537+
})
538+
531539
self.sriov_rpc_callback.binding_activate(**kwargs)
532540
# Assert agent.activated_binding set contains the new binding
533541
self.assertIn((fake_port['mac_address'],
@@ -538,10 +546,32 @@ def test_binding_activate_no_host(self):
538546
fake_port = self._create_fake_port()
539547
kwargs = self._create_fake_bindings(fake_port, 'other-host')
540548
kwargs['context'] = self.context
549+
550+
self.agent.network_ports[self.agent.conf.host].append({
551+
'port_id': fake_port['id'],
552+
'device': 'fake_device'
553+
})
554+
541555
self.sriov_rpc_callback.binding_activate(**kwargs)
542556
# Assert no bindings were added
543557
self.assertEqual(set(), self.agent.activated_bindings)
544558

559+
def test_binding_activate_port_not_in_network(self):
560+
fake_port = self._create_fake_port()
561+
kwargs = self._create_fake_bindings(fake_port, self.agent.conf.host)
562+
kwargs['context'] = self.context
563+
564+
self.agent.network_ports['network_id'] = []
565+
566+
with mock.patch.object(sriov_nic_agent.LOG,
567+
'warning') as mock_warning:
568+
self.sriov_rpc_callback.binding_activate(**kwargs)
569+
# Check that the warning message was logged
570+
expected_msg = (
571+
"This port is not SRIOV, skip binding for port %s."
572+
)
573+
mock_warning.assert_called_once_with(expected_msg, fake_port['id'])
574+
545575
def test_binding_deactivate(self):
546576
# binding_deactivate() basically does nothing
547577
# call it with both the agent's host and other host to cover

zuul.d/base.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
- ^roles/add_mariadb_repo/.*$
3333
- ^roles/nftables/.*$
3434
- ^rally-jobs/.*$
35-
- ^zuul.d/(?!(project)).*\.yaml
35+
# Ignore everything except for zuul.d/project.yaml
36+
- ^zuul.d/base.yaml
37+
- ^zuul.d/grenade.yaml
38+
- ^zuul.d/job-templates.yaml
39+
- ^zuul.d/rally.yaml
40+
- ^zuul.d/tempest-multinode.yaml
41+
- ^zuul.d/tempest-singlenode.yaml
3642
vars:
3743
configure_swap_size: 8192
3844
Q_BUILD_OVS_FROM_GIT: True
@@ -96,7 +102,13 @@
96102
- ^roles/add_mariadb_repo/.*$
97103
- ^roles/nftables/.*$
98104
- ^rally-jobs/.*$
99-
- ^zuul.d/(?!(project)).*\.yaml
105+
# Ignore everything except for zuul.d/project.yaml
106+
- ^zuul.d/base.yaml
107+
- ^zuul.d/grenade.yaml
108+
- ^zuul.d/job-templates.yaml
109+
- ^zuul.d/rally.yaml
110+
- ^zuul.d/tempest-multinode.yaml
111+
- ^zuul.d/tempest-singlenode.yaml
100112

101113
- job:
102114
name: neutron-fullstack-with-uwsgi

zuul.d/grenade.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
- ^roles/.*functional.*$
3434
- ^playbooks/.*functional.*$
3535
- ^vagrant/.*$
36-
- ^zuul.d/(?!(project)).*\.yaml
36+
# Ignore everything except for zuul.d/project.yaml
37+
- ^zuul.d/base.yaml
38+
- ^zuul.d/grenade.yaml
39+
- ^zuul.d/job-templates.yaml
40+
- ^zuul.d/rally.yaml
41+
- ^zuul.d/tempest-multinode.yaml
42+
- ^zuul.d/tempest-singlenode.yaml
3743
vars:
3844
devstack_services:
3945
etcd: false
@@ -200,7 +206,13 @@
200206
- ^roles/.*functional.*$
201207
- ^playbooks/.*functional.*$
202208
- ^vagrant/.*$
203-
- ^zuul.d/(?!(project)).*\.yaml
209+
# Ignore everything except for zuul.d/project.yaml
210+
- ^zuul.d/base.yaml
211+
- ^zuul.d/grenade.yaml
212+
- ^zuul.d/job-templates.yaml
213+
- ^zuul.d/rally.yaml
214+
- ^zuul.d/tempest-multinode.yaml
215+
- ^zuul.d/tempest-singlenode.yaml
204216
roles:
205217
- zuul: openstack/neutron-tempest-plugin
206218
required-projects:

zuul.d/job-templates.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
- ^playbooks/.*$
2020
- ^roles/.*$
2121
- ^rally-jobs/.*$
22-
- ^zuul.d/(?!(job-templates)).*\.yaml
22+
# Ignore everything except for zuul.d/job-templates.yaml
23+
- ^zuul.d/base.yaml
24+
- ^zuul.d/grenade.yaml
25+
- ^zuul.d/project.yaml
26+
- ^zuul.d/rally.yaml
27+
- ^zuul.d/tempest-multinode.yaml
28+
- ^zuul.d/tempest-singlenode.yaml
2329
- openstack-tox-py39: # from openstack-python3-zed-jobs template
2430
timeout: 3600
2531
irrelevant-files: *irrelevant-files
@@ -108,7 +114,13 @@
108114
- ^neutron/scheduler/.*$
109115
- ^roles/.*functional.*$
110116
- ^playbooks/.*functional.*$
111-
- ^zuul.d/(?!(project)).*\.yaml
117+
# Ignore everything except for zuul.d/project.yaml
118+
- ^zuul.d/base.yaml
119+
- ^zuul.d/grenade.yaml
120+
- ^zuul.d/job-templates.yaml
121+
- ^zuul.d/rally.yaml
122+
- ^zuul.d/tempest-multinode.yaml
123+
- ^zuul.d/tempest-singlenode.yaml
112124

113125
- project-template:
114126
name: neutron-periodic-jobs

zuul.d/rally.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@
8181
- ^neutron/common/ovn/.*$
8282
- ^roles/.*functional.*$
8383
- ^playbooks/.*functional.*$
84-
- ^zuul.d/(?!(project)).*\.yaml
84+
# Ignore everything except for zuul.d/project.yaml
85+
- ^zuul.d/base.yaml
86+
- ^zuul.d/grenade.yaml
87+
- ^zuul.d/job-templates.yaml
88+
- ^zuul.d/rally.yaml
89+
- ^zuul.d/tempest-multinode.yaml
90+
- ^zuul.d/tempest-singlenode.yaml
8591

8692
- job:
8793
name: neutron-ovn-rally-task
@@ -123,7 +129,13 @@
123129
- ^neutron/scheduler/.*$
124130
- ^roles/.*functional.*$
125131
- ^playbooks/.*functional.*$
126-
- ^zuul.d/(?!(project)).*\.yaml
132+
# Ignore everything except for zuul.d/project.yaml
133+
- ^zuul.d/base.yaml
134+
- ^zuul.d/grenade.yaml
135+
- ^zuul.d/job-templates.yaml
136+
- ^zuul.d/rally.yaml
137+
- ^zuul.d/tempest-multinode.yaml
138+
- ^zuul.d/tempest-singlenode.yaml
127139
vars:
128140
devstack_plugins:
129141
neutron: https://opendev.org/openstack/neutron

zuul.d/tempest-multinode.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
- ^roles/.*functional.*$
3838
- ^playbooks/.*functional.*$
3939
- ^vagrant/.*$
40-
- ^zuul.d/(?!(project)).*\.yaml
40+
# Ignore everything except for zuul.d/project.yaml
41+
- ^zuul.d/base.yaml
42+
- ^zuul.d/grenade.yaml
43+
- ^zuul.d/job-templates.yaml
44+
- ^zuul.d/rally.yaml
45+
- ^zuul.d/tempest-multinode.yaml
46+
- ^zuul.d/tempest-singlenode.yaml
4147
vars:
4248
tox_envlist: integrated-network
4349
devstack_localrc:
@@ -359,7 +365,13 @@
359365
- ^neutron/scheduler/.*$
360366
- ^roles/.*functional.*$
361367
- ^playbooks/.*functional.*$
362-
- ^zuul.d/(?!(project)).*\.yaml
368+
# Ignore everything except for zuul.d/project.yaml
369+
- ^zuul.d/base.yaml
370+
- ^zuul.d/grenade.yaml
371+
- ^zuul.d/job-templates.yaml
372+
- ^zuul.d/rally.yaml
373+
- ^zuul.d/tempest-multinode.yaml
374+
- ^zuul.d/tempest-singlenode.yaml
363375
roles:
364376
- zuul: zuul/zuul-jobs
365377
- zuul: openstack/neutron-tempest-plugin

zuul.d/tempest-singlenode.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@
8282
- ^neutron/common/ovn/.*$
8383
- ^roles/.*functional.*$
8484
- ^playbooks/.*functional.*$
85-
- ^zuul.d/(?!(project)).*\.yaml
85+
# Ignore everything except for zuul.d/project.yaml
86+
- ^zuul.d/base.yaml
87+
- ^zuul.d/grenade.yaml
88+
- ^zuul.d/job-templates.yaml
89+
- ^zuul.d/rally.yaml
90+
- ^zuul.d/tempest-multinode.yaml
91+
- ^zuul.d/tempest-singlenode.yaml
8692

8793
- job:
8894
name: neutron-ovs-tempest-dvr
@@ -143,7 +149,13 @@
143149
- ^neutron/common/ovn/.*$
144150
- ^roles/.*functional.*$
145151
- ^playbooks/.*functional.*$
146-
- ^zuul.d/(?!(project)).*\.yaml
152+
# Ignore everything except for zuul.d/project.yaml
153+
- ^zuul.d/base.yaml
154+
- ^zuul.d/grenade.yaml
155+
- ^zuul.d/job-templates.yaml
156+
- ^zuul.d/rally.yaml
157+
- ^zuul.d/tempest-multinode.yaml
158+
- ^zuul.d/tempest-singlenode.yaml
147159

148160
- job:
149161
name: neutron-ovs-tempest-iptables_hybrid
@@ -244,7 +256,13 @@
244256
- ^neutron/plugins/ml2/drivers/.*$
245257
- ^roles/.*functional.*$
246258
- ^playbooks/.*functional.*$
247-
- ^zuul.d/(?!(project)).*\.yaml
259+
# Ignore everything except for zuul.d/project.yaml
260+
- ^zuul.d/base.yaml
261+
- ^zuul.d/grenade.yaml
262+
- ^zuul.d/job-templates.yaml
263+
- ^zuul.d/rally.yaml
264+
- ^zuul.d/tempest-multinode.yaml
265+
- ^zuul.d/tempest-singlenode.yaml
248266

249267
- job:
250268
name: neutron-ovn-tempest-mariadb-full
@@ -320,7 +338,13 @@
320338
- ^vagrant/.*$
321339
- ^roles/.*functional.*$
322340
- ^playbooks/.*functional.*$
323-
- ^zuul.d/(?!(project)).*\.yaml
341+
# Ignore everything except for zuul.d/project.yaml
342+
- ^zuul.d/base.yaml
343+
- ^zuul.d/grenade.yaml
344+
- ^zuul.d/job-templates.yaml
345+
- ^zuul.d/rally.yaml
346+
- ^zuul.d/tempest-multinode.yaml
347+
- ^zuul.d/tempest-singlenode.yaml
324348

325349
- job:
326350
name: neutron-ovn-tempest-with-uwsgi-loki
@@ -448,7 +472,13 @@
448472
- ^neutron/scheduler/.*$
449473
- ^roles/.*functional.*$
450474
- ^playbooks/.*functional.*$
451-
- ^zuul.d/(?!(project)).*\.yaml
475+
# Ignore everything except for zuul.d/project.yaml
476+
- ^zuul.d/base.yaml
477+
- ^zuul.d/grenade.yaml
478+
- ^zuul.d/job-templates.yaml
479+
- ^zuul.d/rally.yaml
480+
- ^zuul.d/tempest-multinode.yaml
481+
- ^zuul.d/tempest-singlenode.yaml
452482

453483
# TODO(slaweq): move this to be multinode job when it will be possible in Zuul
454484
- job:

0 commit comments

Comments
 (0)