示例#1
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            discover.LOG.warning(
                "OpenStack plugins moved to the separate package "
                "(see https://pypi.org/project/rally-openstack). In-tree "
                "OpenStack plugins will be removed from the Rally main package"
                " soon.")
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#2
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            discover.LOG.warning(
                "OpenStack plugins moved to the separate package "
                "(see https://pypi.org/project/rally-openstack). In-tree "
                "OpenStack plugins will be removed from the Rally main package"
                " soon.")
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#3
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.deployment.engines")
        discover.import_modules_from_package("rally.deployment.serverprovider")
        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            discover.LOG.warning(
                "OpenStack plugins moved to the separate package "
                "(see https://pypi.python.org/pypi/rally-openstack). In-tree "
                "OpenStack plugins will be removed from the Rally main package"
                " soon.")
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        discover.import_modules_by_entry_point()

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#4
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        # NOTE(andreykurilin): `rally.plugins.common` includes deprecated
        #   modules. As soon as they will be removed the direct import of
        #   validators should be replaced by
        #
        #       discover.import_modules_from_package("rally.plugins.common")
        from rally.plugins.common import validators  # noqa: F401

        discover.import_modules_from_package("rally.plugins.task")
        discover.import_modules_from_package("rally.plugins.verification")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#5
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.plugins.common")

        packages = discover.find_packages_by_entry_point()
        for package in packages:
            if "options" in package:
                opts.register_options_from_path(package["options"])
        discover.import_modules_by_entry_point(_packages=packages)

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#6
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.deployment.engines")
        discover.import_modules_from_package("rally.deployment.serverprovider")
        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            # print warnings when rally_openstack will be released
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        discover.import_modules_by_entry_point()

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#7
0
def load():
    global PLUGINS_LOADED

    if not PLUGINS_LOADED:
        from rally.common import opts

        opts.register()

        discover.import_modules_from_package("rally.deployment.engines")
        discover.import_modules_from_package("rally.deployment.serverprovider")
        discover.import_modules_from_package("rally.plugins.common")
        try:
            import rally_openstack  # noqa
        except ImportError:
            # print warnings when rally_openstack will be released
            discover.import_modules_from_package("rally.plugins.openstack")
            discover.import_modules_from_package("rally.plugins.workload")

        discover.import_modules_by_entry_point()

        discover.load_plugins("/opt/rally/plugins/")
        discover.load_plugins(os.path.expanduser("~/.rally/plugins/"))

    PLUGINS_LOADED = True
示例#8
0
from rally.common import broker
from rally.common.i18n import _
from rally.common import logging
from rally.common import utils as rutils
from rally import consts
from rally import exceptions
from rally import osclients
from rally.plugins.openstack import credential
from rally.plugins.openstack.services.identity import identity
from rally.plugins.openstack.wrappers import network
from rally.task import context
from rally.task import validation

from rally.common import opts
opts.register()

LOG = logging.getLogger(__name__)

CONF = cfg.CONF

RESOURCE_MANAGEMENT_WORKERS_DESCR = ("The number of concurrent threads to use "
                                     "for serving users context.")
PROJECT_DOMAIN_DESCR = "ID of domain in which projects will be created."
USER_DOMAIN_DESCR = "ID of domain in which users will be created."


@validation.add("required_platform", platform="openstack", admin=True)
@context.configure(name="users", namespace="openstack", order=100)
class UserGenerator(context.Context):
    """Context class for generating temporary users/tenants for benchmarks."""
示例#9
0
文件: api.py 项目: joylhx/Rally
    def __init__(self, config_file=None, config_args=None,
                 rally_endpoint=None, plugin_paths=None, skip_db_check=False):
        """Initialize Rally API instance

        :param config_file: Path to rally configuration file. If None, default
                            path will be selected
        :type config_file: str
        :param config_args: Arguments for initialization current configuration
        :type config_args: list
        :param rally_endpoint: [Restricted]Rally endpoint connection string.
        :type rally_endpoint: str
        :param plugin_paths: Additional custom plugin locations
        :type plugin_paths: list
        :param skip_db_check: Allows to skip db revision check
        :type skip_db_check: bool
        """
        if rally_endpoint:
            raise NotImplementedError(_("Sorry, but Rally-as-a-Service is "
                                        "not ready yet."))
        try:
            config_files = ([config_file] if config_file else
                            self._default_config_file())
            CONF(config_args or [],
                 project="rally",
                 version=rally_version.version_string(),
                 default_config_files=config_files)

            opts.register()

            logging.setup("rally")
            if not CONF.get("log_config_append"):
                # The below two lines are to disable noise from request module.
                # The standard way should be we make such lots of settings on
                # the root rally. However current oslo codes doesn't support
                # such interface. So I choose to use a 'hacking' way to avoid
                # INFO logs from request module where user didn't give specific
                # log configuration. And we could remove this hacking after
                # oslo.log has such interface.
                LOG.debug(
                    "INFO logs from urllib3 and requests module are hide.")
                requests_log = logging.getLogger("requests").logger
                requests_log.setLevel(logging.WARNING)
                urllib3_log = logging.getLogger("urllib3").logger
                urllib3_log.setLevel(logging.WARNING)

                LOG.debug("urllib3 insecure warnings are hidden.")
                for warning in ("InsecurePlatformWarning",
                                "SNIMissingWarning",
                                "InsecureRequestWarning"):
                    warning_cls = getattr(urllib3.exceptions, warning, None)
                    if warning_cls is not None:
                        urllib3.disable_warnings(warning_cls)

            # NOTE(wtakase): This is for suppressing boto error logging.
            LOG.debug("ERROR log from boto module is hide.")
            boto_log = logging.getLogger("boto").logger
            boto_log.setLevel(logging.CRITICAL)

            # Set alembic log level to ERROR
            alembic_log = logging.getLogger("alembic").logger
            alembic_log.setLevel(logging.ERROR)

        except cfg.ConfigFilesNotFoundError as e:
            cfg_files = e.config_files
            raise exceptions.RallyException(_(
                "Failed to read configuration file(s): %s") % cfg_files)

        # Check that db is upgraded to the latest revision
        if not skip_db_check:
            self.check_db_revision()

        # Load plugins
        plugin_paths = plugin_paths or []
        if "plugin_paths" in CONF:
            plugin_paths.extend(CONF.get("plugin_paths") or [])
        for path in plugin_paths:
            discover.load_plugins(path)

        # NOTE(andreykurilin): There is no reason to auto-discover API's. We
        # have only 4 classes, so let's do it in good old way - hardcode them:)
        self._deployment = _Deployment(self)
        self._task = _Task(self)
        self._verifier = _Verifier(self)
        self._verification = _Verification(self)
示例#10
0
#
#         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 pbr.version
from rally.common import version as __rally_version__

__rally_version__ = __rally_version__.version_info.semantic_version()
__rally_version__ = __rally_version__.version_tuple()

if __rally_version__ < (0, 12):
    # NOTE(andreykurilin): Rally < 0.12 doesn't care about loading options from
    #   external packages, so we need to handle it manually.

    from rally.common import opts as global_opts

    from rally_openstack.cfg import opts

    # ensure that rally options are registered.
    global_opts.register()
    global_opts.register_opts(opts.list_opts().items())

__version_info__ = pbr.version.VersionInfo("rally-openstack")
__version__ = __version_info__.version_string()
__version_tuple__ = __version_info__.semantic_version().version_tuple()