summaryrefslogtreecommitdiff
path: root/openstackclient/volume
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-12-08 17:46:30 +0000
committerGerrit Code Review <review@openstack.org>2016-12-08 17:46:30 +0000
commitd09fd7d8326349ec10bf4152177528f39cac7ec7 (patch)
tree47747d6e2fadccb8d66a6b6d11194a8cf4ca5a7c /openstackclient/volume
parentf18328e5bfcf553ccb55909976ce097660050d72 (diff)
parentbbfd8cb46bc7493971173f1cbc774ef4697ddfe4 (diff)
downloadpython-openstackclient-d09fd7d8326349ec10bf4152177528f39cac7ec7.tar.gz
Merge "Add '--force' option to 'volume snapshot delete' command"
Diffstat (limited to 'openstackclient/volume')
-rw-r--r--openstackclient/volume/v2/volume_snapshot.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py
index 86af6d8c..d95a49a4 100644
--- a/openstackclient/volume/v2/volume_snapshot.py
+++ b/openstackclient/volume/v2/volume_snapshot.py
@@ -98,6 +98,12 @@ class DeleteVolumeSnapshot(command.Command):
nargs="+",
help=_("Snapshot(s) to delete (name or ID)")
)
+ parser.add_argument(
+ '--force',
+ action='store_true',
+ help=_("Attempt forced removal of snapshot(s), "
+ "regardless of state (defaults to False)")
+ )
return parser
def take_action(self, parsed_args):
@@ -108,7 +114,8 @@ class DeleteVolumeSnapshot(command.Command):
try:
snapshot_id = utils.find_resource(
volume_client.volume_snapshots, i).id
- volume_client.volume_snapshots.delete(snapshot_id)
+ volume_client.volume_snapshots.delete(
+ snapshot_id, parsed_args.force)
except Exception as e:
result += 1
LOG.error(_("Failed to delete snapshot with "