def test_flagfile(self): flags.DEFINE_string('string', 'default', 'desc', flag_values=self.FLAGS) flags.DEFINE_integer('int', 1, 'desc', flag_values=self.FLAGS) flags.DEFINE_bool('false', False, 'desc', flag_values=self.FLAGS) flags.DEFINE_bool('true', True, 'desc', flag_values=self.FLAGS) flags.DEFINE_multistring('multi', ['blaa'], 'desc', flag_values=self.FLAGS) (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--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', 'bar']) # Re-parse to test multistring isn't append multiple times self.FLAGS(['flags_test', '--flagfile=' + path]) self.assertEqual(self.FLAGS.multi, ['foo', 'bar']) finally: os.remove(path)
def test_define(self): self.assert_('string' not in self.FLAGS) self.assert_('int' not in self.FLAGS) self.assert_('false' not in self.FLAGS) self.assert_('true' not in self.FLAGS) flags.DEFINE_string('string', 'default', 'desc', flag_values=self.FLAGS) flags.DEFINE_integer('int', 1, 'desc', flag_values=self.FLAGS) flags.DEFINE_bool('false', False, 'desc', flag_values=self.FLAGS) flags.DEFINE_bool('true', True, 'desc', flag_values=self.FLAGS) self.assert_(self.FLAGS['string']) self.assert_(self.FLAGS['int']) self.assert_(self.FLAGS['false']) self.assert_(self.FLAGS['true']) self.assertEqual(self.FLAGS.string, 'default') self.assertEqual(self.FLAGS.int, 1) self.assertEqual(self.FLAGS.false, False) self.assertEqual(self.FLAGS.true, True) argv = ['flags_test', '--string', 'foo', '--int', '2', '--false', '--notrue'] self.FLAGS(argv) self.assertEqual(self.FLAGS.string, 'foo') self.assertEqual(self.FLAGS.int, 2) self.assertEqual(self.FLAGS.false, True) self.assertEqual(self.FLAGS.true, False)
import functools from novaclient import v1_1 as novaclient from novaclient import exceptions as novaclient_exceptions from nova import db from nova import exception from nova import flags from nova import log as logging from nova import rpc from nova import utils from eventlet import greenpool FLAGS = flags.FLAGS flags.DEFINE_bool('enable_zone_routing', False, 'When True, routing to child zones will occur.') LOG = logging.getLogger('nova.scheduler.api') def _call_scheduler(method, context, params=None): """Generic handler for RPC calls to the scheduler. :param params: Optional dictionary of arguments to be passed to the scheduler worker :retval: Result returned by scheduler worker """ if not params: params = {} queue = FLAGS.scheduler_topic
'%(project)s] %(message)s', 'format string to use for log messages with context') flags.DEFINE_string('logging_default_format_string', '%(asctime)s %(levelname)s %(name)s [-] ' '%(message)s', 'format string to use for log messages without context') flags.DEFINE_string( 'logging_debug_format_suffix', 'from (pid=%(process)d) %(funcName)s' ' %(pathname)s:%(lineno)d', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', '(%(name)s): TRACE: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', [ 'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN', 'eventlet.wsgi.server=WARN' ], 'list of logger=LEVEL pairs') flags.DEFINE_bool('use_syslog', False, 'output to syslog') flags.DEFINE_string('logfile', None, 'output to named file') flags.DEFINE_bool('verbose', False, 'use verbose output') # A list of things we want to replicate from logging. # levels CRITICAL = logging.CRITICAL FATAL = logging.FATAL ERROR = logging.ERROR WARNING = logging.WARNING WARN = logging.WARN INFO = logging.INFO DEBUG = logging.DEBUG NOTSET = logging.NOTSET # methods
import uuid import zipfile from nova import context from nova import crypto from nova import db from nova import exception from nova import flags from nova import log as logging from nova import utils from nova.auth import signer FLAGS = flags.FLAGS flags.DEFINE_bool('use_deprecated_auth', False, 'This flag must be set to use old style auth') flags.DEFINE_list('allowed_roles', ['cloudadmin', 'itsec', 'sysadmin', 'netadmin', 'developer'], 'Allowed roles for project') # NOTE(vish): a user with one of these roles will be a superuser and # have access to all api commands flags.DEFINE_list('superuser_roles', ['cloudadmin'], 'Roles that ignore authorization checking completely') # NOTE(vish): a user with one of these roles will have it for every # project, even if he or she is not a member of the project flags.DEFINE_list('global_roles', ['cloudadmin', 'itsec'], 'Roles that apply to all projects')
'The interval used for polling of coalescing vhds.' ' Used only if connection_type=xenapi.') flags.DEFINE_integer( 'xenapi_vhd_coalesce_max_attempts', 5, 'Max number of times to poll for VHD to coalesce.' ' Used only if connection_type=xenapi.') flags.DEFINE_string( 'xenapi_agent_path', 'usr/sbin/xe-update-networking', 'Specifies the path in which the xenapi guest agent' ' should be located. If the agent is present,' ' network configuration is not injected into the image' ' Used only if connection_type=xenapi.' ' and flat_injected=True') flags.DEFINE_string('xenapi_sr_base_path', '/var/run/sr-mount', 'Base path to the storage repository') flags.DEFINE_bool('xenapi_log_instance_actions', False, 'Log all instance calls to XenAPI in the database.') flags.DEFINE_string('target_host', None, 'iSCSI Target Host') flags.DEFINE_string('target_port', '3260', 'iSCSI Target Port, 3260 Default') flags.DEFINE_string('iqn_prefix', 'iqn.2010-10.org.openstack', '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 flags.DEFINE_bool( 'xenapi_remap_vbd_dev', False, 'Used to enable the remapping of VBD dev ' '(Works around an issue in Ubuntu Maverick)') flags.DEFINE_string( 'xenapi_remap_vbd_dev_prefix', 'sd', 'Specify prefix to remap VBD dev to ' '(ex. /dev/xvdb -> /dev/sdb)') flags.DEFINE_integer('xenapi_login_timeout', 10, 'Timeout in seconds for XenAPI login.')
# 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. """Module for VNC Proxying.""" from nova import flags FLAGS = flags.FLAGS flags.DEFINE_string( 'novncproxy_base_url', 'http://127.0.0.1:6080/vnc_auto.html', 'location of vnc console proxy, \ in the form "http://127.0.0.1:6080/vnc_auto.html"') flags.DEFINE_string( 'xvpvncproxy_base_url', 'http://127.0.0.1:6081/console', 'location of nova xvp vnc console proxy, \ in the form "http://127.0.0.1:6081/console"') flags.DEFINE_string('vncserver_host', '127.0.0.1', 'the host interface on which vnc server should listen') flags.DEFINE_bool('vnc_enabled', True, 'enable vnc related features') flags.DEFINE_string('vnc_keymap', 'en-us', 'keymap for vnc')
from nova import exception from nova import fakevirt from nova import flags from nova import process from nova import utils from nova.compute import disk from nova.compute import model from nova.compute import network from nova.volume import storage from nova.objectstore import image # for image_path flag FLAGS = flags.FLAGS flags.DEFINE_string('libvirt_xml_template', utils.abspath('compute/libvirt.xml.template'), 'Network XML Template') flags.DEFINE_bool('use_s3', True, 'whether to get images from s3 or use local copy') flags.DEFINE_string('instances_path', utils.abspath('../instances'), 'where instances are stored on disk') INSTANCE_TYPES = {} INSTANCE_TYPES['m1.tiny'] = {'memory_mb': 512, 'vcpus': 1, 'local_gb': 0} INSTANCE_TYPES['m1.small'] = {'memory_mb': 1024, 'vcpus': 1, 'local_gb': 10} INSTANCE_TYPES['m1.medium'] = {'memory_mb': 2048, 'vcpus': 2, 'local_gb': 10} INSTANCE_TYPES['m1.large'] = {'memory_mb': 4096, 'vcpus': 4, 'local_gb': 10} INSTANCE_TYPES['m1.xlarge'] = {'memory_mb': 8192, 'vcpus': 4, 'local_gb': 10} INSTANCE_TYPES['c1.medium'] = {'memory_mb': 2048, 'vcpus': 4, 'local_gb': 10} def _image_path(path=''): return os.path.join(FLAGS.images_path, path)
from nova.api.openstack import consoles from nova.api.openstack import flavors from nova.api.openstack import images from nova.api.openstack import image_metadata from nova.api.openstack import ips from nova.api.openstack import limits from nova.api.openstack import servers from nova.api.openstack import server_metadata from nova.api.openstack import shared_ip_groups from nova.api.openstack import users from nova.api.openstack import wsgi from nova.api.openstack import zones LOG = logging.getLogger('nova.api.openstack') FLAGS = flags.FLAGS flags.DEFINE_bool('allow_admin_api', False, 'When True, this API service will accept admin operations.') class FaultWrapper(base_wsgi.Middleware): """Calls down the middleware stack, making exceptions into faults.""" @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, req): try: return req.get_response(self.application) except Exception as ex: LOG.exception(_("Caught error: %s"), unicode(ex)) exc = webob.exc.HTTPInternalServerError(explanation=unicode(ex)) return faults.Fault(exc) class APIRouter(base_wsgi.Router):
'The interval used for polling of remote tasks ' '(Async.VM.start, etc). Used only if ' 'connection_type=xenapi.') flags.DEFINE_string('xenapi_image_service', 'glance', 'Where to get VM images: glance or objectstore.') flags.DEFINE_float( 'xenapi_vhd_coalesce_poll_interval', 5.0, 'The interval used for polling of coalescing vhds.' ' Used only if connection_type=xenapi.') flags.DEFINE_integer( 'xenapi_vhd_coalesce_max_attempts', 5, 'Max number of times to poll for VHD to coalesce.' ' Used only if connection_type=xenapi.') flags.DEFINE_bool( 'xenapi_inject_image', True, 'Specifies whether an attempt to inject network/key' ' data into the disk image should be made.' ' Used only if connection_type=xenapi.') flags.DEFINE_string( 'xenapi_agent_path', 'usr/sbin/xe-update-networking', 'Specifies the path in which the xenapi guest agent' ' should be located. If the agent is present,' ' network configuration is not injected into the image' ' Used only if connection_type=xenapi.' ' and xenapi_inject_image=True') flags.DEFINE_string('xenapi_sr_base_path', '/var/run/sr-mount', 'Base path to the storage repository') flags.DEFINE_string('target_host', None, 'iSCSI Target Host') flags.DEFINE_string('target_port', '3260', 'iSCSI Target Port, 3260 Default')
'%(project_id)s] %(message)s', 'format string to use for log messages with context') flags.DEFINE_string('logging_default_format_string', '%(asctime)s %(levelname)s %(name)s [-] ' '%(message)s', 'format string to use for log messages without context') flags.DEFINE_string( 'logging_debug_format_suffix', 'from (pid=%(process)d) %(funcName)s' ' %(pathname)s:%(lineno)d', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', '(%(name)s): TRACE: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', [ 'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN', 'eventlet.wsgi.server=WARN' ], 'list of logger=LEVEL pairs') flags.DEFINE_bool('use_syslog', False, 'output to syslog') flags.DEFINE_bool('publish_errors', False, 'publish error events') flags.DEFINE_string('logfile', None, 'output to named file') # A list of things we want to replicate from logging. # levels CRITICAL = logging.CRITICAL FATAL = logging.FATAL ERROR = logging.ERROR WARNING = logging.WARNING WARN = logging.WARN INFO = logging.INFO DEBUG = logging.DEBUG NOTSET = logging.NOTSET # methods
# 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 nova import context from nova import db from nova import flags from nova import log as logging from nova import utils from nova.virt import netutils LOG = logging.getLogger("nova.virt.firewall") FLAGS = flags.FLAGS flags.DEFINE_bool('allow_same_net_traffic', True, 'Whether to allow network traffic from same network') class FirewallDriver(object): """ Firewall Driver base class. Defines methos that any driver providing security groups and provider fireall functionality should implement. """ def prepare_instance_filter(self, instance, network_info): """Prepare filters for the instance. At this point, the instance isn't running yet.""" raise NotImplementedError() def unfilter_instance(self, instance, network_info): """Stop filtering instance"""
from nova.api.openstack.compute import images from nova.api.openstack.compute import image_metadata from nova.api.openstack.compute import ips from nova.api.openstack.compute import limits from nova.api.openstack.compute import servers from nova.api.openstack.compute import server_metadata from nova.api.openstack.compute import versions from nova.api.openstack import wsgi from nova import flags from nova import log as logging from nova import wsgi as base_wsgi LOG = logging.getLogger('nova.api.openstack.compute') FLAGS = flags.FLAGS flags.DEFINE_bool( 'allow_instance_snapshots', True, 'When True, this API service will permit instance snapshot operations.') class APIRouter(base_wsgi.Router): """ Routes requests on the OpenStack API to the appropriate controller and method. """ @classmethod def factory(cls, global_config, **local_config): """Simple paste factory, :class:`nova.wsgi.Router` doesn't have one""" return cls() def __init__(self, ext_mgr=None): if ext_mgr is None:
from nova.api.openstack import flavors from nova.api.openstack import images from nova.api.openstack import image_metadata from nova.api.openstack import ips from nova.api.openstack import limits from nova.api.openstack import servers from nova.api.openstack import server_metadata from nova.api.openstack import shared_ip_groups from nova.api.openstack import users from nova.api.openstack import versions from nova.api.openstack import wsgi from nova.api.openstack import zones LOG = logging.getLogger('nova.api.openstack') FLAGS = flags.FLAGS flags.DEFINE_bool('allow_admin_api', False, 'When True, this API service will accept admin operations.') flags.DEFINE_bool( 'allow_instance_snapshots', True, 'When True, this API service will permit instance snapshot operations.') class FaultWrapper(base_wsgi.Middleware): """Calls down the middleware stack, making exceptions into faults.""" @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, req): try: return req.get_response(self.application) except Exception as ex: LOG.exception(_("Caught error: %s"), unicode(ex)) exc = webob.exc.HTTPInternalServerError(explanation=unicode(ex)) return faults.Fault(exc)
import logging import logging.handlers import os import signal import sys import time from nova import vendor import daemon from daemon import pidlockfile from nova import flags FLAGS = flags.FLAGS flags.DEFINE_bool('daemonize', False, 'daemonize this process') # NOTE(termie): right now I am defaulting to using syslog when we daemonize # it may be better to do something else -shrug- # NOTE(Devin): I think we should let each process have its own log file # and put it in /var/logs/nova/(appname).log # This makes debugging much easier and cuts down on sys log # clutter. flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing') flags.DEFINE_string('logfile', None, 'log file to output to') flags.DEFINE_string('pidfile', None, 'pid file to output to') flags.DEFINE_string('working_directory', './', 'working directory...') def stop(pidfile): """ Stop the daemon
flags.DEFINE_string( 'xenapi_agent_path', 'usr/sbin/xe-update-networking', 'Specifies the path in which the xenapi guest agent' ' should be located. If the agent is present,' ' network configuration is not injected into the image' ' Used only if connection_type=xenapi.' ' and flat_injected=True') flags.DEFINE_string('xenapi_sr_base_path', '/var/run/sr-mount', 'Base path to the storage repository') flags.DEFINE_string('target_host', None, 'iSCSI Target Host') flags.DEFINE_string('target_port', '3260', 'iSCSI Target Port, 3260 Default') flags.DEFINE_string('iqn_prefix', 'iqn.2010-10.org.openstack', '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 flags.DEFINE_bool( 'xenapi_remap_vbd_dev', False, 'Used to enable the remapping of VBD dev ' '(Works around an issue in Ubuntu Maverick)') flags.DEFINE_string( 'xenapi_remap_vbd_dev_prefix', 'sd', 'Specify prefix to remap VBD dev to ' '(ex. /dev/xvdb -> /dev/sdb)') flags.DEFINE_integer('xenapi_login_timeout', 10, 'Timeout in seconds for XenAPI login.') def get_connection(_): """Note that XenAPI doesn't have a read-only connection mode, so the read_only parameter is ignored.""" url = FLAGS.xenapi_connection_url username = FLAGS.xenapi_connection_username password = FLAGS.xenapi_connection_password if not url or password is None:
from nova.network import manager from nova.network.quantum import quantum_connection from nova.network.quantum import melange_ipam_lib from nova import utils LOG = logging.getLogger("nova.network.quantum.manager") FLAGS = flags.FLAGS flags.DEFINE_string('quantum_ipam_lib', 'nova.network.quantum.nova_ipam_lib', "Indicates underlying IP address management library") # TODO(Vek): Eventually, this needs to mean more than just using # Melange for assignment of MAC addresses (with an # appropriate flag name change, of course), but this is all # it does right now flags.DEFINE_bool('use_melange_mac_generation', False, "Use Melange for assignment of MAC addresses") flags.DEFINE_bool('quantum_use_dhcp', False, 'Whether or not to enable DHCP for networks') flags.DEFINE_bool('quantum_use_port_security', False, 'Whether or not to enable port security') class QuantumManager(manager.FlatManager): """NetworkManager class that communicates with a Quantum service via a web services API to provision VM network connectivity. For IP Address management, QuantumManager can be configured to use either Nova's local DB or the Melange IPAM service.
import shutil import stubout from eventlet import greenthread from nova import context from nova import db from nova import fakerabbit from nova import flags from nova import rpc from nova import service from nova import wsgi FLAGS = flags.FLAGS flags.DEFINE_string('sqlite_clean_db', 'clean.sqlite', 'File name of clean sqlite db') flags.DEFINE_bool('fake_tests', True, 'should we use everything for testing') def skip_if_fake(func): """Decorator that skips a test if running in fake mode.""" def _skipper(*args, **kw): """Wrapped skipper function.""" if FLAGS.fake_tests: raise unittest.SkipTest('Test cannot be run in fake mode') else: return func(*args, **kw) return _skipper class TestCase(unittest.TestCase):
from nova import context from nova import db from nova import exception from nova import flags from nova import log as logging from nova import manager from nova import utils from nova import rpc LOG = logging.getLogger("nova.network.manager") FLAGS = flags.FLAGS flags.DEFINE_string('flat_network_bridge', 'br100', 'Bridge for simple network instances') flags.DEFINE_string('flat_network_dns', '8.8.4.4', 'Dns for simple network') flags.DEFINE_bool('flat_injected', True, 'Whether to attempt to inject network setup into guest') flags.DEFINE_string('flat_interface', None, 'FlatDhcp will bridge into this interface if set') flags.DEFINE_string('flat_network_dhcp_start', '10.0.0.2', 'Dhcp start for FlatDhcp') flags.DEFINE_integer('vlan_start', 100, 'First VLAN for private networks') flags.DEFINE_string('vlan_interface', 'eth0', 'network device for vlans') flags.DEFINE_integer('num_networks', 1, 'Number of networks to support') flags.DEFINE_string('vpn_ip', '$my_ip', 'Public IP for the cloudpipe VPN servers') flags.DEFINE_integer('vpn_start', 1000, 'First Vpn port for private networks') flags.DEFINE_integer('network_size', 256, 'Number of addresses in each private subnet') flags.DEFINE_string('floating_range', '4.4.4.0/24', 'Floating IP address block') flags.DEFINE_string('fixed_range', '10.0.0.0/8', 'Fixed IP address block')
'format string to use for log messages with context') flags.DEFINE_string('logging_default_format_string', '%(asctime)s %(levelname)s %(name)s [-] ' '%(message)s', 'format string to use for log messages without context') flags.DEFINE_string( 'logging_debug_format_suffix', 'from (pid=%(process)d) %(funcName)s' ' %(pathname)s:%(lineno)d', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', '(%(name)s): TRACE: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', [ 'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN', 'suds=INFO', 'eventlet.wsgi.server=WARN' ], 'list of logger=LEVEL pairs') flags.DEFINE_bool('use_syslog', False, 'output to syslog') flags.DEFINE_bool('publish_errors', False, 'publish error events') flags.DEFINE_string('logfile', None, 'output to named file') flags.DEFINE_bool('use_stderr', True, 'log to standard error') # A list of things we want to replicate from logging. # levels CRITICAL = logging.CRITICAL FATAL = logging.FATAL ERROR = logging.ERROR WARNING = logging.WARNING WARN = logging.WARN INFO = logging.INFO DEBUG = logging.DEBUG NOTSET = logging.NOTSET
from nova.tests.api_unittest import * from nova.tests.cloud_unittest import * from nova.tests.keeper_unittest import * from nova.tests.network_unittest import * from nova.tests.node_unittest import * from nova.tests.objectstore_unittest import * from nova.tests.process_unittest import * from nova.tests.storage_unittest import * from nova.tests.users_unittest import * from nova.tests.datastore_unittest import * from nova.tests.validator_unittest import * FLAGS = flags.FLAGS flags.DEFINE_bool('flush_db', True, 'Flush the database before running fake tests') if __name__ == '__main__': OptionsClass = twistd.WrapTwistedOptions(trial_script.Options) config = OptionsClass() argv = config.parseOptions() FLAGS.verbose = True # TODO(termie): these should make a call instead of doing work on import if FLAGS.fake_tests: from nova.tests.fake_flags import * # use db 8 for fake tests FLAGS.redis_db = 8 if FLAGS.flush_db: logging.info("Flushing redis datastore")
'%(message)s', 'format string to use for log messages without context') flags.DEFINE_string( 'logging_debug_format_suffix', 'from (pid=%(process)d) %(funcName)s' ' %(pathname)s:%(lineno)d', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', '(%(name)s): TRACE: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', [ 'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN', 'eventlet.wsgi.server=WARN' ], 'list of logger=LEVEL pairs') flags.DEFINE_bool('use_syslog', False, 'output to syslog') flags.DEFINE_string('logfile', None, 'output to named file') # A list of things we want to replicate from logging. # levels CRITICAL = logging.CRITICAL FATAL = logging.FATAL ERROR = logging.ERROR WARNING = logging.WARNING WARN = logging.WARN INFO = logging.INFO DEBUG = logging.DEBUG NOTSET = logging.NOTSET # methods getLogger = logging.getLogger debug = logging.debug
'location of nova-dhcpbridge') flags.DEFINE_string('routing_source_ip', '$my_ip', 'Public IP of network host') flags.DEFINE_integer('dhcp_lease_time', 120, 'Lifetime of a DHCP lease in seconds') flags.DEFINE_string('dns_server', None, 'if set, uses specific dns server for dnsmasq') flags.DEFINE_string('dmz_cidr', '10.128.0.0/24', 'dmz range that should be accepted') flags.DEFINE_string('dnsmasq_config_file', "", 'Override the default dnsmasq settings with this file') flags.DEFINE_string('linuxnet_interface_driver', 'nova.network.linux_net.LinuxBridgeInterfaceDriver', 'Driver used to create ethernet devices.') flags.DEFINE_string('linuxnet_ovs_integration_bridge', 'br-int', 'Name of Open vSwitch bridge used with linuxnet') flags.DEFINE_bool('send_arp_for_ha', False, 'send gratuitous ARPs for HA setup') flags.DEFINE_bool( 'use_single_default_gateway', False, 'Use single default gateway. Only first nic of vm' ' will get default gateway from dhcp server') binary_name = os.path.basename(inspect.stack()[-1][1]) class IptablesRule(object): """An iptables rule. You shouldn't need to use this class directly, it's only used by IptablesManager. """ def __init__(self, chain, rule, wrap=True, top=False):
from nova import quota from nova import utils from nova import rpc from nova.network import api as network_api import random LOG = logging.getLogger("nova.network.manager") FLAGS = flags.FLAGS flags.DEFINE_string('flat_network_bridge', None, 'Bridge for simple network instances') flags.DEFINE_string('flat_network_dns', '8.8.4.4', 'Dns for simple network') flags.DEFINE_bool('flat_injected', True, 'Whether to attempt to inject network setup into guest') flags.DEFINE_string('flat_interface', None, 'FlatDhcp will bridge into this interface if set') flags.DEFINE_integer('vlan_start', 100, 'First VLAN for private networks') flags.DEFINE_string('vlan_interface', None, 'vlans will bridge into this interface if set') flags.DEFINE_integer('num_networks', 1, 'Number of networks to support') flags.DEFINE_string('vpn_ip', '$my_ip', 'Public IP for the cloudpipe VPN servers') flags.DEFINE_integer('vpn_start', 1000, 'First Vpn port for private networks') flags.DEFINE_bool('multi_host', False, 'Default value for multi_host in networks') flags.DEFINE_integer('network_size', 256, 'Number of addresses in each private subnet') flags.DEFINE_string('floating_range', '4.4.4.0/24', 'Floating IP address block')
from nova.network import manager from nova.network.quantum import quantum_connection from nova.network.quantum import melange_ipam_lib from nova import utils LOG = logging.getLogger("nova.network.quantum.manager") FLAGS = flags.FLAGS flags.DEFINE_string('quantum_ipam_lib', 'nova.network.quantum.nova_ipam_lib', "Indicates underlying IP address management library") # TODO(Vek): Eventually, this needs to mean more than just using # Melange for assignment of MAC addresses (with an # appropriate flag name change, of course), but this is all # it does right now flags.DEFINE_bool('use_melange_mac_generation', False, "Use Melange for assignment of MAC addresses") flags.DEFINE_string('quantum_use_dhcp', 'False', 'Whether or not to enable DHCP for networks') class QuantumManager(manager.FlatManager): """NetworkManager class that communicates with a Quantum service via a web services API to provision VM network connectivity. For IP Address management, QuantumManager can be configured to use either Nova's local DB or the Melange IPAM service. Currently, the QuantumManager does NOT support: * floating IPs