summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2010-07-02 10:39:04 -0500
committerVishvananda Ishaya <vishvananda@gmail.com>2010-07-02 10:39:04 -0500
commit95e7571a597abdafc638747e2d28c725df96bb17 (patch)
tree6fc597b56993c07fd2003f75373c64855fa87d7b /nova/compute
parentf8a19693b5d4172ce3207c63acf0209ed8b3d636 (diff)
Simple Network avoids vlans
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/network.py21
-rw-r--r--nova/compute/node.py9
2 files changed, 26 insertions, 4 deletions
diff --git a/nova/compute/network.py b/nova/compute/network.py
index 2de8bea4d..ce156967e 100644
--- a/nova/compute/network.py
+++ b/nova/compute/network.py
@@ -58,6 +58,13 @@ flags.DEFINE_integer('cnt_vpn_clients', 5,
flags.DEFINE_integer('cloudpipe_start_port', 12000,
'Starting port for mapped CloudPipe external ports')
+flags.DEFINE_boolean('simple_network', False,
+ 'Use simple networking instead of vlans')
+flags.DEFINE_string('simple_network_bridge', 'br100',
+ 'Bridge for instances')
+flags.DEFINE_list('simple_network_ips', ['192.168.1.1'],
+ 'Available ips for network')
+
logging.getLogger().setLevel(logging.DEBUG)
# CLEANUP:
@@ -418,6 +425,20 @@ def get_network_by_address(address):
return net
raise exception.AddressNotAllocated()
+def allocate_simple_ip():
+ redis = datastore.Redis.instance()
+ if not redis.exists('ips') and not len(redis.keys('instances:*')):
+ for address in FLAGS.simple_network_ips:
+ redis.sadd('ips', address)
+ address = redis.spop('ips')
+ if not address:
+ raise exception.NoMoreAddresses()
+ return address
+
+def deallocate_simple_ip(address):
+ datastore.Redis.instance().sadd('ips', address)
+
+
def allocate_vpn_ip(user_id, project_id, mac):
return get_project_network(project_id).allocate_vpn_ip(mac)
diff --git a/nova/compute/node.py b/nova/compute/node.py
index 65eb4bf3e..1b4714d67 100644
--- a/nova/compute/node.py
+++ b/nova/compute/node.py
@@ -57,7 +57,7 @@ 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')
+ 'Libvirt 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'),
@@ -151,9 +151,10 @@ class Node(object, service.Service):
""" launch a new instance with specified options """
logging.debug("Starting instance %s..." % (instance_id))
inst = self.instdir.get(instance_id)
- # TODO: Get the real security group of launch in here
- security_group = "default"
- net = network.BridgedNetwork.get_network_for_project(inst['user_id'],
+ if not FLAGS.simple_network:
+ # TODO: Get the real security group of launch in here
+ security_group = "default"
+ net = network.BridgedNetwork.get_network_for_project(inst['user_id'],
inst['project_id'],
security_group).express()
inst['node_name'] = FLAGS.node_name