summaryrefslogtreecommitdiff
path: root/cinderclient/v3/shell.py
diff options
context:
space:
mode:
authorxing-yang <xing.yang@emc.com>2016-07-09 21:56:42 -0400
committerxing-yang <xing.yang@emc.com>2017-05-05 02:14:56 -0400
commitda79866e1431442431cb3c077b57252caa480750 (patch)
tree38ee75939524adad9003e61381be8bb1b2610f31 /cinderclient/v3/shell.py
parent0fdd41d84ccfa16245d60617a4099e120f6100cf (diff)
downloadpython-cinderclient-da79866e1431442431cb3c077b57252caa480750.tar.gz
Tiramisu: replication group support
This patch adds CLI support for replication group. It is built upon the generic volume groups. Server side patch is here: https://review.openstack.org/#/c/352228/ Depends-On: I4d488252bd670b3ebabbcc9f5e29e0e4e913765a Change-Id: I462c3ab8c9c3a6a1b434748f81d208359ffd2431 Implements: blueprint replication-cg
Diffstat (limited to 'cinderclient/v3/shell.py')
-rw-r--r--cinderclient/v3/shell.py69
1 files changed, 68 insertions, 1 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index 8994906..3b73b15 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -1174,7 +1174,74 @@ def do_group_update(cs, args):
print("Request to update group '%s' has been accepted." % args.group)
-@api_versions.wraps('3.14')
+@api_versions.wraps('3.38')
+@utils.arg('group',
+ metavar='<group>',
+ help='Name or ID of the group.')
+def do_group_enable_replication(cs, args):
+ """Enables replication for group."""
+
+ shell_utils.find_group(cs, args.group).enable_replication()
+
+
+@api_versions.wraps('3.38')
+@utils.arg('group',
+ metavar='<group>',
+ help='Name or ID of the group.')
+def do_group_disable_replication(cs, args):
+ """Disables replication for group."""
+
+ shell_utils.find_group(cs, args.group).disable_replication()
+
+
+@api_versions.wraps('3.38')
+@utils.arg('group',
+ metavar='<group>',
+ help='Name or ID of the group.')
+@utils.arg('--allow-attached-volume',
+ action='store_true',
+ default=False,
+ help='Allows or disallows group with '
+ 'attached volumes to be failed over.')
+@utils.arg('--secondary-backend-id',
+ metavar='<secondary_backend_id>',
+ help='Secondary backend id. Default=None.')
+def do_group_failover_replication(cs, args):
+ """Fails over replication for group."""
+
+ shell_utils.find_group(cs, args.group).failover_replication(
+ allow_attached_volume=args.allow_attached_volume,
+ secondary_backend_id=args.secondary_backend_id)
+
+
+@api_versions.wraps('3.38')
+@utils.arg('group',
+ metavar='<group>',
+ help='Name or ID of the group.')
+def do_group_list_replication_targets(cs, args):
+ """Lists replication targets for group.
+
+ Example value for replication_targets:
+
+ .. code-block: json
+
+ {
+ 'replication_targets': [{'backend_id': 'vendor-id-1',
+ 'unique_key': 'val1',
+ ......},
+ {'backend_id': 'vendor-id-2',
+ 'unique_key': 'val2',
+ ......}]
+ }
+ """
+
+ rc, replication_targets = shell_utils.find_group(
+ cs, args.group).list_replication_targets()
+ rep_targets = replication_targets.get('replication_targets')
+ if rep_targets and len(rep_targets) > 0:
+ utils.print_list(rep_targets, [key for key in rep_targets[0].keys()])
+
+
@utils.arg('--all-tenants',
dest='all_tenants',
metavar='<0|1>',