multi-region flag for describe regions
This commit is contained in:
@@ -174,9 +174,18 @@ class CloudController(object):
|
|||||||
|
|
||||||
@rbac.allow('all')
|
@rbac.allow('all')
|
||||||
def describe_regions(self, context, region_name=None, **kwargs):
|
def describe_regions(self, context, region_name=None, **kwargs):
|
||||||
# TODO(vish): region_name is an array. Support filtering
|
if FLAGS.region_list:
|
||||||
return {'regionInfo': [{'regionName': 'nova',
|
regions = []
|
||||||
'regionUrl': FLAGS.ec2_url}]}
|
for region in FLAGS.region_list:
|
||||||
|
name, _sep, url = region.partition(',')
|
||||||
|
regions.append({'regionName': name,
|
||||||
|
'regionUrl': url})
|
||||||
|
else:
|
||||||
|
regions = [{'regionName': 'nova',
|
||||||
|
'regionUrl': FLAGS.ec2_url}]
|
||||||
|
if region_name:
|
||||||
|
regions = [r for r in regions if r['regionName'] in region_name]
|
||||||
|
return {'regionInfo': regions }
|
||||||
|
|
||||||
@rbac.allow('all')
|
@rbac.allow('all')
|
||||||
def describe_snapshots(self,
|
def describe_snapshots(self,
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ def DECLARE(name, module_string, flag_values=FLAGS):
|
|||||||
# Define any app-specific flags in their own files, docs at:
|
# Define any app-specific flags in their own files, docs at:
|
||||||
# http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py#39
|
# http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py#39
|
||||||
|
|
||||||
|
DEFINE_list('region_list',
|
||||||
|
[],
|
||||||
|
'list of region,url pairs')
|
||||||
DEFINE_string('connection_type', 'libvirt', 'libvirt, xenapi or fake')
|
DEFINE_string('connection_type', 'libvirt', 'libvirt, xenapi or fake')
|
||||||
DEFINE_integer('s3_port', 3333, 's3 port')
|
DEFINE_integer('s3_port', 3333, 's3 port')
|
||||||
DEFINE_string('s3_host', '127.0.0.1', 's3 host')
|
DEFINE_string('s3_host', '127.0.0.1', 's3 host')
|
||||||
|
|||||||
Reference in New Issue
Block a user