summaryrefslogtreecommitdiff
path: root/cinderclient/v2/consistencygroups.py
diff options
context:
space:
mode:
authorXing Yang <xing.yang@emc.com>2015-01-20 22:38:56 -0500
committerXing Yang <xing.yang@emc.com>2015-04-22 15:42:20 -0400
commit3972431d3ccdd832ab7f9fcfaf310b23bc3c45c3 (patch)
treea2134a8b5520c93ad15a8fc2673ff027128fd7f3 /cinderclient/v2/consistencygroups.py
parentf12aab8035a85d58dd105c9f1faaff8515ed84db (diff)
downloadpython-cinderclient-3972431d3ccdd832ab7f9fcfaf310b23bc3c45c3.tar.gz
Create Consistency Group from CG Snapshot CLI
This patch addressed the following: * Added a new CLI to support creating a CG from a CG snapshot. cinder consisgroup-create-from-src [--cgsnapshot <cgsnapshot>] [--name <name>] [--description <description>] API patch: https://review.openstack.org/#/c/145952/ Partial-Implements: blueprint consistency-groups-kilo-update Change-Id: I03cce04e1d43ea72fc53a8bf614ba4f969f6e32e
Diffstat (limited to 'cinderclient/v2/consistencygroups.py')
-rw-r--r--cinderclient/v2/consistencygroups.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/cinderclient/v2/consistencygroups.py b/cinderclient/v2/consistencygroups.py
index b20cb8b..c833e96 100644
--- a/cinderclient/v2/consistencygroups.py
+++ b/cinderclient/v2/consistencygroups.py
@@ -67,6 +67,32 @@ class ConsistencygroupManager(base.ManagerWithFind):
return self._create('/consistencygroups', body, 'consistencygroup')
+ def create_from_src(self, cgsnapshot_id, name=None,
+ description=None, user_id=None,
+ project_id=None):
+ """Creates a consistencygroup from a cgsnapshot.
+
+ :param cgsnapshot_id: UUID of a CGSnapshot
+ :param name: Name of the ConsistencyGroup
+ :param description: Description of the ConsistencyGroup
+ :param user_id: User id derived from context
+ :param project_id: Project id derived from context
+ :rtype: :class:`Consistencygroup`
+ """
+ body = {'consistencygroup-from-src': {'name': name,
+ 'description': description,
+ 'cgsnapshot_id': cgsnapshot_id,
+ 'user_id': user_id,
+ 'project_id': project_id,
+ 'status': "creating",
+ }}
+
+ self.run_hooks('modify_body_for_update', body,
+ 'consistencygroup-from-src')
+ resp, body = self.api.client.post(
+ "/consistencygroups/create_from_src", body=body)
+ return body['consistencygroup']
+
def get(self, group_id):
"""Get a consistencygroup.