Exemplo n.º 1
0
    def test_long_vs_short_flags(self):
        FLAGS.clear()
        FLAGS.register_cli_opt(
            cfg.StrOpt('duplicate_answer_long', default='val', help='desc'))
        argv = ['flags_test', '--duplicate_answer=60', 'extra_arg']
        args = flags.parse_args(argv, default_config_files=[])

        self.assert_('duplicate_answer' not in FLAGS)
        self.assert_(FLAGS.duplicate_answer_long, 60)

        FLAGS.clear()
        FLAGS.register_cli_opt(
            cfg.IntOpt('duplicate_answer', default=60, help='desc'))
        args = flags.parse_args(argv, default_config_files=[])
        self.assertEqual(FLAGS.duplicate_answer, 60)
        self.assertEqual(FLAGS.duplicate_answer_long, 'val')
Exemplo n.º 2
0
"""
Simple Scheduler
"""

from cinder import db
from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.scheduler import chance
from cinder.scheduler import driver
from cinder import utils


simple_scheduler_opts = [
    cfg.IntOpt("max_gigabytes",
               default=10000,
               help="maximum number of volume gigabytes to allow per host"),
    ]

FLAGS = flags.FLAGS
FLAGS.register_opts(simple_scheduler_opts)


class SimpleScheduler(chance.ChanceScheduler):
    """Implements Naive Scheduler that tries to find least loaded host."""

    def schedule_create_volume(self, context, volume_id, **_kwargs):
        """Picks a host that is up and has the fewest volumes."""
        elevated = context.elevated()

        volume_ref = db.volume_get(context, volume_id)
Exemplo n.º 3
0
    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=('cinder.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_port_pub', default=9502,
               help='ZeroMQ fanout publisher 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.')
]
Exemplo n.º 4
0
from cinder import flags
from cinder.openstack.common import cfg
from cinder import test
from cinder import service
from cinder import manager
from cinder import wsgi

test_service_opts = [
    cfg.StrOpt("fake_manager",
               default="cinder.tests.test_service.FakeManager",
               help="Manager for testing"),
    cfg.StrOpt("test_service_listen",
               default=None,
               help="Host to bind test service to"),
    cfg.IntOpt("test_service_listen_port",
               default=0,
               help="Port number to bind test service to"),
]

flags.FLAGS.register_opts(test_service_opts)


class FakeManager(manager.Manager):
    """Fake manager for tests"""
    def test_method(self):
        return 'manager'


class ExtendedService(service.Service):
    def test_method(self):
        return 'service'
Exemplo n.º 5
0
from cinder import exception
from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import cfg
from cinder.openstack.common import importutils
from cinder.openstack.common import rpc
from cinder import utils
from cinder import version
from cinder import wsgi


LOG = logging.getLogger(__name__)

service_opts = [
    cfg.IntOpt('report_interval',
               default=10,
               help='seconds between nodes reporting state to datastore'),
    cfg.IntOpt('periodic_interval',
               default=60,
               help='seconds between running periodic tasks'),
    cfg.IntOpt('periodic_fuzzy_delay',
               default=60,
               help='range of seconds to randomly delay when starting the'
                    ' periodic task scheduler to reduce stampeding.'
                    ' (Disable by setting to 0)'),
    cfg.StrOpt('osapi_volume_listen',
               default="0.0.0.0",
               help='IP address for OpenStack Volume API to listen'),
    cfg.IntOpt('osapi_volume_listen_port',
               default=8776,
               help='port for os volume api to listen'),
Exemplo n.º 6
0
from cinder import exception
from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import cfg
from cinder.openstack.common import jsonutils
from cinder import utils
from cinder.volume.san import SanISCSIDriver

LOG = logging.getLogger(__name__)

eqlx_opts = [
    cfg.StrOpt('eqlx_group_name',
               default='group-0',
               help='Group name to use for creating volumes'),
    cfg.IntOpt('eqlx_ssh_keepalive_interval',
               default=1200,
               help='Seconds to wait before sending a keepalive packet'),
    cfg.IntOpt('eqlx_cli_timeout',
               default=30,
               help='Timeout for the Group Manager cli command execution'),
    cfg.IntOpt('eqlx_cli_max_retries',
               default=5,
               help='Maximum retry count for reconnection'),
    cfg.IntOpt('eqlx_cli_retries_timeout',
               default=30,
               help='Seconds to sleep before the next reconnection retry'),
    cfg.BoolOpt('eqlx_use_chap',
                default=False,
                help='Use CHAP authentificaion for targets?'),
    cfg.StrOpt('eqlx_chap_login',
               default='admin',
Exemplo n.º 7
0
        return addr
    except socket.error:
        return "127.0.0.1"


core_opts = [
    cfg.StrOpt('connection_type',
               default=None,
               help='Virtualization api connection type : libvirt, xenapi, '
               'or fake'),
    cfg.StrOpt('sql_connection',
               default='sqlite:///$state_path/$sqlite_db',
               help='The SQLAlchemy connection string used to connect to the '
               'database'),
    cfg.IntOpt('sql_connection_debug',
               default=0,
               help='Verbosity of SQL debugging information. 0=None, '
               '100=Everything'),
    cfg.StrOpt('api_paste_config',
               default="api-paste.ini",
               help='File name for the paste.deploy config for cinder-api'),
    cfg.StrOpt('pybasedir',
               default=os.path.abspath(
                   os.path.join(os.path.dirname(__file__), '../')),
               help='Directory where the cinder python module is installed'),
    cfg.StrOpt('bindir',
               default='$pybasedir/bin',
               help='Directory where cinder binaries are installed'),
    cfg.StrOpt('state_path',
               default='$pybasedir',
               help="Top-level directory for maintaining cinder's state"),
]
Exemplo n.º 8
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,
Exemplo n.º 9
0
            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',
            default=5672,
            help='The RabbitMQ broker port where a single node is used'),
 cfg.ListOpt('rabbit_hosts',
             default=['$rabbit_host:$rabbit_port'],
             help='RabbitMQ HA cluster host:port pairs'),
 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',
Exemplo n.º 10
0
A remote procedure call (rpc) abstraction.

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

from cinder.openstack.common import cfg
from cinder.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',
                default=[
                    'cinder.openstack.common.exception',
                    'nova.exception',
Exemplo n.º 11
0
"""
Request Body limiting middleware.

"""

import webob.dec
import webob.exc

from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder import wsgi

#default request size is 112k
max_request_body_size_opt = cfg.IntOpt('osapi_max_request_body_size',
                                       default=114688,
                                       help='Max size for body of a request')

FLAGS = flags.FLAGS
FLAGS.register_opt(max_request_body_size_opt)
LOG = logging.getLogger(__name__)


class RequestBodySizeLimiter(wsgi.Middleware):
    """Add a 'cinder.context' to WSGI environ."""
    def __init__(self, *args, **kwargs):
        super(RequestBodySizeLimiter, self).__init__(*args, **kwargs)

    @webob.dec.wsgify(RequestClass=wsgi.Request)
    def __call__(self, req):
        if (req.content_length > FLAGS.osapi_max_request_body_size
Exemplo n.º 12
0
# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
#    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.

from cinder import flags
from cinder.openstack.common import cfg

FLAGS = flags.FLAGS
FLAGS.register_opt(cfg.IntOpt('answer', default=42, help='test flag'))
Exemplo n.º 13
0
import datetime

from cinder import db
from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils

LOG = logging.getLogger(__name__)

quota_opts = [
    cfg.IntOpt('quota_volumes',
               default=10,
               help='number of volumes allowed per project'),
    cfg.IntOpt('quota_gigabytes',
               default=1000,
               help='number of volume gigabytes allowed per project'),
    cfg.IntOpt('reservation_expire',
               default=86400,
               help='number of seconds until a reservation expires'),
    cfg.IntOpt('until_refresh',
               default=0,
               help='count of reservations until usage is refreshed'),
    cfg.IntOpt('max_age',
               default=0,
               help='number of seconds between subsequent usage refreshes'),
    cfg.StrOpt('quota_driver',
               default='cinder.quota.DbQuotaDriver',
Exemplo n.º 14
0
import time
import suds
from suds.sax import text

from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume import nfs
from cinder.volume.netapp import netapp_opts

LOG = logging.getLogger("cinder.volume.driver")

netapp_nfs_opts = [
    cfg.IntOpt('synchronous_snapshot_create',
               default=0,
               help='Does snapshot creation call returns immediately')
]

FLAGS = flags.FLAGS
FLAGS.register_opts(netapp_opts)
FLAGS.register_opts(netapp_nfs_opts)


class NetAppNFSDriver(nfs.NfsDriver):
    """Executes commands relating to Volumes."""
    def __init__(self, *args, **kwargs):
        # NOTE(vish): db is set by Manager
        self._execute = None
        self._context = None
        super(NetAppNFSDriver, self).__init__(*args, **kwargs)
Exemplo n.º 15
0
from cinder import exception
from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import cfg
from cinder import utils
from cinder.volume import iscsi

LOG = logging.getLogger(__name__)

volume_opts = [
    cfg.StrOpt('volume_group',
               default='cinder-volumes',
               help='Name for the VG that will contain exported volumes'),
    cfg.IntOpt('num_shell_tries',
               default=3,
               help='number of times to attempt to run flakey shell commands'),
    cfg.IntOpt('num_iscsi_scan_tries',
               default=3,
               help='number of times to rescan iSCSI target to find volume'),
    cfg.IntOpt('iscsi_num_targets',
               default=100,
               help='Number of iscsi target ids per host'),
    cfg.StrOpt('iscsi_target_prefix',
               default='iqn.2010-10.org.openstack:',
               help='prefix for iscsi volumes'),
    cfg.StrOpt('iscsi_ip_address',
               default='$my_ip',
               help='use this ip for iscsi'),
    cfg.IntOpt('iscsi_port',
               default=3260,
Exemplo n.º 16
0
san_opts = [
    cfg.BoolOpt('san_thin_provision',
                default=True,
                help='Use thin provisioning for SAN volumes?'),
    cfg.StrOpt('san_ip', default='', help='IP address of SAN controller'),
    cfg.StrOpt('san_login',
               default='admin',
               help='Username for SAN controller'),
    cfg.StrOpt('san_password', default='', help='Password for SAN controller'),
    cfg.StrOpt('san_private_key',
               default='',
               help='Filename of private key to use for SSH authentication'),
    cfg.StrOpt('san_clustername',
               default='',
               help='Cluster name to use for creating volumes'),
    cfg.IntOpt('san_ssh_port', default=22, help='SSH port to use with SAN'),
    cfg.BoolOpt('san_is_local',
                default=False,
                help='Execute commands locally instead of over SSH; '
                'use if the volume service is running on the SAN device'),
    cfg.StrOpt('san_zfs_volume_base',
               default='rpool/',
               help='The ZFS path under which to create zvols for volumes.'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(san_opts)


class SanISCSIDriver(cinder.volume.driver.ISCSIDriver):
    """Base class for SAN-style storage volumes
Exemplo n.º 17
0
# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
#    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.

from cinder import flags
from cinder.openstack.common import cfg

FLAGS = flags.FLAGS
FLAGS.register_opt(cfg.IntOpt('runtime_answer', default=54, help='test flag'))
Exemplo n.º 18
0
from cinder import exception
from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import cfg
from cinder.volume import driver
from cinder.volume import nexenta
from cinder.volume.nexenta import jsonrpc

LOG = logging.getLogger("cinder.volume.nexenta.volume")
FLAGS = flags.FLAGS

nexenta_opts = [
    cfg.StrOpt('nexenta_host', default='', help='IP address of Nexenta SA'),
    cfg.IntOpt('nexenta_rest_port',
               default=2000,
               help='HTTP port to connect to Nexenta REST API server'),
    cfg.StrOpt('nexenta_rest_protocol',
               default='auto',
               help='Use http or https for REST connection (default auto)'),
    cfg.StrOpt('nexenta_user',
               default='admin',
               help='User name to connect to Nexenta SA'),
    cfg.StrOpt('nexenta_password',
               default='nexenta',
               help='Password to connect to Nexenta SA'),
    cfg.IntOpt('nexenta_iscsi_target_portal_port',
               default=3260,
               help='Nexenta target portal port'),
    cfg.StrOpt('nexenta_volume',
               default='cinder',