From 4e46c04f921c81927ded78f17fd28d5a55ebf9e2 Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Tue, 28 Jun 2016 15:54:13 +0800 Subject: Add "--force" option to "volume qos delete" command Add ``--force`` option to ``volume qos delete`` command in volume v1 and v2 to allow users to delete in-use QoS specification(s). Change-Id: I46036e5f55ced8b8a1be54c521f2a5c242b89160 Closes-Bug: #1596821 --- openstackclient/volume/v1/qos_specs.py | 8 +++++++- openstackclient/volume/v2/qos_specs.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'openstackclient/volume') diff --git a/openstackclient/volume/v1/qos_specs.py b/openstackclient/volume/v1/qos_specs.py index 56a96256..c5850871 100644 --- a/openstackclient/volume/v1/qos_specs.py +++ b/openstackclient/volume/v1/qos_specs.py @@ -103,13 +103,19 @@ class DeleteQos(command.Command): nargs="+", help=_('QoS specification(s) to delete (name or ID)'), ) + parser.add_argument( + '--force', + action='store_true', + default=False, + help=_("Allow to delete in-use QoS specification(s)") + ) return parser def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for qos in parsed_args.qos_specs: qos_spec = utils.find_resource(volume_client.qos_specs, qos) - volume_client.qos_specs.delete(qos_spec.id) + volume_client.qos_specs.delete(qos_spec.id, parsed_args.force) class DisassociateQos(command.Command): diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py index 7ec272b3..5ed1225b 100644 --- a/openstackclient/volume/v2/qos_specs.py +++ b/openstackclient/volume/v2/qos_specs.py @@ -103,13 +103,19 @@ class DeleteQos(command.Command): nargs="+", help=_('QoS specification(s) to delete (name or ID)'), ) + parser.add_argument( + '--force', + action='store_true', + default=False, + help=_("Allow to delete in-use QoS specification(s)") + ) return parser def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for qos in parsed_args.qos_specs: qos_spec = utils.find_resource(volume_client.qos_specs, qos) - volume_client.qos_specs.delete(qos_spec.id) + volume_client.qos_specs.delete(qos_spec.id, parsed_args.force) class DisassociateQos(command.Command): -- cgit v1.2.1