summaryrefslogtreecommitdiff
path: root/troveclient/v1/shell.py
diff options
context:
space:
mode:
authorMorgan Jones <morgan@parelastic.com>2016-10-05 11:08:18 -0400
committeramrith <amrith@tesora.com>2016-11-17 01:28:54 +0000
commitaed18902d07eb091e444b8d4b20bf90ea66a13ca (patch)
treea80689effd2d009d2101cde0d53fbaab0946f9d7 /troveclient/v1/shell.py
parentc4d9ebb66d28fa6ab4ac0ece3803184108893e94 (diff)
downloadpython-troveclient-aed18902d07eb091e444b8d4b20bf90ea66a13ca.tar.gz
Multi-Region Support
This is an initial attempt at supporting multiple regions. It should handle the mechanics of deploying an instance/volume to a remote region. Additional changes may be required to allow the guest agent on the instance to connect back to the originating region. Co-Authored-By: Doug Shelley <doug@tesora.com> Depends-On: I386efb2d5c147417af7ea25704405977c9b6bbcd Change-Id: Ib0b35100c0780dc07c60d20622554ba77c4bc850
Diffstat (limited to 'troveclient/v1/shell.py')
-rw-r--r--troveclient/v1/shell.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py
index 32a33bb..a2c5f48 100644
--- a/troveclient/v1/shell.py
+++ b/troveclient/v1/shell.py
@@ -274,7 +274,7 @@ def _print_instances(instances):
setattr(instance, 'datastore', instance.datastore['type'])
utils.print_list(instances, ['id', 'name', 'datastore',
'datastore_version', 'status',
- 'flavor_id', 'size'])
+ 'flavor_id', 'size', 'region'])
@utils.arg('--limit', metavar='<limit>', type=int, default=None,
@@ -526,6 +526,11 @@ def do_update(cs, args):
choices=LOCALITY_DOMAIN,
help=_('Locality policy to use when creating replicas. Choose '
'one of %(choices)s.'))
+@utils.arg('--region', metavar='<region>',
+ type=str,
+ default=None,
+ help=argparse.SUPPRESS)
+# help=_('Name of region in which to create the instance.'))
@utils.service_type('database')
def do_create(cs, args):
"""Creates a new instance."""
@@ -579,7 +584,9 @@ def do_create(cs, args):
configuration=args.configuration,
replica_of=replica_of,
replica_count=replica_count,
- modules=modules, locality=locality)
+ modules=modules,
+ locality=locality,
+ region_name=args.region)
_print_instance(instance)
@@ -647,6 +654,10 @@ def _get_availability_zone(opts_str):
return _strip_option(opts_str, 'availability_zone', is_required=False)
+def _get_region(cs, opts_str):
+ return _strip_option(opts_str, 'region', is_required=False)
+
+
def _get_modules(cs, opts_str):
modules, opts_str = _strip_option(
opts_str, 'module', is_required=False, allow_multiple=True)
@@ -756,6 +767,10 @@ def _parse_instance_options(cs, instance_options, for_grow=False):
if name:
instance_info["name"] = name
+ region, instance_opts = _get_region(cs, instance_opts)
+ if region:
+ instance_info["region"] = region
+
if instance_opts:
raise exceptions.ValidationError(
_("Unknown option(s) '%s' specified for instance")
@@ -981,9 +996,9 @@ def do_backup_create(cs, args):
@utils.arg('backup', metavar='<backup>',
help=_('Backup ID of the source backup.'),
default=None)
-@utils.arg('--region', metavar='<region>', help=_('Region where the source '
- 'backup resides.'),
- default=None)
+@utils.arg('--region', metavar='<region>', default=None,
+ # help=_('Region where the source backup resides.'))
+ help=argparse.SUPPRESS)
@utils.arg('--description', metavar='<description>',
default=None,
help=_('An optional description for the backup.'))