How to use the rally.common.logging.getLogger function in rally

To help you get started, we’ve selected a few rally examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ovn-org / ovn-scale-test / rally_ovs / plugins / ovs / scenarios / sandbox.py View on Github external
import sys
import netaddr
import six
from collections import defaultdict

from rally import exceptions
from rally_ovs.plugins.ovs import scenario
from rally.task import atomic
from rally.common import logging
from rally.common import objects

from netaddr.ip import IPRange
from rally_ovs.plugins.ovs.consts import ResourceType

LOG = logging.getLogger(__name__)


class SandboxScenario(scenario.OvsScenario):


    def _add_controller_resource(self, deployment, host_container,
                                 controller_cidr):
        dep = objects.Deployment.get(deployment)
        resources = dep.get_resources(type=ResourceType.CONTROLLER)
        if resources == None:
            dep.add_resource(provider_name=deployment,
                            type=ResourceType.CONTROLLER,
                            info={"ip":controller_cidr.split('/')[0],
                                  "deployment_name":deployment,
                                  "host_container":host_container})
            return
github openstack / rally / rally / plugins / common / validators.py View on Github external
#    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 inspect
import os

import jsonschema
import six

from rally.common import logging
from rally.common import validation

LOG = logging.getLogger(__name__)


@validation.configure(name="jsonschema")
class JsonSchemaValidator(validation.Validator):
    """JSON schema validator"""

    def validate(self, context, config, plugin_cls, plugin_cfg):
        try:
            jsonschema.validate(plugin_cfg, plugin_cls.CONFIG_SCHEMA)
        except jsonschema.ValidationError as err:
            self.fail(str(err))


@validation.configure(name="args-spec")
class ArgsValidator(validation.Validator):
    """Scenario arguments validator"""
github openstack / rally-openstack / rally_openstack / contexts / glance / images.py View on Github external
from rally.common import cfg
from rally.common import logging
from rally.common import utils as rutils
from rally.common import validation
from rally.task import context

from rally_openstack.cleanup import manager as resource_manager
from rally_openstack import consts
from rally_openstack import osclients
from rally_openstack.services.image import image


CONF = cfg.CONF

LOG = logging.getLogger(__name__)


@validation.add("required_platform", platform="openstack", users=True)
@context.configure(name="images", platform="openstack", order=410)
class ImageGenerator(context.Context):
    """Uploads specified Glance images to every tenant."""

    CONFIG_SCHEMA = {
        "type": "object",
        "$schema": consts.JSON_SCHEMA,
        "properties": {
            "image_url": {
                "type": "string",
                "description": "Location of the source to create image from."
            },
            "disk_format": {
github openstack / rally / rally / plugins / openstack / scenarios / vm / utils.py View on Github external
import os.path
import subprocess
import sys

import netaddr
import six

from rally.common import cfg
from rally.common import logging
from rally.common import sshutils
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
from rally.plugins.openstack.wrappers import network as network_wrapper
from rally.task import atomic
from rally.task import utils

LOG = logging.getLogger(__name__)


CONF = cfg.CONF


class Host(object):

    ICMP_UP_STATUS = "ICMP UP"
    ICMP_DOWN_STATUS = "ICMP DOWN"

    name = "ip"

    def __init__(self, ip):
        self.ip = netaddr.IPAddress(ip)
        self.status = self.ICMP_DOWN_STATUS
github openstack / rally / rally / plugins / openstack / scenarios / heat / utils.py View on Github external
#    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 requests

from rally.common import cfg
from rally.common import logging
from rally import exceptions
from rally.plugins.openstack import scenario
from rally.task import atomic
from rally.task import utils


LOG = logging.getLogger(__name__)


CONF = cfg.CONF


class HeatScenario(scenario.OpenStackScenario):
    """Base class for Heat scenarios with basic atomic actions."""

    @atomic.action_timer("heat.list_stacks")
    def _list_stacks(self):
        """Return user stack list."""

        return list(self.clients("heat").stacks.list())

    @atomic.action_timer("heat.create_stack")
    def _create_stack(self, template, parameters=None,
github openstack / rally-openstack / rally_openstack / scenarios / grafana / metrics.py View on Github external
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from rally.common import cfg
from rally.common import logging
from rally.task import types
from rally.task import utils
from rally.task import validation

from rally_openstack import consts
from rally_openstack import scenario
from rally_openstack.services.grafana import grafana as grafana_service

CONF = cfg.CONF
LOG = logging.getLogger(__name__)

"""Scenarios for Pushgateway and Grafana metrics."""


@types.convert(image={"type": "glance_image"},
               flavor={"type": "nova_flavor"})
@validation.add("required_services", services=[consts.Service.NOVA])
@validation.add("required_platform", platform="openstack", admin=True)
@scenario.configure(context={"cleanup@openstack": ["nova"]},
                    name="GrafanaMetrics.push_metric_from_instance",
                    platform="openstack")
class PushMetricsInstance(scenario.OpenStackScenario):
    """Test monitoring system by pushing metric from nova server and check it.

    Scenario tests monitoring system, which uses Pushgateway as metric exporter
    and Grafana as metrics monitoring.
github openstack / rally-openstack / rally_openstack / scenarios / glance / images.py View on Github external
#    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.

from rally.common import logging
from rally.task import types
from rally.task import validation

from rally_openstack import consts
from rally_openstack import scenario
from rally_openstack.scenarios.nova import utils as nova_utils
from rally_openstack.services.image import glance_v2
from rally_openstack.services.image import image

LOG = logging.getLogger(__name__)

"""Scenarios for Glance images."""


class GlanceBasic(scenario.OpenStackScenario):
    def __init__(self, context=None, admin_clients=None, clients=None):
        super(GlanceBasic, self).__init__(context, admin_clients, clients)
        if hasattr(self, "_admin_clients"):
            self.admin_glance = image.Image(
                self._admin_clients, name_generator=self.generate_random_name,
                atomic_inst=self.atomic_actions())
        if hasattr(self, "_clients"):
            self.glance = image.Image(
                self._clients, name_generator=self.generate_random_name,
                atomic_inst=self.atomic_actions())
github openstack / rally / rally / plugins / openstack / osclients.py View on Github external
import abc
import os

from oslo_config import cfg
from six.moves.urllib import parse

from rally.cli import envutils
from rally.common import logging
from rally.common.plugin import plugin
from rally.common import utils
from rally import consts
from rally import exceptions


LOG = logging.getLogger(__name__)
CONF = cfg.CONF


def configure(name, default_version=None, default_service_type=None,
              supported_versions=None):
    """OpenStack client class wrapper.

    Each client class has to be wrapped by configure() wrapper. It
    sets essential configuration of client classes.

    :param name: Name of the client
    :param default_version: Default version for client
    :param default_service_type: Default service type of endpoint(If this
        variable is not specified, validation will assume that your client
        doesn't allow to specify service type.
    :param supported_versions: List of supported versions(If this variable is
github openstack / rally / rally / plugins / openstack / scenarios / sahara / utils.py View on Github external
from saharaclient.api import base as sahara_base

from rally.common import cfg
from rally.common import logging
from rally.common import utils as rutils
from rally import consts
from rally import exceptions
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.sahara import consts as sahara_consts
from rally.task import atomic
from rally.task import utils
from rally.utils import strutils


LOG = logging.getLogger(__name__)
CONF = cfg.CONF


class SaharaScenario(scenario.OpenStackScenario):
    """Base class for Sahara scenarios with basic atomic actions."""

    # NOTE(sskripnick): Some sahara resource names are validated as hostnames.
    # Since underscores are not allowed in hostnames we should not use them.
    RESOURCE_NAME_FORMAT = "rally-sahara-XXXXXX-XXXXXXXXXXXXXXXX"

    @atomic.action_timer("sahara.list_node_group_templates")
    def _list_node_group_templates(self):
        """Return user Node Group Templates list."""
        return self.clients("sahara").node_group_templates.list()

    @atomic.action_timer("sahara.create_master_node_group_template")