summaryrefslogtreecommitdiff
path: root/cinderclient/v2/volumes.py
diff options
context:
space:
mode:
authorsaurabh <sourabh.chordiya@gmail.com>2013-09-19 21:26:15 +0530
committersaurabh <saurabh.chordiya@nectechnologies.in>2013-10-15 23:41:08 +0530
commitd3a366fd0d22e9d6038685f54108d4b54d416372 (patch)
tree2b1401dd36102ca7749bc6fbc4f85c8eacb25a06 /cinderclient/v2/volumes.py
parent873bed99a8019f87bbce3edf883153e7f67e875e (diff)
downloadpython-cinderclient-d3a366fd0d22e9d6038685f54108d4b54d416372.tar.gz
Addition of volume/snapshot_metadata CLI
Added below CLIs:- 1. Set or Delete metadata of a snapshot 2. Show metadata of a snapshot 3. Show metadata of a volume 4. Update all metadata of volume 5. Update all metadata of snapshot Implements blueprint: add-metadata-cli Change-Id: Ic2b5f3fce6104d1756879718f666a42549458ad3
Diffstat (limited to 'cinderclient/v2/volumes.py')
-rw-r--r--cinderclient/v2/volumes.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py
index e948cff..e6dae97 100644
--- a/cinderclient/v2/volumes.py
+++ b/cinderclient/v2/volumes.py
@@ -121,6 +121,10 @@ class Volume(base.Resource):
# self.manager.migrate_volume_completion(self, old_volume,
# new_volume, error)
+ def update_all_metadata(self, metadata):
+ """Update all metadata of this volume."""
+ return self.manager.update_all_metadata(self, metadata)
+
class VolumeManager(base.ManagerWithFind):
"""Manage :class:`Volume` resources."""
@@ -314,7 +318,7 @@ class VolumeManager(base.ManagerWithFind):
"""Delete specified keys from volumes metadata.
:param volume: The :class:`Volume`.
- :param metadata: A list of keys to be removed.
+ :param keys: A list of keys to be removed.
"""
for k in keys:
self._delete("/volumes/%s/metadata/%s" % (base.getid(volume), k))
@@ -377,3 +381,13 @@ class VolumeManager(base.ManagerWithFind):
return self._action('os-migrate_volume_completion',
old_volume,
{'new_volume': new_volume_id, 'error': error})[1]
+
+ def update_all_metadata(self, volume, metadata):
+ """Update all metadata of a volume.
+
+ :param volume: The :class:`Volume`.
+ :param metadata: A list of keys to be updated.
+ """
+ body = {'metadata': metadata}
+ return self._update("/volumes/%s/metadata" % base.getid(volume),
+ body)