Beispiel #1
0
    def test_flagfile(self):
        opts = [
            cfg.StrOpt('string', default='default', help='desc'),
            cfg.IntOpt('int', default=1, help='desc'),
            cfg.BoolOpt('false', default=False, help='desc'),
            cfg.BoolOpt('true', default=True, help='desc'),
            cfg.MultiStrOpt('multi', default=['blaa'], help='desc'),
        ]

        self.FLAGS.register_opts(opts)

        (fd, path) = tempfile.mkstemp(prefix='nova', suffix='.flags')

        try:
            os.write(fd, '--string=foo\n--int=2\n--false\n--notrue\n')
            os.write(fd, '--multi=foo\n')  # FIXME(markmc): --multi=bar\n')
            os.close(fd)

            self.FLAGS(['flags_test', '--flagfile=' + path])

            self.assertEqual(self.FLAGS.string, 'foo')
            self.assertEqual(self.FLAGS.int, 2)
            self.assertEqual(self.FLAGS.false, True)
            self.assertEqual(self.FLAGS.true, False)
            self.assertEqual(self.FLAGS.multi, ['foo'])  # FIXME(markmc): 'bar'

            # Re-parse to test multistring isn't append multiple times
            self.FLAGS(['flags_test', '--flagfile=' + path])
            self.assertEqual(self.FLAGS.multi, ['foo'])  # FIXME(markmc): 'bar'
        finally:
            os.remove(path)
Beispiel #2
0
 def parse_args(self, argv):
     """Parses command-line arguments."""
     cli_opts = [
         cfg.BoolOpt('no-site-packages',
                     default=False,
                     short='n',
                     help="Do not inherit packages from global Python"
                          "install"),
     ]
     CLI = cfg.ConfigOpts()
     CLI.register_cli_opts(cli_opts)
     CLI(argv[1:])
     return CLI
Beispiel #3
0
#    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.
"""Module for SPICE Proxying."""

from nova.openstack.common import cfg

spice_opts = [
    cfg.StrOpt('html5proxy_base_url',
               default='http://127.0.0.1:6080/spice_auto.html',
               help='location of spice html5 console proxy, in the form '
               '"http://127.0.0.1:6080/spice_auto.html"'),
    cfg.StrOpt('server_listen',
               default='127.0.0.1',
               help='IP address on which instance spice server should listen'),
    cfg.StrOpt('server_proxyclient_address',
               default='127.0.0.1',
               help='the address to which proxy clients '
               '(like nova-spicehtml5proxy) should connect'),
    cfg.BoolOpt('enabled', default=False,
                help='enable spice related features'),
    cfg.BoolOpt('agent_enabled',
                default=True,
                help='enable spice guest agent support'),
    cfg.StrOpt('keymap', default='en-us', help='keymap for spice'),
]

CONF = cfg.CONF
CONF.register_opts(spice_opts, group='spice')
Beispiel #4
0
                       '%(pathname)s:%(lineno)d',
               help='data to append to log format when level is DEBUG'),
    cfg.StrOpt('logging_exception_prefix',
               default='%(asctime)s 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',
                  'suds=INFO',
                  'eventlet.wsgi.server=WARN'
                  ],
                help='list of logger=LEVEL pairs'),
    cfg.BoolOpt('publish_errors',
                default=False,
                help='publish error events'),

    # NOTE(mikal): there are two options here because sometimes we are handed
    # a full instance (and could include more information), and other times we
    # are just handed a UUID for the instance.
    cfg.StrOpt('instance_format',
               default='[instance: %(uuid)s] ',
               help='If an instance is passed with the log message, format '
                    'it like this'),
    cfg.StrOpt('instance_uuid_format',
               default='[instance: %(uuid)s] ',
               help='If an instance UUID is passed with the log message, '
                    'format it like this'),
    ]
Beispiel #5
0
            help='Username for connection to XenServer/Xen Cloud Platform. '
                 'Used only if compute_driver=xenapi.XenAPIDriver'),
 cfg.StrOpt('xenapi_connection_password',
            default=None,
            help='Password for connection to XenServer/Xen Cloud Platform. '
                 'Used only if compute_driver=xenapi.XenAPIDriver'),
 cfg.IntOpt('xenapi_connection_concurrent',
            default=5,
            help='Maximum number of concurrent XenAPI connections. '
                 'Used only if compute_driver=xenapi.XenAPIDriver'),
 cfg.FloatOpt('xenapi_vhd_coalesce_poll_interval',
              default=5.0,
              help='The interval used for polling of coalescing vhds. '
                   'Used only if compute_driver=xenapi.XenAPIDriver'),
 cfg.BoolOpt('xenapi_check_host',
             default=True,
             help='Ensure compute service is running on host XenAPI '
                  'connects to.'),
 cfg.IntOpt('xenapi_vhd_coalesce_max_attempts',
            default=5,
            help='Max number of times to poll for VHD to coalesce. '
                 'Used only if compute_driver=xenapi.XenAPIDriver'),
 cfg.StrOpt('xenapi_sr_base_path',
            default='/var/run/sr-mount',
            help='Base path to the storage repository'),
 cfg.StrOpt('target_host',
            default=None,
            help='iSCSI Target Host'),
 cfg.StrOpt('target_port',
            default='3260',
            help='iSCSI Target Port, 3260 Default'),
 cfg.StrOpt('iqn_prefix',
Beispiel #6
0
from nova.openstack.common import log as logging
from nova.virt.libvirt import volume_nfs
from nova.volume import driver

LOG = logging.getLogger(__name__)

volume_opts = [
    cfg.StrOpt('nfs_shares_config',
                default=None,
                help='File with the list of available nfs shares'),
    cfg.StrOpt('nfs_disk_util',
               default='df',
               help='Use du or df for free space calculation'),
    cfg.BoolOpt('nfs_sparsed_volumes',
                default=True,
                help=('Create volumes as sparsed files which take no space.'
                      'If set to False volume is created as regular file.'
                      'In such case volume creation takes a lot of time.'))
]

FLAGS = flags.FLAGS
FLAGS.register_opts(volume_opts)
FLAGS.register_opts(volume_nfs.volume_opts)


class NfsDriver(driver.VolumeDriver):
    """NFS based volume driver. Creates file on NFS share for using it
    as block device on hypervisor."""

    def do_setup(self, context):
        """Any initialization the volume driver does while starting"""
Beispiel #7
0
qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               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'),
Beispiel #8
0
crypto_opts = [
    cfg.StrOpt('ca_file', default='cacert.pem', help=_('Filename of root CA')),
    cfg.StrOpt('key_file',
               default=os.path.join('private', 'cakey.pem'),
               help=_('Filename of private key')),
    cfg.StrOpt('crl_file',
               default='crl.pem',
               help=_('Filename of root Certificate Revocation List')),
    cfg.StrOpt('keys_path',
               default=paths.state_path_def('keys'),
               help=_('Where we keep our keys')),
    cfg.StrOpt('ca_path',
               default=paths.state_path_def('CA'),
               help=_('Where we keep our root CA')),
    cfg.BoolOpt('use_project_ca',
                default=False,
                help=_('Should we use a CA for each project?')),
    cfg.StrOpt('user_cert_subject',
               default='/C=US/ST=California/O=OpenStack/'
               'OU=NovaDev/CN=%.16s-%.16s-%s',
               help=_('Subject for certificate for users, %s for '
                      'project, user, timestamp')),
    cfg.StrOpt('project_cert_subject',
               default='/C=US/ST=California/O=OpenStack/'
               'OU=NovaDev/CN=project-ca-%.16s-%s',
               help=_('Subject for certificate for projects, %s for '
                      'project, timestamp')),
]

CONF = cfg.CONF
CONF.register_opts(crypto_opts)
Beispiel #9
0
from nova.db.sqlalchemy.session import get_engine
from nova.network import manager as network_manager
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import service
from nova import tests
from nova.tests import fake_flags
from nova.tests import utils

test_opts = [
    cfg.StrOpt('sqlite_clean_db',
               default='clean.sqlite',
               help='File name of clean sqlite db'),
    cfg.BoolOpt('fake_tests',
                default=True,
                help='should we use everything for testing'),
]

CONF = cfg.CONF
CONF.register_opts(test_opts)
CONF.import_opt('sql_connection', 'nova.db.sqlalchemy.session')
CONF.import_opt('sqlite_db', 'nova.db.sqlalchemy.session')
CONF.import_opt('state_path', 'nova.config')
CONF.set_override('use_stderr', False)

logging.setup('nova')
LOG = logging.getLogger(__name__)

eventlet.monkey_patch(os=False)
Beispiel #10
0
                                   os.pardir,
                                   os.pardir,
                                   os.pardir))
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
    sys.path.insert(0, POSSIBLE_TOPDIR)

from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.xenapi import driver as xenapi_driver
from nova.virt.xenapi import vm_utils

destroy_opts = [
    cfg.BoolOpt('all_cached',
                default=False,
                help='Destroy all cached images instead of just unused cached'
                     ' images.'),
    cfg.BoolOpt('dry_run',
                default=False,
                help='Don\'t actually delete the VDIs.')
]

CONF = cfg.CONF
CONF.register_cli_opts(destroy_opts)


def main():
    config.parse_args(sys.argv)
    utils.monkey_patch()

    xenapi = xenapi_driver.XenAPIDriver()
Beispiel #11
0
from nova.api.metadata import base
from nova.common import memorycache
from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova import wsgi

CACHE_EXPIRATION = 15  # in seconds

CONF = cfg.CONF
CONF.import_opt('use_forwarded_for', 'nova.api.auth')

metadata_proxy_opts = [
    cfg.BoolOpt(
        'service_quantum_metadata_proxy',
        default=False,
        help='Set flag to indicate Quantum will proxy metadata requests and '
             'resolve instance ids.'),
     cfg.StrOpt(
         'quantum_metadata_proxy_shared_secret',
         default='',
         help='Shared secret to validate proxies Quantum metadata requests')
]

CONF.register_opts(metadata_proxy_opts)

LOG = logging.getLogger(__name__)


class MetadataRequestHandler(wsgi.Application):
    """Serve metadata."""
Beispiel #12
0
from nova.api.openstack.compute import flavors
from nova.api.openstack.compute import image_metadata
from nova.api.openstack.compute import images
from nova.api.openstack.compute import ips
from nova.api.openstack.compute import limits
from nova.api.openstack.compute import server_metadata
from nova.api.openstack.compute import servers
from nova.api.openstack.compute import versions
from nova import flags
from nova.openstack.common import cfg
from nova.openstack.common import log as logging

LOG = logging.getLogger(__name__)

allow_instance_snapshots_opt = cfg.BoolOpt(
    'allow_instance_snapshots',
    default=True,
    help='Permit instance snapshot operations.')

FLAGS = flags.FLAGS
FLAGS.register_opt(allow_instance_snapshots_opt)


class APIRouter(nova.api.openstack.APIRouter):
    """
    Routes requests on the OpenStack API to the appropriate controller
    and method.
    """
    ExtensionManager = extensions.ExtensionManager

    def _setup_routes(self, mapper):
        self.resources['versions'] = versions.create_resource()
Beispiel #13
0
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.hyperv import baseops
from nova.virt.hyperv import constants
from nova.virt.hyperv import vmutils

LOG = logging.getLogger(__name__)

hyperv_opts = [
    cfg.StrOpt('vswitch_name',
               default=None,
               help='Default vSwitch Name, '
               'if none provided first external is used'),
    cfg.BoolOpt('limit_cpu_features',
                default=False,
                help='required for live migration among '
                'hosts with different CPU features')
]

FLAGS = flags.FLAGS
FLAGS.register_opts(hyperv_opts)


class VMOps(baseops.BaseOps):
    def __init__(self, volumeops):
        super(VMOps, self).__init__()

        self._vmutils = vmutils.VMUtils()
        self._volumeops = volumeops

    def list_instances(self):
Beispiel #14
0
import os
import re

from nova import exception
from nova.image import glance
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova import utils


LOG = logging.getLogger(__name__)

image_opts = [
    cfg.BoolOpt('force_raw_images',
                default=True,
                help='Force backing images to raw format'),
]

CONF = cfg.CONF
CONF.register_opts(image_opts)


class QemuImgInfo(object):
    BACKING_FILE_RE = re.compile((r"^(.*?)\s*\(actual\s+path\s*:"
                                  r"\s+(.*?)\)\s*$"), re.I)
    TOP_LEVEL_RE = re.compile(r"^([\w\d\s\_\-]+):(.*)$")
    SIZE_RE = re.compile(r"\(\s*(\d+)\s+bytes\s*\)", re.I)

    def __init__(self, cmd_output):
        details = self._parse(cmd_output)
Beispiel #15
0
from nova import db
from nova import exception
from nova import flags
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
from nova.virt.xenapi import pool_states
from nova.virt.xenapi import vm_utils

LOG = logging.getLogger(__name__)

xenapi_pool_opts = [
    cfg.BoolOpt('use_join_force',
                default=True,
                help='To use for hosts with different CPUs'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(xenapi_pool_opts)


class ResourcePool(object):
    """
    Implements resource pool operations.
    """
    def __init__(self, session):
        host_ref = session.get_xenapi_host()
        host_rec = session.call_xenapi('host.get_record', host_ref)
        self._host_name = host_rec['hostname']
Beispiel #16
0
from lxml import etree

from nova import exception
from nova import flags
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova import utils
import nova.volume.driver

LOG = logging.getLogger(__name__)

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,
Beispiel #17
0
from nova.openstack.common import log
from nova.openstack.common.notifier import api as notifier_api
from nova.openstack.common import timeutils
from nova import utils

LOG = log.getLogger(__name__)

notify_state_opt = cfg.StrOpt('notify_on_state_change', default=None,
    help='If set, send compute.instance.update notifications on instance '
         'state changes.  Valid values are None for no notifications, '
         '"vm_state" for notifications on VM state changes, or '
         '"vm_and_task_state" for notifications on VM and task state '
         'changes.')

notify_any_opt = cfg.BoolOpt('notify_on_any_change', default=False,
    help='If set, send compute.instance.update notifications on instance '
         'state changes.  Valid values are False for no notifications, '
         'True for notifications on any instance changes.')

FLAGS = flags.FLAGS
FLAGS.register_opt(notify_state_opt)
FLAGS.register_opt(notify_any_opt)


def send_update(context, old_instance, new_instance, service=None, host=None):
    """Send compute.instance.update notification to report any changes occurred
    in that instance
    """

    if not FLAGS.notify_on_any_change and not FLAGS.notify_on_state_change:
        # skip all this if updates are disabled
        return
Beispiel #18
0
               'configuration is not injected into the image. '
               'Used if connection_type=xenapi and flat_injected=True'),
    cfg.StrOpt('xenapi_sr_base_path',
               default='/var/run/sr-mount',
               help='Base path to the storage repository'),
    cfg.StrOpt('target_host', default=None, help='iSCSI Target Host'),
    cfg.StrOpt('target_port',
               default='3260',
               help='iSCSI Target Port, 3260 Default'),
    cfg.StrOpt('iqn_prefix',
               default='iqn.2010-10.org.openstack',
               help='IQN Prefix'),
    # NOTE(sirp): This is a work-around for a bug in Ubuntu Maverick,
    # when we pull support for it, we should remove this
    cfg.BoolOpt('xenapi_remap_vbd_dev',
                default=False,
                help='Used to enable the remapping of VBD dev '
                '(Works around an issue in Ubuntu Maverick)'),
    cfg.StrOpt('xenapi_remap_vbd_dev_prefix',
               default='sd',
               help='Specify prefix to remap VBD dev to '
               '(ex. /dev/xvdb -> /dev/sdb)'),
    cfg.IntOpt('xenapi_login_timeout',
               default=10,
               help='Timeout in seconds for XenAPI login.'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(xenapi_opts)


def get_connection(_read_only):
Beispiel #19
0
from nova.openstack.common import cfg
from nova.openstack.common import importutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.virt import netutils


LOG = logging.getLogger(__name__)

firewall_opts = [
    cfg.StrOpt('firewall_driver',
               default=None,
               help='Firewall driver '
                    '(defaults to hypervisor specific iptables driver)'),
    cfg.BoolOpt('allow_same_net_traffic',
                default=True,
                help='Whether to allow network traffic from same network'),
]

CONF = cfg.CONF
CONF.register_opts(firewall_opts)
CONF.import_opt('use_ipv6', 'nova.config')


def load_driver(default, *args, **kwargs):
    fw_class = importutils.import_class(CONF.firewall_driver or default)
    return fw_class(*args, **kwargs)


class FirewallDriver(object):
    """ Firewall Driver base class.
Beispiel #20
0
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova import utils
from nova.virt import netutils
from nova.virt import vif

from nova.virt.libvirt import config

LOG = logging.getLogger(__name__)

libvirt_vif_opts = [
    cfg.StrOpt('libvirt_ovs_bridge',
               default='br-int',
               help='Name of Integration Bridge used by Open vSwitch'),
    cfg.BoolOpt('libvirt_use_virtio_for_bridges',
                default=False,
                help='Use virtio for bridge interfaces'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(libvirt_vif_opts)
flags.DECLARE('libvirt_type', 'nova.virt.libvirt.driver')

LINUX_DEV_LEN = 14


class LibvirtBridgeDriver(vif.VIFDriver):
    """VIF driver for Linux bridge."""
    def _get_configurations(self, instance, network, mapping):
        """Get a dictionary of VIF configurations for bridge type."""
Beispiel #21
0
from nova import rpc
from nova import utils
from nova.volume import volume_types
from nova.volume import utils as volume_utils

LOG = logging.getLogger(__name__)

volume_manager_opts = [
    cfg.StrOpt('storage_availability_zone',
               default='nova',
               help='availability zone of this service'),
    cfg.StrOpt('volume_driver',
               default='nova.volume.driver.ISCSIDriver',
               help='Driver to use for volume creation'),
    cfg.BoolOpt('use_local_volumes',
                default=True,
                help='if True, will not discover local volumes'),
    cfg.BoolOpt('volume_force_update_capabilities',
                default=False,
                help='if True will force update capabilities on each check'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(volume_manager_opts)


class VolumeManager(manager.SchedulerDependentManager):
    """Manages attachable block storage devices."""
    def __init__(self, volume_driver=None, *args, **kwargs):
        """Load the driver from the one specified in args, or from flags."""
        if not volume_driver:
Beispiel #22
0
from nova.openstack.common import log as logging
from nova import utils
from nova.virt import configdrive
from nova.virt.hyperv import baseops
from nova.virt.hyperv import constants
from nova.virt.hyperv import vmutils

LOG = logging.getLogger(__name__)

hyperv_opts = [
    cfg.StrOpt('vswitch_name',
               default=None,
               help='Default vSwitch Name, '
               'if none provided first external is used'),
    cfg.BoolOpt('limit_cpu_features',
                default=False,
                help='Required for live migration among '
                'hosts with different CPU features'),
    cfg.BoolOpt('config_drive_inject_password',
                default=False,
                help='Sets the admin password in the config drive image'),
    cfg.StrOpt('qemu_img_cmd',
               default="qemu-img.exe",
               help='qemu-img is used to convert between '
               'different image types'),
    cfg.BoolOpt('config_drive_cdrom',
                default=False,
                help='Attaches the Config Drive image as a cdrom drive '
                'instead of a disk drive')
]

CONF = cfg.CONF
Beispiel #23
0
from eventlet import event
from eventlet.green import subprocess
from eventlet import greenthread
import netaddr

from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils

monkey_patch_opts = [
    cfg.BoolOpt('monkey_patch',
                default=False,
                help='Whether to log monkey patching'),
    cfg.ListOpt('monkey_patch_modules',
                default=[
                    'nova.api.ec2.cloud:nova.notifier.api.notify_decorator',
                    'nova.compute.api:nova.notifier.api.notify_decorator'
                ],
                help='List of modules/decorators to monkey patch'),
]
utils_opts = [
    cfg.IntOpt('password_length',
               default=12,
               help='Length of generated instance admin passwords'),
    cfg.BoolOpt('disable_process_locking',
                default=False,
                help='Whether to disable inter-process locks'),
Beispiel #24
0
                 'It is not necessarily a hostname, FQDN, or IP address. '
                 'However, the node name must be valid within '
                 'an AMQP key, and if using ZeroMQ, a valid '
                 'hostname, FQDN, or IP address'),
 cfg.StrOpt('node_availability_zone',
            default='nova',
            help='availability zone of this node'),
 cfg.ListOpt('memcached_servers',
             default=None,
             help='Memcached servers or None for in process cache.'),
 cfg.StrOpt('default_ephemeral_format',
            default=None,
            help='The default format an ephemeral_volume will be '
                 'formatted with on creation.'),
 cfg.BoolOpt('use_ipv6',
             default=False,
             help='use ipv6'),
 cfg.IntOpt('service_down_time',
            default=60,
            help='maximum time since last check-in for up service'),
 cfg.BoolOpt('use_cow_images',
             default=True,
             help='Whether to use cow images'),
 cfg.StrOpt('compute_api_class',
             default='nova.compute.api.API',
             help='The full class name of the compute API class to use'),
 cfg.StrOpt('network_api_class',
             default='nova.network.api.API',
             help='The full class name of the network API class to use'),
 cfg.StrOpt('volume_api_class',
             default='nova.volume.cinder.API',
Beispiel #25
0
from nova.compute import rpcapi as compute_rpcapi
from nova import exception
from nova import flags
from nova import manager
from nova.openstack.common import cfg
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova import utils

console_manager_opts = [
    cfg.StrOpt('console_driver',
               default='nova.console.xvp.XVPConsoleProxy',
               help='Driver to use for the console proxy'),
    cfg.BoolOpt('stub_compute',
                default=False,
                help='Stub calls to compute worker for tests'),
    cfg.StrOpt('console_public_hostname',
               default=socket.gethostname(),
               help='Publicly visible name for this console host'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(console_manager_opts)
LOG = logging.getLogger(__name__)


class ConsoleProxyManager(manager.Manager):
    """Sets up and tears down any console proxy connections.

    Needed for accessing instance consoles securely.
Beispiel #26
0
from nova.virt.libvirt import config as vconfig
from nova.virt.libvirt import snapshots
from nova.virt.libvirt import utils as libvirt_utils

__imagebackend_opts = [
    cfg.StrOpt('libvirt_images_type',
               default='default',
               help='VM Images format. Acceptable values are: raw, qcow2, lvm,'
               ' default. If default is specified,'
               ' then use_cow_images flag is used instead of this one.'),
    cfg.StrOpt('libvirt_images_volume_group',
               default=None,
               help='LVM Volume Group that is used for VM images, when you'
               ' specify libvirt_images_type=lvm.'),
    cfg.BoolOpt('libvirt_sparse_logical_volumes',
                default=False,
                help='Create sparse logical volumes (with virtualsize)'
                ' if this flag is set to True.'),
]

CONF = cfg.CONF
CONF.register_opts(__imagebackend_opts)
CONF.import_opt('base_dir_name', 'nova.virt.libvirt.imagecache')


class Image(object):
    __metaclass__ = abc.ABCMeta

    def __init__(self, source_type, driver_format, is_block_dev=False):
        """Image initialization.

        :source_type: block or file
Beispiel #27
0
Common Auth Middleware.

"""

import webob.dec
import webob.exc

from nova import context
from nova import flags
from nova import log as logging
from nova.openstack.common import cfg
from nova import wsgi

use_forwarded_for_opt = cfg.BoolOpt(
    'use_forwarded_for',
    default=False,
    help='Treat X-Forwarded-For as the canonical remote address. '
    'Only enable this if you have a sanitizing proxy.')

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


def pipeline_factory(loader, global_conf, **local_conf):
    """A paste pipeline replica that keys off of auth_strategy."""
    pipeline = local_conf[FLAGS.auth_strategy]
    if not FLAGS.api_rate_limit:
        limit_name = FLAGS.auth_strategy + '_nolimit'
        pipeline = local_conf.get(limit_name, pipeline)
    pipeline = pipeline.split()
Beispiel #28
0
            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,
            help='how long to backoff for between retries when connecting '
            'to RabbitMQ'),
Beispiel #29
0
ec2_opts = [
    cfg.IntOpt('lockout_attempts',
               default=5,
               help='Number of failed auths before lockout.'),
    cfg.IntOpt('lockout_minutes',
               default=15,
               help='Number of minutes to lockout if triggered.'),
    cfg.IntOpt('lockout_window',
               default=15,
               help='Number of minutes for lockout window.'),
    cfg.StrOpt('keystone_ec2_url',
               default='http://localhost:5000/v2.0/ec2tokens',
               help='URL to get token from ec2 request.'),
    cfg.BoolOpt('ec2_private_dns_show_ip',
                default=False,
                help='Return the IP address as private dns hostname in '
                     'describe instances'),
    cfg.BoolOpt('ec2_strict_validation',
                default=True,
                help='Validate security group names'
                     ' according to EC2 specification'),
    cfg.IntOpt('ec2_timestamp_expiry',
               default=300,
               help='Time in seconds before ec2 timestamp expires'),
    ]

CONF = cfg.CONF
CONF.register_opts(ec2_opts)
CONF.import_opt('memcached_servers', 'nova.config')
CONF.import_opt('use_forwarded_for', 'nova.api.auth')
Beispiel #30
0
    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=['nova.exception'],
                help='Modules of exceptions that are permitted to be recreated'
                'upon receiving exception data from an rpc call.'),
    cfg.StrOpt('control_exchange',
               default='nova',
               help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
    cfg.BoolOpt('fake_rabbit',
                default=False,
                help='If passed, use a fake RabbitMQ provider'),
]

cfg.CONF.register_opts(rpc_opts)


def create_connection(new=True):
    """Create a connection to the message bus used for rpc.

    For some example usage of creating a connection and some consumers on that
    connection, see nova.service.

    :param new: Whether or not to create a new connection.  A new connection
                will be created by default.  If new is False, the
                implementation is free to return an existing connection from a