Skip to content

Commit 7d6ef1f

Browse files
committed
Revert "Added fabric_type field in journal database"
Using UFM is not in the POR at the moment, so we revert it for now. This reverts commit 6b5eae7. Change-Id: Idcfc4d07f2a73b556ebfdedd0d083e7bbc5e5682
1 parent ce293ab commit 7d6ef1f

File tree

9 files changed

+10
-142
lines changed

9 files changed

+10
-142
lines changed

networking_mlnx/db/db.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ def get_all_db_rows_by_state(session, state):
7878
# might both succeed in changing the same row to pending, but at least one
7979
# of them will get a deadlock from Galera and will have to retry the operation.
8080
@db_api.retry_db_errors
81-
def get_oldest_pending_db_row_with_lock(session,
82-
fabric_type=sdn_const.FABRIC_ETH):
81+
def get_oldest_pending_db_row_with_lock(session):
8382
with session.begin():
8483
row = session.query(sdn_journal_db.SdnJournal).filter_by(
85-
state=sdn_const.PENDING, fabric_type=fabric_type).order_by(
84+
state=sdn_const.PENDING).order_by(
8685
asc(sdn_journal_db.SdnJournal.last_retried)).with_for_update(
8786
).first()
8887
if row:
@@ -136,14 +135,13 @@ def delete_row(session, row=None, row_id=None):
136135

137136
@oslo_db_api.wrap_db_retry(max_retries=db_api.MAX_RETRIES)
138137
def create_pending_row(session, object_type, object_uuid,
139-
operation, data, fabric_type=sdn_const.FABRIC_ETH):
138+
operation, data):
140139
data = jsonutils.dumps(data)
141140
row = sdn_journal_db.SdnJournal(object_type=object_type,
142141
object_uuid=object_uuid,
143142
operation=operation, data=data,
144143
created_at=func.now(),
145-
state=sdn_const.PENDING,
146-
fabric_type=fabric_type)
144+
state=sdn_const.PENDING)
147145
session.add(row)
148146
# Keep session flush for unit tests. NOOP for L2/L3 events since calls are
149147
# made inside database session transaction with subtransactions=True.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
25233f351591
1+
5d5e04ea01d5

networking_mlnx/db/migration/alembic_migrations/versions/ussuri/expand/25233f351591_add_fabric_type.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

networking_mlnx/db/models/sdn_journal_db.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ class SdnJournal(model_base.BASEV2, model_base.HasId):
3535
created_at = sa.Column(sa.DateTime, server_default=sa.func.now())
3636
last_retried = sa.Column(sa.TIMESTAMP, server_default=sa.func.now(),
3737
onupdate=sa.func.now())
38-
fabric_type = sa.Column(sa.Enum(sdn_const.FABRIC_ETH, sdn_const.FABRIC_IB),
39-
nullable=False, default=sdn_const.FABRIC_ETH)

networking_mlnx/journal/journal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def new_func(obj, *args, **kwargs):
4242

4343

4444
def record(db_session, object_type, object_uuid, operation, data,
45-
context=None, fabric_type=sdn_const.FABRIC_ETH):
45+
context=None):
4646
db.create_pending_row(db_session, object_type, object_uuid, operation,
47-
data, fabric_type)
47+
data)
4848

4949

5050
class SdnJournalThread(object):

networking_mlnx/plugins/ml2/drivers/sdn/constants.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,3 @@
3838

3939
# Constants for physical_networks option
4040
ANY = '*'
41-
42-
# fabric types
43-
FABRIC_ETH = 'ETH'
44-
FABRIC_IB = 'IB'

networking_mlnx/plugins/ml2/drivers/sdn/sdn_mech_driver.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from neutron.objects.qos import policy as policy_object
1919
from neutron_lib.api.definitions import extra_dhcp_opt as edo_ext
2020
from neutron_lib.api.definitions import portbindings
21-
from neutron_lib.api.definitions import provider_net
2221
from neutron_lib import constants as neutron_const
2322
from neutron_lib.db import api as db_api
2423
from neutron_lib.plugins.ml2 import api
@@ -163,13 +162,8 @@ def _record_in_journal(context, object_type, operation, data=None):
163162
SDNMechanismDriver._replace_port_dhcp_opt_name(
164163
data, edo_ext.DHCP_OPT_CLIENT_ID_NUM,
165164
edo_ext.DHCP_OPT_CLIENT_ID)
166-
fabric_type = (SDNMechanismDriver.
167-
_get_fabric_type(context.network.current))
168-
else:
169-
fabric_type = SDNMechanismDriver._get_fabric_type(context.current)
170165
journal.record(context._plugin_context.session, object_type,
171-
context.current['id'], operation, data,
172-
fabric_type=fabric_type)
166+
context.current['id'], operation, data)
173167

174168
@context_validator(sdn_const.NETWORK)
175169
@error_handler
@@ -427,25 +421,3 @@ def check_segments(self, segments):
427421
def _get_network_qos_policy(self, context, net_id):
428422
return policy_object.QosPolicy.get_network_policy(
429423
context._plugin_context, net_id)
430-
431-
@staticmethod
432-
def _get_network_physnet(network_context):
433-
if (provider_net.PHYSICAL_NETWORK in network_context and
434-
network_context[provider_net.PHYSICAL_NETWORK]):
435-
return network_context[provider_net.PHYSICAL_NETWORK]
436-
437-
@staticmethod
438-
def _get_ib_physnets():
439-
"""Returns a list of InfiniBand physnets which is represented by
440-
the configuration option `bind_normal_ports_physnets`.
441-
442-
:return: list of InfiniBand physnets
443-
"""
444-
return cfg.CONF.sdn.bind_normal_ports_physnets
445-
446-
@staticmethod
447-
def _get_fabric_type(network_context):
448-
physnet = SDNMechanismDriver._get_network_physnet(network_context)
449-
if physnet in SDNMechanismDriver._get_ib_physnets():
450-
return sdn_const.FABRIC_IB
451-
return sdn_const.FABRIC_ETH

networking_mlnx/tests/unit/db/test_db.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ def test_get_oldest_pending_row_none_when_no_rows(self):
113113
row = db.get_oldest_pending_db_row_with_lock(self.db_session)
114114
self.assertIsNone(row)
115115

116-
def test_get_oldest_pending_row_none_when_rows_are_eth(self):
117-
db.create_pending_row(self.db_session, *self.UPDATE_ROW,
118-
fabric_type=sdn_const.FABRIC_ETH)
119-
row = db.get_oldest_pending_db_row_with_lock(
120-
self.db_session, fabric_type=sdn_const.FABRIC_IB)
121-
self.assertIsNone(row)
122-
123116
def _test_get_oldest_pending_row_none(self, state):
124117
db.create_pending_row(self.db_session, *self.UPDATE_ROW)
125118
row = db.get_all_db_rows(self.db_session)[0]
@@ -157,17 +150,6 @@ def test_get_oldest_pending_row_order(self):
157150
row = db.get_oldest_pending_db_row_with_lock(self.db_session)
158151
self.assertEqual(older_row, row)
159152

160-
def test_get_oldest_pending_row_fabric_default(self):
161-
db.create_pending_row(self.db_session, *self.UPDATE_ROW)
162-
row = db.get_all_db_rows(self.db_session)[0]
163-
self.assertEqual(sdn_const.FABRIC_ETH, row.fabric_type)
164-
165-
def test_get_oldest_pending_row_fabric_ib(self):
166-
args = self.UPDATE_ROW + [sdn_const.FABRIC_IB]
167-
db.create_pending_row(self.db_session, *args)
168-
row = db.get_all_db_rows(self.db_session)[0]
169-
self.assertEqual(sdn_const.FABRIC_IB, row.fabric_type)
170-
171153
def test_get_all_monitoring_db_row_by_oldest_order(self):
172154
db.create_pending_row(self.db_session, *self.UPDATE_ROW)
173155
db.create_pending_row(self.db_session, *self.UPDATE_ROW)

networking_mlnx/tests/unit/ml2/drivers/sdn/test_mechanism_sdn.py

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,10 @@ def _get_mock_port_operation_context(self):
203203
'network_id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
204204
'network_qos_policy': None}
205205

206-
current_network = {'provider:segmentation_id': SEG_ID,
207-
'id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
208-
'name': 'net1',
209-
'provider:network_type': 'vlan',
210-
'provider:physical_network': 'default',
211-
'network_qos_policy': None}
212-
213206
# The port context should have NetwrokContext object that contain
214207
# the segments list
215208
network_context = type('NetworkContext', (object,),
216-
{"network_segments": self._get_segments_list(),
217-
'current': current_network})
209+
{"network_segments": self._get_segments_list()})
218210

219211
context = mock.Mock(current=current, _port=current,
220212
original=original,
@@ -235,19 +227,10 @@ def _get_mock_bind_operation_context(self):
235227
'device_owner': DEVICE_OWNER_COMPUTE,
236228
'network_id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
237229
'network_qos_policy': None}
238-
239-
current_network = {'provider:segmentation_id': SEG_ID,
240-
'id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
241-
'name': 'net1',
242-
'provider:network_type': 'vlan',
243-
'provider:physical_network': 'default',
244-
'network_qos_policy': None}
245-
246230
# The port context should have NetwrokContext object that contain
247231
# the segments list
248232
network_context = type('NetworkContext', (object,),
249-
{"network_segments": self._get_segments_list(),
250-
'current': current_network})
233+
{"network_segments": self._get_segments_list()})
251234
context = mock.Mock(current=current, _port=current,
252235
segments_to_bind=self._get_segments_list(),
253236
network=network_context)
@@ -620,28 +603,3 @@ def _test_filtered_object_type(self, object_type):
620603
self._call_operation_object(operation, object_type)
621604
rows = db.get_all_db_rows(self.db_session)
622605
self.assertEqual(0, len(rows))
623-
624-
def test_get_fabric_type_default(self):
625-
network_context = {'provider:segmentation_id': SEG_ID,
626-
'id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
627-
'name': 'net1',
628-
'provider:network_type': 'vlan',
629-
'provider:physical_network': 'default',
630-
'network_qos_policy': None}
631-
self.mech = sdn_mech_driver.SDNMechanismDriver()
632-
self.assertEqual(sdn_const.FABRIC_ETH,
633-
self.mech._get_fabric_type(network_context))
634-
635-
def test_get_fabric_type_ib(self):
636-
self.conf.set_override(
637-
'bind_normal_ports_physnets', ['ibnet'], sdn_const.GROUP_OPT)
638-
639-
network_context = {'provider:segmentation_id': SEG_ID,
640-
'id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
641-
'name': 'net1',
642-
'provider:network_type': 'vlan',
643-
'provider:physical_network': 'ibnet',
644-
'network_qos_policy': None}
645-
self.mech = sdn_mech_driver.SDNMechanismDriver()
646-
self.assertEqual(sdn_const.FABRIC_IB,
647-
self.mech._get_fabric_type(network_context))

0 commit comments

Comments
 (0)