Add force-delete option for volumes
Again, looking thorouhgly through cinders commands, i noticed an force-delete command, which was for volumes only. Decided it would work best as an optional argument for the regular delete case Change-Id: I9de6040ea0ad71c2a9c8edc7be18779d39e7ede0
This commit is contained in:
parent
0c252b615d
commit
1ddc30100f
@ -125,7 +125,14 @@ class DeleteVolume(command.Command):
|
||||
parser.add_argument(
|
||||
'volume',
|
||||
metavar='<volume>',
|
||||
help='ID of volume to delete',
|
||||
help='Name or ID of volume to delete',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--force',
|
||||
dest='force',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Attempt forced removal of a volume, regardless of state',
|
||||
)
|
||||
return parser
|
||||
|
||||
@ -134,7 +141,10 @@ class DeleteVolume(command.Command):
|
||||
volume_client = self.app.client_manager.volume
|
||||
volume = utils.find_resource(
|
||||
volume_client.volumes, parsed_args.volume)
|
||||
volume_client.volumes.delete(volume.id)
|
||||
if parsed_args.force:
|
||||
volume_client.volumes.force_delete(volume.id)
|
||||
else:
|
||||
volume_client.volumes.delete(volume.id)
|
||||
return
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user