Reqd. core_plugin for plugin agents & show cfg opts loaded.
For the linuxbridge, openvswitch, nec, and ryu plugin agents, require the core_plugin configuration option, and throw an exception, if not present. Note: cannot make this a required option for all agents, as there are agent that include the core config options, but do not require core_plugin. In addition, log (as debug) the configuration options that have been loaded at start-up for these four agents. This will help with diagnosing start-up issues related to the configuraiton settings (or lack of). Tested that exception thrown, when missing core_plugin value in config file(s) included, for these four agents. bug 1059923 Change-Id: I813f0c2a3d0ec01be74a34e56ab085979197a16a
This commit is contained in:
parent
56fa94f40b
commit
06ce1329a0
28
quantum/agent/common/validate.py
Normal file
28
quantum/agent/common/validate.py
Normal file
@ -0,0 +1,28 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright 2013 Cisco Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# @author: Paul Michali, Cisco Systems, Inc.
|
||||
|
||||
|
||||
def core_config_options(options):
|
||||
'''Validate core configuration options.
|
||||
|
||||
Make sure that core configuration options that are needed are present and,
|
||||
if not, generate warnings/errors, based on the severity. Will be used
|
||||
only by the agents that require the option(s).
|
||||
'''
|
||||
|
||||
if options.core_plugin is None:
|
||||
raise Exception(_('Quantum core_plugin not configured!'))
|
@ -27,12 +27,14 @@ import sys
|
||||
import time
|
||||
|
||||
import eventlet
|
||||
import logging as std_logging
|
||||
import pyudev
|
||||
|
||||
from quantum.agent.linux import ip_lib
|
||||
from quantum.agent.linux import utils
|
||||
from quantum.agent import rpc as agent_rpc
|
||||
from quantum.agent import securitygroups_rpc as sg_rpc
|
||||
from quantum.agent.common import validate
|
||||
from quantum.common import config as logging_config
|
||||
from quantum.common import topics
|
||||
from quantum.common import utils as q_utils
|
||||
@ -602,6 +604,10 @@ def main():
|
||||
cfg.CONF(project='quantum')
|
||||
|
||||
logging_config.setup_logging(cfg.CONF)
|
||||
|
||||
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||
validate.core_config_options(cfg.CONF)
|
||||
|
||||
try:
|
||||
interface_mappings = q_utils.parse_mappings(
|
||||
cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
|
||||
|
@ -24,7 +24,9 @@
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import logging as std_logging
|
||||
|
||||
from quantum.agent.common import validate
|
||||
from quantum.agent.linux import ovs_lib
|
||||
from quantum.common import config as logging_config
|
||||
from quantum.common import topics
|
||||
@ -112,6 +114,9 @@ def main():
|
||||
|
||||
logging_config.setup_logging(config.CONF)
|
||||
|
||||
config.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||
validate.core_config_options(config.CONF)
|
||||
|
||||
# Determine which agent type to use.
|
||||
integ_br = config.OVS.integration_bridge
|
||||
root_helper = config.AGENT.root_helper
|
||||
|
@ -24,7 +24,9 @@ import sys
|
||||
import time
|
||||
|
||||
import eventlet
|
||||
import logging as std_logging
|
||||
|
||||
from quantum.agent.common import validate
|
||||
from quantum.agent.linux import ip_lib
|
||||
from quantum.agent.linux import ovs_lib
|
||||
from quantum.agent.linux import utils
|
||||
@ -690,6 +692,9 @@ def main():
|
||||
cfg.CONF(project='quantum')
|
||||
logging_config.setup_logging(cfg.CONF)
|
||||
|
||||
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||
validate.core_config_options(cfg.CONF)
|
||||
|
||||
try:
|
||||
agent_config = create_agent_config_map(cfg.CONF)
|
||||
except ValueError as e:
|
||||
|
@ -24,12 +24,14 @@ import httplib
|
||||
import socket
|
||||
import sys
|
||||
|
||||
import logging as std_logging
|
||||
import netifaces
|
||||
from ryu.app import client
|
||||
from ryu.app import conf_switch_key
|
||||
from ryu.app import rest_nw_id
|
||||
from sqlalchemy.ext.sqlsoup import SqlSoup
|
||||
|
||||
from quantum.agent.common import validate
|
||||
from quantum.agent.linux import ovs_lib
|
||||
from quantum.agent.linux.ovs_lib import VifPort
|
||||
from quantum.common import config as logging_config
|
||||
@ -210,6 +212,9 @@ def main():
|
||||
|
||||
logging_config.setup_logging(cfg.CONF)
|
||||
|
||||
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||
validate.core_config_options(cfg.CONF)
|
||||
|
||||
integ_br = cfg.CONF.OVS.integration_bridge
|
||||
root_helper = cfg.CONF.AGENT.root_helper
|
||||
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
|
||||
|
@ -15,9 +15,30 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest2 as unittest
|
||||
|
||||
from quantum.agent.common import config
|
||||
from quantum.agent.common import validate
|
||||
from quantum.openstack.common import cfg
|
||||
|
||||
|
||||
def test_setup_conf():
|
||||
conf = config.setup_conf()
|
||||
assert conf.state_path.endswith('/var/lib/quantum')
|
||||
|
||||
|
||||
class TestCoreConfigOptions(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self._saved_core_plugin = cfg.CONF.core_plugin
|
||||
|
||||
def tearDown(self):
|
||||
cfg.CONF.set_override('core_plugin', self._saved_core_plugin)
|
||||
|
||||
def test_missing_required_core_option(self):
|
||||
with self.assertRaises(Exception) as ex:
|
||||
validate.core_config_options(cfg.CONF)
|
||||
|
||||
def test_have_required_core_option(self):
|
||||
cfg.CONF.set_override('core_plugin', 'some_core_plugin_option')
|
||||
validate.core_config_options(cfg.CONF)
|
||||
|
Loading…
x
Reference in New Issue
Block a user