summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2/snapshot.py
diff options
context:
space:
mode:
authorHuanxuan Ao <huanxuan.ao@easystack.cn>2016-09-14 14:54:29 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-11-03 16:15:02 +0800
commit23ee2fd8f060ed312a84eb03c99494e8af2ffb6f (patch)
tree176e424ea42898da333c1f8b95daf72b23544828 /openstackclient/volume/v2/snapshot.py
parent970b0e00053f81a313c18cc9b50bf964aa86fc20 (diff)
downloadpython-openstackclient-23ee2fd8f060ed312a84eb03c99494e8af2ffb6f.tar.gz
Refactor "snapshot" commands
1.change the command name ``snapshot create/delete/list/ show/set/unset`` to ``volume snapshot create/delete/list/ show/set/unset``. 2.change the optional parameter "--name <name>" to a positional parameter "<snapshot-name>"; Change the positional parameter "<volume>" to a optional parameter "--volume <volume>" Change-Id: If03276ecdf6f0d96893d5ecf91c2aaa64929cff3 Implements: bp backup-snapshot-renamed-for-volume-resource Co-Authored-By: Sheel Rana <ranasheel2000@gmail.com>
Diffstat (limited to 'openstackclient/volume/v2/snapshot.py')
-rw-r--r--openstackclient/volume/v2/snapshot.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py
index 4994e0da..2f3de211 100644
--- a/openstackclient/volume/v2/snapshot.py
+++ b/openstackclient/volume/v2/snapshot.py
@@ -12,6 +12,10 @@
# under the License.
#
+# TODO(Huanxuan Ao): Remove this file and "snapshot create", "snapshot delete",
+# "snapshot set", "snapshot show" and "snapshot unset"
+# commands two cycles after Ocata.
+
"""Volume v2 snapshot action implementations"""
import copy
@@ -26,6 +30,8 @@ import six
from openstackclient.i18n import _
+deprecated = True
+LOG_DEP = logging.getLogger('deprecated')
LOG = logging.getLogger(__name__)
@@ -66,6 +72,8 @@ class CreateSnapshot(command.ShowOne):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot create" instead.'))
volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(
volume_client.volumes, parsed_args.volume).id
@@ -96,6 +104,8 @@ class DeleteSnapshot(command.Command):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot delete" instead.'))
volume_client = self.app.client_manager.volume
result = 0
@@ -149,6 +159,8 @@ class ListSnapshot(command.Lister):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot list" instead.'))
def _format_volume_id(volume_id):
"""Return a volume name if available
@@ -239,6 +251,8 @@ class SetSnapshot(command.Command):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot set" instead.'))
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots,
parsed_args.snapshot)
@@ -292,6 +306,8 @@ class ShowSnapshot(command.ShowOne):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot show" instead.'))
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(
volume_client.volume_snapshots, parsed_args.snapshot)
@@ -322,6 +338,8 @@ class UnsetSnapshot(command.Command):
return parser
def take_action(self, parsed_args):
+ LOG_DEP.warning(_('This command has been deprecated. '
+ 'Please use "volume snapshot unset" instead.'))
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(
volume_client.volume_snapshots, parsed_args.snapshot)