summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2010-09-21 04:08:25 +0000
committerTarmac <>2010-09-21 04:08:25 +0000
commitbc09d0e99c6acae3a0f627a26f302391eea797a5 (patch)
tree7e83cbb1a37db5f11acd9663433cc06bfcc7d985
parent8e3508e0109973056e7fd78809ef7ea94d949168 (diff)
parentce1a8086f7ec947dd148855910a1a5a9696e33f7 (diff)
allows api servers to have a list of regions, allowing multi-cluster support if you have a shared image store and user database.
-rw-r--r--nova/endpoint/cloud.py15
-rw-r--r--nova/flags.py3
2 files changed, 15 insertions, 3 deletions
diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py
index e29d09a89..4e5e2d7f2 100644
--- a/nova/endpoint/cloud.py
+++ b/nova/endpoint/cloud.py
@@ -162,9 +162,18 @@ class CloudController(object):
@rbac.allow('all')
def describe_regions(self, context, region_name=None, **kwargs):
- # TODO(vish): region_name is an array. Support filtering
- return {'regionInfo': [{'regionName': 'nova',
- 'regionUrl': FLAGS.ec2_url}]}
+ if FLAGS.region_list:
+ regions = []
+ for region in FLAGS.region_list:
+ name, _sep, url = region.partition('=')
+ regions.append({'regionName': name,
+ 'regionEndpoint': url})
+ else:
+ regions = [{'regionName': 'nova',
+ 'regionEndpoint': FLAGS.ec2_url}]
+ if region_name:
+ regions = [r for r in regions if r['regionName'] in region_name]
+ return {'regionInfo': regions }
@rbac.allow('all')
def describe_snapshots(self,
diff --git a/nova/flags.py b/nova/flags.py
index ed0baee65..6a1c14490 100644
--- a/nova/flags.py
+++ b/nova/flags.py
@@ -167,6 +167,9 @@ def DECLARE(name, module_string, flag_values=FLAGS):
# Define any app-specific flags in their own files, docs at:
# http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py#39
+DEFINE_list('region_list',
+ [],
+ 'list of region=url pairs separated by commas')
DEFINE_string('connection_type', 'libvirt', 'libvirt, xenapi or fake')
DEFINE_integer('s3_port', 3333, 's3 port')
DEFINE_string('s3_host', '127.0.0.1', 's3 host')