diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-07-04 10:18:45 +0800 |
|---|---|---|
| committer | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-12-08 17:08:58 +0800 |
| commit | bbfd8cb46bc7493971173f1cbc774ef4697ddfe4 (patch) | |
| tree | 64bf707774288750f81f19d48a16cf54d12e4b4e /openstackclient/volume | |
| parent | 158dbe124a11873129d2b3fbc6a9b5a6695e7bcc (diff) | |
| download | python-openstackclient-bbfd8cb46bc7493971173f1cbc774ef4697ddfe4.tar.gz | |
Add '--force' option to 'volume snapshot delete' command
Add '--force' option to 'volume snapshot delete' command in
volume v2 (v2 only) to allow delete in state other than error
or available.
Change-Id: Ie8991e9a630d7c7e9ac6c6870aed787bbcebacf2
Closes-Bug: #1597195
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/v2/volume_snapshot.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py index 43f30326..5fdeca3a 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 " |
