Пример #1
0
            default='localhost',
            help='Qpid broker hostname'),
 cfg.StrOpt('qpid_port', default='5672', help='Qpid broker port'),
 cfg.StrOpt('qpid_username',
            default='',
            help='Username for qpid connection'),
 cfg.StrOpt('qpid_password',
            default='',
            help='Password for qpid connection'),
 cfg.StrOpt('qpid_sasl_mechanisms',
            default='',
            help='Space separated list of SASL mechanisms to use for auth'),
 cfg.BoolOpt('qpid_reconnect', default=True,
             help='Automatically reconnect'),
 cfg.IntOpt('qpid_reconnect_timeout',
            default=0,
            help='Reconnection timeout in seconds'),
 cfg.IntOpt('qpid_reconnect_limit',
            default=0,
            help='Max reconnections before giving up'),
 cfg.IntOpt('qpid_reconnect_interval_min',
            default=0,
            help='Minimum seconds between reconnection attempts'),
 cfg.IntOpt('qpid_reconnect_interval_max',
            default=0,
            help='Maximum seconds between reconnection attempts'),
 cfg.IntOpt('qpid_reconnect_interval',
            default=0,
            help='Equivalent to setting max and min to the same value'),
 cfg.IntOpt('qpid_heartbeat',
            default=60,
Пример #2
0
# @author: [email protected]
#

import time
import httplib
import urllib

from sentry.openstack.common import cfg
from sentry.openstack.common import log

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

request_configs = [
    cfg.IntOpt('http_retry_count',
               default=3,
               help='Retry counts when http connection failed.'),
    cfg.FloatOpt('http_retry_delay',
                 default=3,
                 help='Retry dealy when http connection failed.'),
]

CONF.register_opts(request_configs)


class HttpCommunication(object):
    '''
        Send datas to monitor server by accesskey authorization.
    '''
    def __init__(self,
                 url=None,
Пример #3
0
from sentry.api import wsgi
from sentry.openstack.common import log
from sentry.openstack.common import cfg
"""
    Sentry api for http request
"""

FLAGS = cfg.CONF

manager_configs = [
    cfg.StrOpt('sentry_api_listen',
               default="0.0.0.0",
               help='IP address for metadata api to listen'),
    cfg.IntOpt('sentry_api_listen_port',
               default=9901,
               help='port for metadata api to listen'),
    cfg.IntOpt('sentry_api_workers',
               default=None,
               help='Number of workers for metadata service'),
]

FLAGS.register_opts(manager_configs)

LOG = log.getLogger(__name__)


class Manager(object):
    def __init__(self, name, loader=None):
        self.name = name
        self.loader = loader or wsgi.Loader()
Пример #4
0
kombu_opts = [
    cfg.StrOpt('kombu_ssl_version',
               default='',
               help='SSL version to use (valid only if SSL enabled)'),
    cfg.StrOpt('kombu_ssl_keyfile',
               default='',
               help='SSL key file (valid only if SSL enabled)'),
    cfg.StrOpt('kombu_ssl_certfile',
               default='',
               help='SSL cert file (valid only if SSL enabled)'),
    cfg.StrOpt('kombu_ssl_ca_certs',
               default='',
               help=('SSL certification authority file '
                     '(valid only if SSL enabled)')),
    cfg.StrOpt('rabbit_host', default='localhost', help='the RabbitMQ host'),
    cfg.IntOpt('rabbit_port', default=5672, help='the RabbitMQ port'),
    cfg.BoolOpt('rabbit_use_ssl',
                default=False,
                help='connect over SSL for RabbitMQ'),
    cfg.StrOpt('rabbit_userid', default='guest', help='the RabbitMQ userid'),
    cfg.StrOpt('rabbit_password',
               default='guest',
               help='the RabbitMQ password'),
    cfg.StrOpt('rabbit_virtual_host',
               default='/',
               help='the RabbitMQ virtual host'),
    cfg.IntOpt('rabbit_retry_interval',
               default=1,
               help='how frequently to retry connecting with RabbitMQ'),
    cfg.IntOpt('rabbit_retry_backoff',
               default=2,
Пример #5
0
               help='ZeroMQ bind address. Should be a wildcard (*), '
               'an ethernet interface, or IP. '
               'The "host" option should point or resolve to this '
               'address.'),

    # The module.Class to use for matchmaking.
    cfg.StrOpt(
        'rpc_zmq_matchmaker',
        default=('sentry.openstack.common.rpc.'
                 'matchmaker.MatchMakerLocalhost'),
        help='MatchMaker driver',
    ),

    # The following port is unassigned by IANA as of 2012-05-21
    cfg.IntOpt('rpc_zmq_port',
               default=9501,
               help='ZeroMQ receiver listening port'),
    cfg.IntOpt('rpc_zmq_contexts',
               default=1,
               help='Number of ZeroMQ contexts, defaults to 1'),
    cfg.StrOpt('rpc_zmq_ipc_dir',
               default='/var/run/openstack',
               help='Directory for holding IPC sockets'),
    cfg.StrOpt('rpc_zmq_host',
               default=socket.gethostname(),
               help='Name of this node. Must be a valid hostname, FQDN, or '
               'IP address. Must match "host" option, if running Nova.')
]

# These globals are defined in register_opts(conf),
# a mandatory initialization call
Пример #6
0
import json

from sentry.common import client
from sentry.common import utils
from sentry.openstack.common import cfg
import sentry.openstack.common.log as logging

LOG = logging.getLogger(__name__)

NOVA_OPTS = [
    cfg.StrOpt("nova_host", default="0.0.0.0"),
    cfg.IntOpt("nova_port", default=8774),
    cfg.StrOpt("nova_version", default="/v2")
]

CONF = cfg.CONF
CONF.register_opts(NOVA_OPTS)


class BaseClient(client.BaseClient):
    """client base class for make request of other module"""

    def request(self, req):
        return self.send_request(req.method, req.path,
                                 params=req.params.mixed(),
                                 headers=req.headers, body=req.body)

    def send_request(self, method, action, params={}, headers={}, body=None):
        LOG.debug(_("%(method)s %(action)s %(params)s %(headers)s"),
                                locals())
        res = self.do_request(method, action, params=params, headers=headers,