def _get_plugin_instance(self, plugin_name): plugin_path = CONF['plugin:%s' % plugin_name].plugin_class module_path, klass = [s.strip() for s in plugin_path.split(':')] if not module_path or not klass: # TODO(slukjanov): replace with specific error raise RuntimeError("Incorrect plugin_class: '%s'" % plugin_path) module = importutils.try_import(module_path) if not hasattr(module, klass): # TODO(slukjanov): replace with specific error raise RuntimeError("Class not found: '%s'" % plugin_path) plugin_class = getattr(module, klass) if not inspect.isclass(plugin_class): # TODO(slukjanov): replace with specific error raise RuntimeError("'%s' isn't a class" % plugin_path) plugin = plugin_class() plugin.name = plugin_name CONF.register_opts(plugin.get_plugin_opts(), group='plugin:%s' % plugin_name) return plugin
def _get_plugin_instance(self, plugin_name): plugin_path = CONF['plugin:%s' % plugin_name].plugin_class module_path, klass = [s.strip() for s in plugin_path.split(':')] if not module_path or not klass: # TODO(slukjanov): replace with specific error raise RuntimeError("Incorrect plugin_class: '%s'" % plugin_path) module = importutils.try_import(module_path) if not hasattr(module, klass): # TODO(slukjanov): replace with specific error raise RuntimeError("Class not found: '%s'" % plugin_path) plugin_class = getattr(module, klass) if not inspect.isclass(plugin_class): # TODO(slukjanov): replace with specific error raise RuntimeError("'%s' isn't a class" % plugin_path) plugin = plugin_class() plugin.name = plugin_name CONF.register_opts(plugin.get_plugin_opts(), group='plugin:%s' % plugin_name) return plugin
import signal import sys import time import eventlet from eventlet import event from oslo.config import cfg from savanna.openstack.common import eventlet_backdoor from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import log as logging from savanna.openstack.common import threadgroup rpc = importutils.try_import('savanna.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) def _sighup_supported(): return hasattr(signal, 'SIGHUP') def _is_sighup(signo): return _sighup_supported() and signo == signal.SIGHUP def _signo_to_signame(signo): signals = {signal.SIGTERM: 'SIGTERM', signal.SIGINT: 'SIGINT'}
import sys import time import eventlet from eventlet import event import logging as std_logging from oslo.config import cfg from savanna.openstack.common import eventlet_backdoor from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import log as logging from savanna.openstack.common import threadgroup rpc = importutils.try_import('savanna.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) class Launcher(object): """Launch one or more services and wait for them to complete.""" def __init__(self): """Initialize the service launcher. :returns: None """ self.services = Services() self.backdoor_port = eventlet_backdoor.initialize_if_enabled()
# 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. import savanna.openstack.common.importutils as importutils _CONF = importutils.try_import( 'savanna.tests.integration.configs.common_config') def _get_conf(key, default): return getattr(_CONF, key) if _CONF and hasattr(_CONF, key) else default OS_USERNAME = _get_conf('OS_USERNAME', 'admin') OS_PASSWORD = _get_conf('OS_PASSWORD', 'password') OS_TENANT_NAME = _get_conf('OS_TENANT_NAME', 'admin') OS_AUTH_URL = _get_conf('OS_AUTH_URL', 'http://192.168.1.1:35357/v2.0/') SAVANNA_HOST = _get_conf('SAVANNA_HOST', '192.168.1.1') SAVANNA_PORT = _get_conf('SAVANNA_PORT', '8386') FLAVOR_ID = _get_conf('FLAVOR_ID', '42')
import time import uuid import eventlet import greenlet from oslo.config import cfg from savanna.openstack.common import excutils from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import jsonutils from savanna.openstack.common import log as logging from savanna.openstack.common.rpc import amqp as rpc_amqp from savanna.openstack.common.rpc import common as rpc_common qpid_codec = importutils.try_import("qpid.codec010") qpid_messaging = importutils.try_import("qpid.messaging") qpid_exceptions = importutils.try_import("qpid.messaging.exceptions") LOG = logging.getLogger(__name__) qpid_opts = [ cfg.StrOpt('qpid_hostname', default='localhost', help='Qpid broker hostname'), cfg.IntOpt('qpid_port', default=5672, help='Qpid broker port'), cfg.ListOpt('qpid_hosts', default=['$qpid_hostname:$qpid_port'], help='Qpid HA cluster host:port pairs'),
# # 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. import eventlet import json from keystoneclient.v2_0 import Client as keystone_client import requests import savanna.openstack.common.importutils as importutils import unittest _CONF = importutils.try_import("savanna.tests.integration.config") def _get_conf(key, default): return getattr(_CONF, key) if _CONF and hasattr(_CONF, key) else default OS_USERNAME = _get_conf("OS_USERNAME", "admin") OS_PASSWORD = _get_conf("OS_PASSWORD", "nova") OS_TENANT_NAME = _get_conf("OS_TENANT_NAME", "admin") OS_AUTH_URL = _get_conf("OS_AUTH_URL", "http://localhost:35357/v2.0/") SAVANNA_HOST = _get_conf("SAVANNA_HOST", "192.168.1.1") SAVANNA_PORT = _get_conf("SAVANNA_PORT", "8080") SAVANNA_IMAGE_ID = _get_conf("SAVANNA_IMAGE_ID", "42") keystone = keystone_client( username=OS_USERNAME,
import inspect import itertools import json try: import xmlrpclib except ImportError: # NOTE(jd): xmlrpclib is not shipped with Python 3 xmlrpclib = None import six from savanna.openstack.common import gettextutils from savanna.openstack.common import importutils from savanna.openstack.common import timeutils netaddr = importutils.try_import("netaddr") _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction, inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] _simple_types = (six.string_types + six.integer_types + (type(None), bool, float)) def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives.
import socket import sys import types import uuid import eventlet import greenlet from oslo.config import cfg from savanna.openstack.common import excutils from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import jsonutils from savanna.openstack.common.rpc import common as rpc_common zmq = importutils.try_import('eventlet.green.zmq') # for convenience, are not modified. pformat = pprint.pformat Timeout = eventlet.timeout.Timeout LOG = rpc_common.LOG RemoteError = rpc_common.RemoteError RPCException = rpc_common.RPCException zmq_opts = [ cfg.StrOpt('rpc_zmq_bind_address', default='*', help='ZeroMQ bind address. Should be a wildcard (*), ' 'an ethernet interface, or IP. ' 'The "host" option should point or resolve to this ' 'address.'),
import time import uuid import eventlet import greenlet from oslo.config import cfg from savanna.openstack.common import excutils from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import jsonutils from savanna.openstack.common import log as logging from savanna.openstack.common.rpc import amqp as rpc_amqp from savanna.openstack.common.rpc import common as rpc_common qpid_codec = importutils.try_import("qpid.codec010") qpid_messaging = importutils.try_import("qpid.messaging") qpid_exceptions = importutils.try_import("qpid.messaging.exceptions") LOG = logging.getLogger(__name__) qpid_opts = [ cfg.StrOpt('qpid_hostname', default='localhost', help='Qpid broker hostname'), cfg.IntOpt('qpid_port', default=5672, help='Qpid broker port'), cfg.ListOpt('qpid_hosts', default=['$qpid_hostname:$qpid_port'], help='Qpid HA cluster host:port pairs'),
# 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. import savanna.openstack.common.importutils as importutils _CONF = importutils.try_import( 'savanna.tests.integration.configs.vanilla_config') def _get_conf(key, default): return getattr(_CONF, key) if _CONF and hasattr(_CONF, key) else default PLUGIN_NAME = _get_conf('PLUGIN_NAME', 'vanilla') IMAGE_ID = _get_conf('IMAGE_ID', 'b244500e-583a-434f-a40f-6ba87fd55e09') NODE_USERNAME = _get_conf('NODE_USERNAME', 'ubuntu') HADOOP_VERSION = _get_conf('HADOOP_VERSION', '1.1.2') HADOOP_USER = _get_conf('HADOOP_USER', 'hadoop') HADOOP_DIRECTORY = _get_conf('HADOOP_DIRECTORY', '/usr/share/hadoop') HADOOP_LOG_DIRECTORY = _get_conf('HADOOP_LOG_DIRECTORY',
# 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. """ The MatchMaker classes should accept a Topic or Fanout exchange key and return keys for direct exchanges, per (approximate) AMQP parlance. """ from oslo.config import cfg from savanna.openstack.common import importutils from savanna.openstack.common import log as logging from savanna.openstack.common.rpc import matchmaker as mm_common redis = importutils.try_import('redis') matchmaker_redis_opts = [ cfg.StrOpt('host', default='127.0.0.1', help='Host to locate redis'), cfg.IntOpt('port', default=6379, help='Use this port to connect to redis host.'), cfg.StrOpt('password', default=None, help='Password for Redis server. (optional)'), ] CONF = cfg.CONF opt_group = cfg.OptGroup(name='matchmaker_redis', title='Options for Redis-based MatchMaker') CONF.register_group(opt_group)
import inspect import itertools import json try: import xmlrpclib except ImportError: # NOTE(jd): xmlrpclib is not shipped with Python 3 xmlrpclib = None import six from savanna.openstack.common import gettextutils from savanna.openstack.common import importutils from savanna.openstack.common import timeutils netaddr = importutils.try_import("netaddr") _nasty_type_tests = [ inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction, inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract ] _simple_types = (six.string_types + six.integer_types + (type(None), bool, float)) def to_primitive(value, convert_instances=False, convert_datetime=True,
import socket import sys import types import uuid import eventlet import greenlet from oslo.config import cfg from savanna.openstack.common import excutils from savanna.openstack.common.gettextutils import _ # noqa from savanna.openstack.common import importutils from savanna.openstack.common import jsonutils from savanna.openstack.common.rpc import common as rpc_common zmq = importutils.try_import('eventlet.green.zmq') # for convenience, are not modified. pformat = pprint.pformat Timeout = eventlet.timeout.Timeout LOG = rpc_common.LOG RemoteError = rpc_common.RemoteError RPCException = rpc_common.RPCException zmq_opts = [ cfg.StrOpt('rpc_zmq_bind_address', default='*', help='ZeroMQ bind address. Should be a wildcard (*), ' 'an ethernet interface, or IP. ' 'The "host" option should point or resolve to this ' 'address.'),