#!/usr/bin/env python # Copyright 2013 IBM Corp. import os import sys # NOTE(mikal): All of this is because if dnspython is present in your # environment then eventlet monkeypatches socket.getaddrinfo() with an # implementation which doesn't work for IPv6. What we're checking here is # that the magic environment variable was set when the import happened. if ('eventlet' in sys.modules and os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes'): raise ImportError('eventlet imported before neutron agent ' '(env var set to %s)' % os.environ.get('EVENTLET_NO_GREENDNS')) os.environ['EVENTLET_NO_GREENDNS'] = 'yes' import eventlet eventlet.patcher.monkey_patch(os=False, thread=False) # If ../powervc/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python. POSSIBLE_TOPDIR = os.path.normpath(os.path.join( os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) # TODO RYKAL # This should go in the base __init__ folder I think from neutron.openstack.common import gettextutils gettextutils.install('neutron') # NOTE: Import powervc driver common config at the very beginning to parse # AMQP. from powervc.common import config from neutron.common import config as logging_config config.parse_power_config(sys.argv, 'powervc-neutron') logging_config.setup_logging() from powervc.neutron.agent.neutron_powervc_agent import main main()