
This introduces a new flag "quantum_use_dhcp=<boolean>" which indicates whether or not to enable dhcp for all of the networks. If it is set then we start dnsmasq (and provide it with the IP/MACs from Melange) similar to how this was done in linux_net before. Prior to this if you enabled dhcp then you would also get a gateway device.. some people may not want that so we now require that you specify the gateway when creating the network in order to end up with a device that will act as a gateway. If you're using Melange IPAM and you don't specify the gateway you still end up with one because it doesn't allow you to not have one. This lays the groundwork for the option of not having one in the future, at least :) Also, fix quantum/melange ipam interaction We now query for the subnets by net_id/vif_id instead of searching through all the blocks to find the right one. Both of the allocate and deallocate for instance calls are now using the vif_id -> network_id mapping instead of searching the quantum networks. get_port_by_attachment was also changed to take a net_id so that we don't have to search through all of the quantum networks to find the corresponding port. Change-Id: I6a84da35237b6c5f5cdee91ada92642103439a97
78 lines
2.9 KiB
Python
78 lines
2.9 KiB
Python
# 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.
|
|
|
|
"""
|
|
:mod:`nova.tests` -- Nova Unittests
|
|
=====================================================
|
|
|
|
.. automodule:: nova.tests
|
|
:platform: Unix
|
|
.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
|
|
.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
|
|
.. moduleauthor:: Vishvananda Ishaya <vishvananda@yahoo.com>
|
|
.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
|
|
.. moduleauthor:: Manish Singh <yosh@gimp.org>
|
|
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
|
|
"""
|
|
|
|
# See http://code.google.com/p/python-nose/issues/detail?id=373
|
|
# The code below enables nosetests to work with i18n _() blocks
|
|
import __builtin__
|
|
setattr(__builtin__, '_', lambda x: x)
|
|
|
|
|
|
def setup():
|
|
import os
|
|
import shutil
|
|
|
|
from nova import context
|
|
from nova import flags
|
|
from nova import db
|
|
from nova.db import migration
|
|
from nova.network import manager as network_manager
|
|
from nova.tests import fake_flags
|
|
|
|
FLAGS = flags.FLAGS
|
|
|
|
testdb = os.path.join(FLAGS.state_path, FLAGS.sqlite_db)
|
|
if os.path.exists(testdb):
|
|
return
|
|
migration.db_sync()
|
|
ctxt = context.get_admin_context()
|
|
network = network_manager.VlanManager()
|
|
bridge_interface = FLAGS.flat_interface or FLAGS.vlan_interface
|
|
network.create_networks(ctxt,
|
|
label='test',
|
|
cidr=FLAGS.fixed_range,
|
|
multi_host=FLAGS.multi_host,
|
|
num_networks=FLAGS.num_networks,
|
|
network_size=FLAGS.network_size,
|
|
cidr_v6=FLAGS.fixed_range_v6,
|
|
gateway=FLAGS.gateway,
|
|
gateway_v6=FLAGS.gateway_v6,
|
|
bridge=FLAGS.flat_network_bridge,
|
|
bridge_interface=bridge_interface,
|
|
vpn_start=FLAGS.vpn_start,
|
|
vlan_start=FLAGS.vlan_start,
|
|
dns1=FLAGS.flat_network_dns)
|
|
for net in db.network_get_all(ctxt):
|
|
network.set_network_host(ctxt, net)
|
|
|
|
cleandb = os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db)
|
|
shutil.copyfile(testdb, cleandb)
|