コード例 #1
0
from oslo_utils import importutils
from oslo_utils import timeutils
import six

from neutron.agent.common import utils
from neutron.api.rpc.callbacks import version_manager
from neutron.conf.agent.database import agents_db
from neutron.db.models import agent as agent_model
from neutron.extensions import _availability_zone_filter_lib as azfil_ext
from neutron.extensions import agent as ext_agent
from neutron.extensions import availability_zone as az_ext
from neutron.objects import agent as agent_obj

LOG = logging.getLogger(__name__)

agents_db.register_db_agents_opts()

# this is the ratio from agent_down_time to the time we use to consider
# the agents down for considering their resource versions in the
# version_manager callback
DOWNTIME_VERSIONS_RATIO = 2

RESOURCE_AGENT_TYPE_MAP = {
    'network': constants.AGENT_TYPE_DHCP,
    'router': constants.AGENT_TYPE_L3,
}

AZ_ATTRIBUTE_MAP = {
    'name': {
        'agent_key': 'availability_zone',
        'convert_to': lambda x: x,
コード例 #2
0
ファイル: utils.py プロジェクト: eayunstack/neutron
from oslo_log import log as logging
from oslo_utils import timeutils

from neutron.conf.agent import common as config
from neutron.conf.agent.database import agents_db


if os.name == 'nt':
    from neutron.agent.windows import utils
else:
    from neutron.agent.linux import utils


LOG = logging.getLogger(__name__)
config.register_root_helper(cfg.CONF)
agents_db.register_db_agents_opts()

INTERFACE_NAMESPACE = 'neutron.interface_drivers'


execute = utils.execute


def load_interface_driver(conf):
    """Load interface driver for agents like DHCP or L3 agent.

    :param conf: driver configuration object
    :raises SystemExit of 1 if driver cannot be loaded
    """

    try: