Пример #1
0
import tempfile
import uuid
import email
import tempfile
import os
import errno

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.osutils.factory import *
from cloudbaseinit.plugins.base import *

LOG = logging.getLogger(__name__)

opts = [
    cfg.StrOpt('user_data_folder', default='cloud-data',
        help='Specifies a folder to store multipart data files.'),
    ]

CONF = cfg.CONF
CONF.register_opts(opts)

class UserDataPlugin():
    def __init__(self, cfg=CONF):
        self.cfg = cfg
        self.msg = None
        return

    def execute(self, service):
        user_data = service.get_user_data('openstack')
        if not user_data:
            return False
Пример #2
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.

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.osutils import factory as osutils_factory
from cloudbaseinit.plugins import base

opts = [
    cfg.StrOpt('username',
               default='Admin',
               help='User to be added to the '
               'system or updated if already existing'),
    cfg.ListOpt('groups',
                default=['Administrators'],
                help='List of local '
                'groups to which the user specified in \'username\' will '
                'be added'),
    cfg.BoolOpt('inject_user_password',
                default=True,
                help='Set the password '
                'provided in the configuration. If False or no password is '
                'provided, a random one will be set'),
]

CONF = cfg.CONF
CONF.register_opts(opts)
Пример #3
0
import greenlet
import qpid.messaging
import qpid.messaging.exceptions

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common.gettextutils import _
from cloudbaseinit.openstack.common import jsonutils
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.openstack.common.rpc import amqp as rpc_amqp
from cloudbaseinit.openstack.common.rpc import common as rpc_common

LOG = logging.getLogger(__name__)

qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               default='localhost',
               help='Qpid broker hostname'),
    cfg.StrOpt('qpid_port', default='5672', help='Qpid broker port'),
    cfg.ListOpt('qpid_hosts',
                default=['$qpid_hostname:$qpid_port'],
                help='Qpid HA cluster host:port pairs'),
    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.IntOpt('qpid_heartbeat',
Пример #4
0
#    License for the specific language governing permissions and limitations
#    under the License.

import re

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.osutils import factory as osutils_factory
from cloudbaseinit.plugins import base

LOG = logging.getLogger(__name__)

opts = [
    cfg.StrOpt('network_adapter',
               default=None,
               help='Network adapter to '
               'configure. If not specified, the first available ethernet '
               'adapter will be chosen'),
]

CONF = cfg.CONF
CONF.register_opts(opts)


class NetworkConfigPlugin(base.BasePlugin):
    def execute(self, service):
        meta_data = service.get_meta_data('openstack')
        if 'network_config' not in meta_data:
            return (base.PLUGIN_EXECUTION_DONE, False)

        network_config = meta_data['network_config']
Пример #5
0
import logging.handlers
import os
import stat
import sys
import traceback

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common.gettextutils import _
from cloudbaseinit.openstack.common import jsonutils
from cloudbaseinit.openstack.common import local
from cloudbaseinit.openstack.common import notifier

log_opts = [
    cfg.StrOpt('logging_context_format_string',
               default='%(asctime)s %(levelname)s %(name)s [%(request_id)s '
               '%(user)s %(tenant)s] %(instance)s'
               '%(message)s',
               help='format string to use for log messages with context'),
    cfg.StrOpt('logging_default_format_string',
               default='%(asctime)s %(process)d %(levelname)s %(name)s [-]'
               ' %(instance)s%(message)s',
               help='format string to use for log messages without context'),
    cfg.StrOpt('logging_debug_format_suffix',
               default='%(funcName)s %(pathname)s:%(lineno)d',
               help='data to append to log format when level is DEBUG'),
    cfg.StrOpt('logging_exception_prefix',
               default='%(asctime)s %(process)d TRACE %(name)s %(instance)s',
               help='prefix each line of exception output with this format'),
    cfg.ListOpt('default_log_levels',
                default=[
                    'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN',
Пример #6
0
#    License for the specific language governing permissions and limitations
#    under the License.
"""
A remote procedure call (rpc) abstraction.

For some wrappers that add message versioning to rpc, see:
    rpc.dispatcher
    rpc.proxy
"""

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common import importutils

rpc_opts = [
    cfg.StrOpt('rpc_backend',
               default='%s.impl_kombu' % __package__,
               help="The messaging module to use, defaults to kombu."),
    cfg.IntOpt('rpc_thread_pool_size',
               default=64,
               help='Size of RPC thread pool'),
    cfg.IntOpt('rpc_conn_pool_size',
               default=30,
               help='Size of RPC connection pool'),
    cfg.IntOpt('rpc_response_timeout',
               default=60,
               help='Seconds to wait for a response from call or multicall'),
    cfg.IntOpt('rpc_cast_timeout',
               default=30,
               help='Seconds to wait before a cast expires (TTL). '
               'Only supported by impl_zmq.'),
    cfg.ListOpt('allowed_rpc_exception_modules',
Пример #7
0
from eventlet import semaphore

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common.gettextutils import _
from cloudbaseinit.openstack.common import fileutils
from cloudbaseinit.openstack.common import log as logging

LOG = logging.getLogger(__name__)

util_opts = [
    cfg.BoolOpt('disable_process_locking',
                default=False,
                help='Whether to disable inter-process locks'),
    cfg.StrOpt('lock_path',
               default=os.path.abspath(
                   os.path.join(os.path.dirname(__file__), '../')),
               help='Directory to use for lock files')
]

CONF = cfg.CONF
CONF.register_opts(util_opts)


class _InterProcessLock(object):
    """Lock implementation which allows multiple locks, working around
    issues like bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does
    not require any cleanup. Since the lock is always held on a file
    descriptor rather than outside of the process, the lock gets dropped
    automatically if the process crashes, even if __exit__ is not executed.

    There are no guarantees regarding usage by multiple green threads in a
Пример #8
0
from cloudbaseinit.openstack.common import importutils
from cloudbaseinit.openstack.common import jsonutils
from cloudbaseinit.openstack.common.rpc import common as rpc_common


# 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.'),

    # The module.Class to use for matchmaking.
    cfg.StrOpt(
        'rpc_zmq_matchmaker',
        default=('cloudbaseinit.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'),
Пример #9
0
import eventlet
import greenlet
import kombu
import kombu.connection
import kombu.entity
import kombu.messaging

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common.gettextutils import _
from cloudbaseinit.openstack.common import network_utils
from cloudbaseinit.openstack.common.rpc import amqp as rpc_amqp
from cloudbaseinit.openstack.common.rpc import common as rpc_common

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 broker address where a single node is used'),
    cfg.IntOpt('rabbit_port',
Пример #10
0
#    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 posixpath
import urllib2
import urlparse

from cloudbaseinit.metadata.services import base
from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common import log as logging
from cloudbaseinit.osutils import factory as osutils_factory

opts = [
    cfg.StrOpt('metadata_base_url',
               default='http://169.254.169.254/',
               help='The base URL where the service looks for metadata'),
]

CONF = cfg.CONF
CONF.register_opts(opts)

LOG = logging.getLogger(__name__)


class HttpService(base.BaseMetadataService):
    def __init__(self):
        super(HttpService, self).__init__()
        self._enable_retry = True

    def _check_metadata_ip_route(self):
Пример #11
0
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

import contextlib
import itertools
import json

from cloudbaseinit.openstack.common import cfg
from cloudbaseinit.openstack.common.gettextutils import _
from cloudbaseinit.openstack.common import log as logging


matchmaker_opts = [
    # Matchmaker ring file
    cfg.StrOpt('matchmaker_ringfile',
               default='/etc/nova/matchmaker_ring.json',
               help='Matchmaker ring file (JSON)'),
]

CONF = cfg.CONF
CONF.register_opts(matchmaker_opts)
LOG = logging.getLogger(__name__)
contextmanager = contextlib.contextmanager


class MatchMakerException(Exception):
    """Signified a match could not be found."""
    message = _("Match not found by MatchMaker.")


class Exchange(object):