Skip to content

Commit 8acead3

Browse files
committed
volume: fix backup list of deleted volume
When trying to list backups of a deleted volume with --volume, openstackclient fails because the volume does not exist. However, for listing a volume's backups, the volume itself does not need to be present. Fix this issue by allowing the volume of the requested backups to not exist. Story: 2009901 Task: 44716 Change-Id: Iea1a567151f427fa0e1ccff3af5cbeab620defcd Signed-off-by: Jan Hartkopf <jhartkopf@inovex.de>
1 parent 63452f3 commit 8acead3

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

openstackclient/volume/v2/volume_backup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,17 @@ def take_action(self, parsed_args):
310310

311311
filter_volume_id = None
312312
if parsed_args.volume:
313-
filter_volume_id = utils.find_resource(
314-
volume_client.volumes, parsed_args.volume,
315-
).id
313+
try:
314+
filter_volume_id = utils.find_resource(
315+
volume_client.volumes, parsed_args.volume,
316+
).id
317+
except exceptions.CommandError:
318+
# Volume with that ID does not exist, but search for backups
319+
# for that volume nevertheless
320+
LOG.debug("No volume with ID %s existing, continuing to "
321+
"search for backups for that volume ID",
322+
parsed_args.volume)
323+
filter_volume_id = parsed_args.volume
316324

317325
marker_backup_id = None
318326
if parsed_args.marker:

0 commit comments

Comments
 (0)