Skip to content

Commit ebb3397

Browse files
[skip ci] Support Mitaka
1 parent a146945 commit ebb3397

4 files changed

Lines changed: 51 additions & 8 deletions

File tree

f5lbaasdriver/v2/bigip/disconnected_service.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313
# limitations under the License.
1414
#
1515

16-
from neutron.db import segments_db
1716
from neutron.plugins.ml2 import db
17+
18+
try:
19+
from neutron.db import segments_db
20+
except ImportError:
21+
# Mitaka compatibility
22+
segments_db = db
23+
1824
from neutron.plugins.ml2 import models
1925

2026
from oslo_log import log as logging
@@ -52,7 +58,12 @@ def get_network_segment(self, context, agent_configuration, network):
5258
agent_configuration.get('tunnel_types', [])
5359
]
5460
# look up segment details in the ml2_network_segments table
55-
segments = segments_db.get_network_segments(context, network['id'],
61+
if db == segments_db:
62+
# Mitaka compatibility
63+
ctx = context.session
64+
else:
65+
ctx = context
66+
segments = segments_db.get_network_segments(ctx, network['id'],
5667
filter_dynamic=None)
5768

5869
for segment in segments:
@@ -98,8 +109,13 @@ def get_segment_id(self, context, port_id, agent_hosts):
98109
for level in levels:
99110
if level.driver in ('f5networks', 'huawei_ac_ml2'):
100111
LOG.debug('level with driver f5networks')
112+
if db == segments_db:
113+
# Mitaka compatibility
114+
ctx = context.session
115+
else:
116+
ctx = context
101117
segment = segments_db.get_segment_by_id(
102-
context, level.segment_id
118+
ctx, level.segment_id
103119
)
104120
LOG.debug(
105121
'vxlan 2 vlan seg id %s: segment %s'

f5lbaasdriver/v2/bigip/driver_v2.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
from neutron.callbacks import registry
2727
from neutron.callbacks import resources
2828
from neutron.plugins.common import constants as plugin_constants
29-
from neutron_lib.api.definitions import portbindings
29+
30+
try:
31+
from neutron_lib.api.definitions import portbindings
32+
except ImportError:
33+
# Mitaka compatibility
34+
from neutron.extensions import portbindings
35+
3036
from neutron_lib import constants as q_const
3137

3238
from neutron_lbaas.db.loadbalancer import models
@@ -122,9 +128,15 @@ def __init__(self, plugin=None, env=None):
122128
self.plugin.agent_notifiers.update(
123129
{q_const.AGENT_TYPE_LOADBALANCER: self.agent_rpc})
124130

131+
try:
132+
after_init = events.AFTER_INIT
133+
except AttributeError:
134+
# Mitaka compatibility
135+
after_init = events.AFTER_CREATE
136+
125137
registry.subscribe(self._bindRegistryCallback(),
126138
resources.PROCESS,
127-
events.AFTER_INIT)
139+
after_init)
128140

129141
def _bindRegistryCallback(self):
130142
# Defines a callback function with name tied to driver env. Need to

f5lbaasdriver/v2/bigip/neutron_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
from oslo_log import helpers as log_helpers
2121
from oslo_log import log as logging
2222

23-
from neutron_lib.api.definitions import portbindings
23+
try:
24+
from neutron_lib.api.definitions import portbindings
25+
except ImportError:
26+
# Mitaka compatibility
27+
from neutron.extensions import portbindings
2428

2529
LOG = logging.getLogger(__name__)
2630

f5lbaasdriver/v2/bigip/plugin_rpc.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,25 @@
1919

2020
from neutron.common import rpc as neutron_rpc
2121
from neutron.db import agents_db
22-
from neutron.db.models import agent as agents_model
22+
23+
try:
24+
from neutron.db.models import agent as agents_model
25+
except ImportError:
26+
# Mitaka compatibility
27+
agents_model = agents_db
28+
2329
from neutron.plugins.common import constants as plugin_constants
2430

2531
from neutron_lbaas.db.loadbalancer import models
2632
from neutron_lbaas.services.loadbalancer import constants as nlb_constant
2733
from neutron_lbaas.services.loadbalancer.data_models import LoadBalancer
2834

29-
from neutron_lib.api.definitions import portbindings
35+
try:
36+
from neutron_lib.api.definitions import portbindings
37+
except ImportError:
38+
# Mitaka compatibility
39+
from neutron.extensions import portbindings
40+
3041
from neutron_lib import constants as neutron_const
3142
from neutron_lib import exceptions as q_exc
3243
from oslo_log import helpers as log_helpers

0 commit comments

Comments
 (0)