Browse Source

OSP-305 improve RH system recognition so that user do not need to copy os-net-config for container environment

Change-Id: I632946a09208fe3e6c47fe502c1e82aafad01ade
changes/65/785965/2 15.0.2
Weifan Fu 1 month ago
parent
commit
1e2e0e0db1
4 changed files with 9 additions and 8 deletions
  1. +0
    -1
      networking_bigswitch/plugins/bigswitch/constants.py
  2. +2
    -3
      networking_bigswitch/plugins/bigswitch/state_syncer.py
  3. +5
    -0
      networking_bigswitch/plugins/bigswitch/utils.py
  4. +2
    -4
      networking_bigswitch/plugins/ml2/drivers/mech_bigswitch/driver.py

+ 0
- 1
networking_bigswitch/plugins/bigswitch/constants.py View File

@ -26,4 +26,3 @@ VM_STATE = 'OS-EXT-STS:vm_state'
# os-net-config constants
OVS_AGENT_INI_FILEPATH = '/etc/neutron/plugins/ml2/openvswitch_agent.ini'
RH_NET_CONF_PATH = "/etc/os-net-config/config.json"

+ 2
- 3
networking_bigswitch/plugins/bigswitch/state_syncer.py View File

@ -17,7 +17,6 @@ from datetime import datetime
from dateutil import parser
from dateutil import tz
import eventlet
import os
from keystoneauth1.identity import v3
from keystoneauth1 import loading
@ -85,11 +84,11 @@ class StateSyncer(object):
session=sess)
# read the bridge mappings from os-net-config
# this helps to generate interface group names in case of RH systems
# if os-net-config is present, attempt to read physnet bridge_mappings
# if it is a RH system, attempt to read physnet bridge_mappings
# from openvswitch_agent.ini
# this does not change at runtime. so read once at init is good.
self.bridge_mappings = {}
if os.path.isfile(bsn_consts.RH_NET_CONF_PATH):
if Util.is_redhat():
self.bridge_mappings = Util.read_ovs_bridge_mappings()
self.bridge_name = None


+ 5
- 0
networking_bigswitch/plugins/bigswitch/utils.py View File

@ -14,6 +14,7 @@
# under the License.
import os
import distro
from networking_bigswitch.plugins.bigswitch import constants as bsn_consts
from networking_bigswitch.plugins.bigswitch.i18n import _LI
from networking_bigswitch.plugins.bigswitch.i18n import _LW
@ -32,6 +33,10 @@ class Util(object):
and reused as required.
"""
@staticmethod
def is_redhat():
return distro.id() == 'rhel'
@staticmethod
def format_resource_name(name):
"""format resource name


+ 2
- 4
networking_bigswitch/plugins/ml2/drivers/mech_bigswitch/driver.py View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
import os
import eventlet
@ -33,7 +32,6 @@ from oslo_utils import excutils
from six.moves import http_client
from networking_bigswitch.plugins.bigswitch import config as pl_config
from networking_bigswitch.plugins.bigswitch import constants as bsn_consts
from networking_bigswitch.plugins.bigswitch.i18n import _LE
from networking_bigswitch.plugins.bigswitch.i18n import _LW
from networking_bigswitch.plugins.bigswitch import plugin
@ -77,10 +75,10 @@ class BigSwitchMechanismDriver(plugin.NeutronRestProxyV2Base,
**{'check_ts': True})
self.segmentation_types = ', '.join(cfg.CONF.ml2.type_drivers)
# if os-net-config is present, attempt to read physnet bridge_mappings
# if it is RH system, attempt to read physnet bridge_mappings
# from openvswitch_agent.ini
self.bridge_mappings = {}
if os.path.isfile(bsn_consts.RH_NET_CONF_PATH):
if Util.is_redhat():
self.bridge_mappings = Util.read_ovs_bridge_mappings()
self.setup_rpc_callbacks()


Loading…
Cancel
Save