bug 917397
Add configuration sanity to QuantumManager. Logs error message if a parameter not used by QuantumManager's create_networks() method is passed into it. Change-Id: I1d6daa7f77590a61b542122ada33ed1c188df19f
This commit is contained in:
2 changed files with 47 additions and 0 deletions
1
Authors
1
Authors
@@ -35,6 +35,7 @@ Cory Wright <corywright@gmail.com>
Dan Prince <dan.prince@rackspace.com>
Dan Wendlandt <dan@nicira.com>
Daniel P. Berrange <berrange@redhat.com>
Dave Lapsley <dlapsley@nicira.com>
Dave Walker <DaveWalker@ubuntu.com>
David Pravec <David.Pravec@danix.org>
David Subiros <david.perez5@hp.com>
@@ -132,9 +132,55 @@ class QuantumManager(manager.FlatManager):
In both cases, we initialize a subnet using the IPAM lib.
"""
# Enforce Configuration sanity.
#
# These flags are passed in from bin/nova-manage. The script
# collects the arguments and then passes them in through this
# function call. Note that in some cases, the script pre-processes
# the arguments, and sets them to a default value if a parameter's
# value was not specified on the command line. For pre-processed
# parameters, the most effective check to see if the user passed it
# in is to see if is different from the default value. (This
# does miss the use case where the user passes in the default value
# on the command line -- but it is unavoidable.)
if multi_host != FLAGS.multi_host:
# User specified it on the command line.
raise Exception(_("QuantumManager does not use 'multi_host'"
" parameter."))
if num_networks != 1:
raise Exception(_("QuantumManager requires that only one"
" network is created per call"))
if network_size != int(FLAGS.network_size):
# User specified it on the command line.
LOG.warning("Ignoring unnecessary parameter 'network_size'")
if kwargs.get('vlan_start', None):
if kwargs['vlan_start'] != int(FLAGS.vlan_start):
# User specified it on the command line.
LOG.warning(_("QuantumManager does not use 'vlan_start'"
" parameter."))
if kwargs.get('vpn_start', None):
if kwargs['vpn_start'] != int(FLAGS.vpn_start):
# User specified it on the command line.
LOG.warning(_("QuantumManager does not use 'vpn_start'"
" parameter."))
if bridge is not None and len(bridge) > 0:
LOG.warning(_("QuantumManager does not use 'bridge'"
" parameter."))
if bridge_interface is not None and len(bridge_interface) > 0:
LOG.warning(_("QuantumManager does not use 'bridge_interface'"
" parameter."))
if gateway is not None and len(gateway) > 0:
if gateway.split('.')[3] != '1':
raise Exception(_("QuantumManager requires a valid (.1)"
" gateway address."))
q_tenant_id = kwargs["project_id"] or FLAGS.quantum_default_tenant_id
quantum_net_id = uuid
# If a uuid was specified with the network it should have already been
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.